手机管家 v7.2.0版本的 MD5 值为:dd92ba71696e35a4b841cd1b5de53cd3

以下内容为反编译后的 a.java 源代码,内容仅作参考


package com.meri.service.daemon;

import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.net.LocalSocket;
import android.net.LocalSocketAddress;
import android.net.Uri;
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Process;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.SparseArray;
import android.util.SparseIntArray;
import com.meri.service.feature.FeatureTunnelDB;
import com.meri.service.monitor.JobSchedulerService;
import com.tencent.kingkong.database.SQLiteDatabase;
import com.tencent.qqpimsecure.dao.h;
import com.tencent.qqpimsecure.model.w;
import com.tencent.server.base.QQSecureApplication;
import com.tencent.server.base.d;
import com.tencent.server.base.p;
import com.tencent.tcuser.util.Encode;
import com.tencent.tmsecurelite.networkmgr.NetworkMgrConst;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import meri.pluginsdk.d;
import oicq.wlogin_sdk.request.WtloginHelper;
import tcs.aav;
import tcs.ahi;
import tcs.ahk;
import tcs.aic;
import tcs.aig;
import tcs.ajy;
import tcs.ake;
import tcs.anr;
import tcs.auv;
import tcs.azv;
import tcs.ba;
import tcs.bim;
import tcs.bir;
import tcs.bja;
import tcs.bkq;
import tcs.bql;
import tcs.lo;
import tcs.qf;
import tcs.qz;
import tcs.rf;
import tcs.rl;
import tcs.sn;
import tcs.te;
import tcs.tv;
import tcs.ub;
import tcs.uc;
import tcs.uf;
import tcs.vv;
import tcs.yz;
import tmsdk.common.TMSDKContext;
import tmsdk.common.internal.utils.i;
import tmsdk.common.tcc.TccCryptor;

public class a {
    private static int fNS = 3;
    private static String fNT = null;
    static volatile long fNU = -1;
    static volatile long bSu = -1;
    private static Handler fNV = null;
    private static int fNW = -1;
    private static int fNX = -1;
    private static String fNY = null;
    private static ReentrantReadWriteLock fLl = new ReentrantReadWriteLock();
    private static boolean fNZ = false;

    static boolean SC() {
        return RO();
    }

    static Handler SD() {
        return getHandler();
    }

    static boolean SE() {
        return RM();
    }

    static int SG() {
        int i = fNS;
        fNS = i - 1;
        return i;
    }

    static long SJ() {
        return Sw();
    }

    static String SK() {
        return Sc();
    }

    private static Handler getHandler() {
        if (fNV == null) {
            synchronized (a.class) {
                if (fNV == null) {
                    HandlerThread s = ((aig) bir.pC(4)).s("MeriDaemonHandler", 5);
                    s.start();
                    fNV = new Handler(s.getLooper());
                }
            }
        }
        return fNV;
    }

    public static void vr() {
        RZ();
        l(false, false);
    }

    private static String RJ() {
        return Build.VERSION.SDK_INT >= 21 ? "xdm_50" : "xdm";
    }

    public static synchronized void l(final boolean z, final boolean z2) {
        synchronized (a.class) {
            if (!sn.CQ()) {
                getHandler().post(new Runnable() {
                    @Override
                    public void run() {
                        a.RP();
                        if (!z && a.SC()) {
                            a.SD().postDelayed(new Runnable() {
                                @Override
                                public void run() {
                                    a.l(true, z2);
                                }
                            }, 15000L);
                            return;
                        }
                        if (!a.SE()) {
                            if (a.fNS > 0) {
                                a.SG();
                                a.SD().postDelayed(new Runnable() {
                                    @Override
                                    public void run() {
                                        a.l(false, z2);
                                    }
                                }, 2000L);
                                return;
                            }
                            return;
                        }
                        a.RK();
                        if (a.fNU <= 0) {
                            ahi.b bVar = new ahi.b() {
                                @Override
                                public void a(int i, Intent intent) {
                                    a.RL();
                                }
                            };
                            ahi ahiVar = (ahi) bir.pC(8);
                            ahiVar.a(1026, bVar);
                            ahiVar.a(1013, bVar);
                            ahiVar.a(1031, bVar);
                            ahiVar.a(1054, bVar);
                            ahiVar.a(1015, bVar);
                        }
                        boolean SC = a.SC();
                        if (SC) {
                            a.fNU = System.currentTimeMillis();
                        }
                        if (z2) {
                            if (SC) {
                                yz.a(bim.QJ().kH(), ba.dBi, "1", 4);
                            } else {
                                yz.a(bim.QJ().kH(), ba.dBi, "0", 4);
                            }
                        }
                    }
                });
            }
        }
    }

    public static void RK() {
        OutputStream outputStream;
        String fz;
        String format;
        OutputStream outputStream2;
        if (sn.CQ()) {
            return;
        }
        String a = i.a(d.agJ(), RJ(), (String) null);
        ProcessBuilder processBuilder = new ProcessBuilder(new String[0]);
        processBuilder.command("sh");
        OutputStream outputStream3 = null;
        try {
            try {
                String packageName = d.agJ().getPackageName();
                if (TextUtils.isEmpty(packageName)) {
                    packageName = "com.tencent.qqpimsecure";
                }
                if (!"com.tencent.qqpimsecure".equalsIgnoreCase(packageName)) {
                    d.l(new RuntimeException("APP_PACKAGE_NAME invalid: " + packageName));
                }
                String eu = uf.eu(TMSDKContext.getStrFromEnvMap(TMSDKContext.CON_LC));
                String eu2 = uf.eu(TMSDKContext.getStrFromEnvMap(TMSDKContext.CON_SOFTVERSION));
                String eu3 = uf.eu(ajy.i(d.agJ()));
                String eu4 = uf.eu(ajy.k(d.agJ()));
                String eu5 = uf.eu(TMSDKContext.getStrFromEnvMap(TMSDKContext.CON_CHANNEL));
                String eu6 = uf.eu(ub.X(d.agJ()));
                int intFromEnvMap = TMSDKContext.getIntFromEnvMap(TMSDKContext.CON_SUB_PLATFORM);
                int i = tv.W(d.agJ()) ? 1 : 0;
                int KF = uc.KF();
                int intFromEnvMap2 = TMSDKContext.getIntFromEnvMap(TMSDKContext.CON_BUILD);
                String eu7 = uf.eu(ajy.kP());
                String VR = ub.VR();
                int abi = bkq.abi();
                int myUid = Process.myUid();
                int i2 = ake.cOE ? 0 : 1;
                int i3 = ake.cOy ? 1 : 0;
                fNT = packageName + "_xdm_" + myUid;
                String str = TMSDKContext.getApplicaionContext().getPackageName() + "_" + TMSDKContext.getStrFromEnvMap(TMSDKContext.CON_ATHENA_NAME) + "_" + myUid;
                String bQ = bQ(d.agJ());
                String RR = RR();
                int SV = b.SV();
                fz = w.nI().fz();
                if (TextUtils.isEmpty(fz)) {
                    fz = w.nI().fA();
                }
                if (TextUtils.isEmpty(fz)) {
                    fz = ((aic) bir.pC(5)).getGuid();
                }
                Object[] objArr = new Object[25];
                objArr[0] = a;
                objArr[1] = !TextUtils.isEmpty(eu) ? eu : "0";
                objArr[2] = !TextUtils.isEmpty(packageName) ? packageName : "0";
                objArr[3] = !TextUtils.isEmpty(eu2) ? eu2 : "0";
                objArr[4] = !TextUtils.isEmpty(eu3) ? eu3 : "0";
                objArr[5] = !TextUtils.isEmpty(eu4) ? eu4 : "0";
                objArr[6] = Integer.valueOf(abi);
                objArr[7] = eu5;
                objArr[8] = !TextUtils.isEmpty(fz) ? fz : "0";
                objArr[9] = !TextUtils.isEmpty(eu6) ? eu6 : "0";
                objArr[10] = Integer.valueOf(myUid);
                objArr[11] = fNT;
                objArr[12] = str;
                objArr[13] = bQ;
                objArr[14] = RR;
                objArr[15] = Integer.valueOf(SV);
                objArr[16] = Integer.valueOf(i2);
                objArr[17] = Integer.valueOf(i3);
                objArr[18] = 2;
                objArr[19] = Integer.valueOf(intFromEnvMap);
                objArr[20] = Integer.valueOf(i);
                objArr[21] = Integer.valueOf(KF);
                objArr[22] = Integer.valueOf(intFromEnvMap2);
                objArr[23] = eu7;
                objArr[24] = VR;
                format = String.format("chmod 755 %s\n%s\nexit\n", a, String.format("exec %s %s %s %s %s %s %d %s %s %s %d %s %s %s %s %d %d %d %d %d %d %d %d %s %s", objArr));
                processBuilder.redirectErrorStream(true);
                outputStream2 = processBuilder.start().getOutputStream();
            } catch (Exception e) {
                outputStream = null;
            }
            try {
                outputStream2.write(format.getBytes());
                outputStream2.flush();
                if (TextUtils.isEmpty(fz)) {
                    ((lo) bir.pC(5)).c(new azv() {
                        @Override
                        public void E(int i4, String str2) {
                            if (i4 == 0) {
                                a.H("guid", str2);
                            }
                        }
                    });
                }
                if (outputStream2 != null) {
                    try {
                        outputStream2.close();
                    } catch (Exception e2) {
                    }
                }
            } catch (Exception e3) {
                outputStream = outputStream2;
                if (outputStream != null) {
                    try {
                        outputStream.close();
                    } catch (Exception e4) {
                    }
                }
            }
        } catch (Throwable th) {
            if (0 != 0) {
                try {
                    outputStream3.close();
                } catch (Exception e5) {
                }
            }
            throw th;
        }
    }

    public static void RL() {
        if (!sn.CQ()) {
            getHandler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    int i;
                    if (a.fNU > 0) {
                        if (d.kL()) {
                            i = 60000;
                        } else {
                            i = 300000;
                        }
                        long currentTimeMillis = System.currentTimeMillis();
                        if (a.bSu <= 0 || Math.abs(currentTimeMillis - a.bSu) >= i) {
                            a.bSu = currentTimeMillis;
                            if (!a.SC()) {
                                a.l(true, true);
                            } else {
                                yz.c(bim.QJ().kH(), ba.dAS, 2);
                            }
                        }
                    }
                }
            }, anr.dZK);
        }
    }

    private static synchronized boolean RM() {
        boolean z;
        synchronized (a.class) {
            try {
                ArrayList<Integer> RN = RN();
                if (RN != null && RN.size() > 0) {
                    Iterator<Integer> it = RN.iterator();
                    while (it.hasNext()) {
                        Process.killProcess(it.next().intValue());
                    }
                }
                z = !RO();
            } catch (Exception e) {
                z = false;
            }
        }
        return z;
    }

    private static ArrayList<Integer> RN() {
        String[] split;
        int i;
        String[] split2;
        String[] split3;
        String[] split4;
        String[] split5;
        ArrayList<Integer> arrayList = new ArrayList<>();
        try {
            String c = c(new String[]{"pgrep", RJ()}, null);
            if (TextUtils.isEmpty(c)) {
                c = c(new String[]{"pidof", RJ()}, null);
            }
            if (!TextUtils.isEmpty(c) && (split5 = c.split("\n")) != null && split5.length > 0) {
                for (String str : split5) {
                    try {
                        arrayList.add(Integer.valueOf(Integer.valueOf(str).intValue()));
                    } catch (Exception e) {
                    }
                }
            }
            if (arrayList.size() <= 0) {
                String c2 = c(new String[]{"sh", "-c", "ps | grep " + RJ()}, null);
                if (TextUtils.isEmpty(c2)) {
                    c2 = c(new String[]{NetworkMgrConst.key_province_str, RJ()}, null);
                }
                if (!TextUtils.isEmpty(c2) && c2.indexOf(RJ()) >= 0 && (split = c2.split("\n")) != null && split.length > 0) {
                    String c3 = c(new String[]{"sh", "-c", NetworkMgrConst.key_province_str}, null);
                    if (c3 == null || (split3 = c3.split("\n")) == null || split3.length <= 0 || (split4 = split3[0].split(" ")) == null || split4.length <= 0) {
                        i = -1;
                    } else {
                        int i2 = 0;
                        int i3 = 0;
                        while (true) {
                            if (i2 >= split4.length) {
                                i = i3;
                                break;
                            }
                            String str2 = split4[i2];
                            if (str2 != null && str2.trim().length() > 0) {
                                i3++;
                                if (str2.equalsIgnoreCase("pid")) {
                                    i = i3;
                                    break;
                                }
                            }
                            i2++;
                        }
                    }
                    if (i != -1) {
                        for (String str3 : split) {
                            if (str3 != null && str3.contains("com.tencent.qqpimsecure") && (split2 = str3.split(" ")) != null && split2.length > i) {
                                int i4 = 0;
                                for (String str4 : split2) {
                                    if (str4 != null && str4.trim().length() > 0 && (i4 = i4 + 1) == i) {
                                        try {
                                            arrayList.add(Integer.valueOf(Integer.valueOf(str4).intValue()));
                                        } catch (Exception e2) {
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } catch (Throwable th) {
        }
        return arrayList;
    }

    private static boolean RO() {
        String c = c(new String[]{"sh", "-c", "ps | grep " + RJ()}, null);
        if (c == null || c.length() == 0) {
            c = c(new String[]{NetworkMgrConst.key_province_str, RJ()}, null);
        }
        return c != null && c.indexOf(RJ()) >= 0 && c.indexOf("com.tencent.qqpimsecure") >= 0;
    }

    private static String c(String[] strArr, String str) {
        InputStream inputStream;
        Throwable th;
        StringBuilder sb = new StringBuilder();
        InputStream inputStream2 = null;
        try {
            try {
                ProcessBuilder processBuilder = new ProcessBuilder(strArr);
                if (str != null) {
                    processBuilder.directory(new File(str));
                }
                processBuilder.redirectErrorStream(false);
                InputStream inputStream3 = processBuilder.start().getInputStream();
                try {
                    byte[] bArr = new byte[256];
                    while (true) {
                        int read = inputStream3.read(bArr);
                        if (read == -1) {
                            break;
                        }
                        sb.append(new String(bArr, 0, read));
                    }
                    if (inputStream3 != null) {
                        try {
                            inputStream3.close();
                        } catch (IOException e) {
                        }
                    }
                } catch (Throwable th2) {
                    inputStream = inputStream3;
                    th = th2;
                    if (inputStream == null) {
                        throw th;
                    }
                    try {
                        inputStream.close();
                        throw th;
                    } catch (IOException e2) {
                        throw th;
                    }
                }
            } catch (Throwable th3) {
                inputStream = null;
                th = th3;
            }
        } catch (Exception e3) {
            if (0 != 0) {
                try {
                    inputStream2.close();
                } catch (IOException e4) {
                }
            }
        }
        return sb.toString();
    }

    public static void pH(int i) {
        FileOutputStream fileOutputStream;
        Throwable th;
        if (!sn.CQ()) {
            FileOutputStream fileOutputStream2 = null;
            try {
                String str = d.agJ().getFilesDir().toString() + File.separator + "j_dd_fl.dat";
                File file = new File(str);
                if (file.exists()) {
                    file.delete();
                }
                fileOutputStream = new FileOutputStream(str);
                try {
                    fileOutputStream.write((SQLiteDatabase.KeyEmpty + i + "\n").getBytes("UTF-8"));
                    fileOutputStream.flush();
                    if (fileOutputStream != null) {
                        try {
                            fileOutputStream.close();
                        } catch (Exception e) {
                        }
                    }
                } catch (Exception e2) {
                    fileOutputStream2 = fileOutputStream;
                    if (fileOutputStream2 != null) {
                        try {
                            fileOutputStream2.close();
                        } catch (Exception e3) {
                        }
                    }
                } catch (Throwable th2) {
                    th = th2;
                    if (fileOutputStream != null) {
                        try {
                            fileOutputStream.close();
                        } catch (Exception e4) {
                        }
                    }
                    throw th;
                }
            } catch (Exception e5) {
            } catch (Throwable th3) {
                fileOutputStream = null;
                th = th3;
            }
        }
    }

    public static void RP() {
        if (!new File(d.agJ().getFilesDir().toString() + File.separator + "x_rb_j_al_ct_2.dat").exists()) {
            pI(2);
        }
    }

    public static void pI(int i) {
        FileOutputStream fileOutputStream;
        Throwable th;
        FileOutputStream fileOutputStream2 = null;
        try {
            String str = d.agJ().getFilesDir().toString() + File.separator + "x_rb_j_al_ct_2.dat";
            File file = new File(str);
            if (file.exists()) {
                file.delete();
            }
            fileOutputStream = new FileOutputStream(str);
            try {
                fileOutputStream.write((SQLiteDatabase.KeyEmpty + i + "\n").getBytes("UTF-8"));
                fileOutputStream.flush();
                if (fileOutputStream != null) {
                    try {
                        fileOutputStream.close();
                    } catch (Exception e) {
                    }
                }
            } catch (Exception e2) {
                fileOutputStream2 = fileOutputStream;
                if (fileOutputStream2 != null) {
                    try {
                        fileOutputStream2.close();
                    } catch (Exception e3) {
                    }
                }
            } catch (Throwable th2) {
                th = th2;
                if (fileOutputStream != null) {
                    try {
                        fileOutputStream.close();
                    } catch (Exception e4) {
                    }
                }
                throw th;
            }
        } catch (Exception e5) {
        } catch (Throwable th3) {
            fileOutputStream = null;
            th = th3;
        }
    }

    private static String RR() {
        if (Build.VERSION.SDK_INT >= 17) {
            return String.format("\"%s --user 0\"", "am startservice -n com.tencent.qqpimsecure/com.tencent.server.back.DaemonService");
        }
        return String.format("\"%s \"", "am startservice -n com.tencent.qqpimsecure/com.tencent.server.back.DaemonService");
    }

    private static String bI(Context context) {
        String guid = ((te) qf.i(te.class)).getGuid();
        String i = ((qz) bir.pC(12)).i(context);
        WifiInfo connectionInfo = ((WifiManager) context.getSystemService("wifi")).getConnectionInfo();
        String str = SQLiteDatabase.KeyEmpty;
        if (connectionInfo != null) {
            str = connectionInfo.getMacAddress();
        }
        com.tencent.qqpimsecure.service.i uM = com.tencent.qqpimsecure.service.i.uM();
        return String.format("http://m.qq.com/wap/survey/index.jsp?value=%s\\&ts=%d", com.tencent.tcuser.util.a.u(TccCryptor.encrypt(context, String.format("bid=971&guid=%s&imei=%s&mac=%s&version=%s&buildno=%s&ua=%s&osversion=%s", guid, i, str, uM.uR(), uM.uN(), Build.MODEL, Build.VERSION.RELEASE).getBytes(), "j*5#L(0f$RGHR(&*fqnOi".getBytes())), Integer.valueOf((int) System.currentTimeMillis()));
    }

    private static String bQ(Context context) {
        if (((meri.service.permissionguide.b) bir.pC(41)).mu(7) != 1) {
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.setData(Uri.parse("http://m.qq.com/wap/survey/index.jsp?value=%s\\&ts=%d"));
            List<ResolveInfo> queryIntentActivities = ((qz) bir.pC(12)).queryIntentActivities(intent, 32);
            if (queryIntentActivities.size() > 0) {
                ResolveInfo resolveInfo = queryIntentActivities.get(0);
                String format = String.format("am start -n %s -a android.intent.action.VIEW -d", resolveInfo.activityInfo.packageName + "/" + resolveInfo.activityInfo.name);
                if (format != null) {
                    String bI = bI(context);
                    if (Build.VERSION.SDK_INT >= 17) {
                        return String.format("\"%s %s %s\"", format, bI, "--user 0");
                    }
                    return String.format("\"%s %s\"", format, bI);
                }
            }
        }
        return "0";
    }

    public static void aK(int i, int i2) {
        if (!sn.CQ()) {
            ArrayList arrayList = new ArrayList();
            arrayList.add(Integer.valueOf(i2));
            a(i, arrayList, null);
        }
    }

    public static void ab(int i, String str) {
        if (!sn.CQ()) {
            ArrayList arrayList = new ArrayList();
            arrayList.add(str);
            a(i, null, arrayList);
        }
    }

    private static void a(final int i, final ArrayList<Integer> arrayList, final ArrayList<String> arrayList2) {
        final int Uj = com.meri.service.feature.a.Uj();
        getHandler().post(new Runnable() {
            @Override
            public void run() {
                FileOutputStream fileOutputStream;
                Throwable th;
                StringBuilder sb = new StringBuilder();
                sb.append(i);
                sb.append("|");
                sb.append(Uj);
                sb.append("|");
                String N = com.meri.service.feature.a.N(arrayList);
                if (TextUtils.isEmpty(N)) {
                    N = "NA";
                }
                sb.append(N);
                sb.append("|");
                String P = com.meri.service.feature.a.P(arrayList2);
                if (TextUtils.isEmpty(P)) {
                    P = "NA";
                }
                sb.append(P);
                sb.append("|");
                FileOutputStream fileOutputStream2 = null;
                try {
                    try {
                        Context agJ = d.agJ();
                        String str = SQLiteDatabase.KeyEmpty + sb.toString() + "\n";
                        FileOutputStream openFileOutput = agJ.openFileOutput("x_rp_dt_j.dat", 32768);
                        try {
                            openFileOutput.write(str.getBytes("UTF-8"));
                            openFileOutput.flush();
                            if (openFileOutput != null) {
                                try {
                                    openFileOutput.close();
                                } catch (Exception e) {
                                }
                            }
                        } catch (Throwable th2) {
                            fileOutputStream = openFileOutput;
                            th = th2;
                            if (fileOutputStream != null) {
                                try {
                                    fileOutputStream.close();
                                    throw th;
                                } catch (Exception e2) {
                                    throw th;
                                }
                            }
                            throw th;
                        }
                    } catch (Throwable th3) {
                        fileOutputStream = null;
                        th = th3;
                    }
                } catch (Exception e3) {
                    if (0 != 0) {
                        try {
                            fileOutputStream2.close();
                        } catch (Exception e4) {
                        }
                    }
                }
            }
        });
    }

    public static void RT() {
        FileInputStream fileInputStream;
        File file;
        BufferedReader bufferedReader;
        Throwable th;
        FileInputStream fileInputStream2;
        File file2;
        int size;
        int i;
        int i2;
        BufferedReader bufferedReader2 = null;
        if (sn.CQ()) {
            return;
        }
        SparseArray sparseArray = new SparseArray();
        try {
            file = new File(d.agJ().getFilesDir().toString() + File.separator + "x_nt_dt.dat");
            try {
                if (file.exists()) {
                    fileInputStream = new FileInputStream(file);
                    try {
                        bufferedReader = new BufferedReader(new InputStreamReader(fileInputStream));
                        while (true) {
                            try {
                                try {
                                    String readLine = bufferedReader.readLine();
                                    if (readLine == null) {
                                        break;
                                    }
                                    String[] split = readLine.split("\\|");
                                    if (split.length == 4) {
                                        try {
                                            i2 = Integer.valueOf(split[0]).intValue();
                                            i = Integer.valueOf(split[1]).intValue();
                                        } catch (Exception e) {
                                            i = 0;
                                            i2 = 0;
                                        }
                                        if (i2 == 261406 && i != 0) {
                                            try {
                                                int intValue = Integer.valueOf(split[2]).intValue();
                                                int qb = com.meri.service.feature.a.qb(i);
                                                SparseIntArray sparseIntArray = (SparseIntArray) sparseArray.get(qb);
                                                SparseIntArray sparseIntArray2 = sparseIntArray == null ? new SparseIntArray() : sparseIntArray;
                                                int i3 = sparseIntArray2.get(intValue);
                                                if (i3 < 0) {
                                                    i3 = 0;
                                                }
                                                sparseIntArray2.put(intValue, i3 + 1);
                                                sparseArray.put(qb, sparseIntArray2);
                                            } catch (Exception e2) {
                                            }
                                        }
                                    }
                                } catch (Exception e3) {
                                    bufferedReader2 = bufferedReader;
                                    fileInputStream2 = fileInputStream;
                                    file2 = file;
                                    if (bufferedReader2 != null) {
                                        try {
                                            bufferedReader2.close();
                                        } catch (Exception e4) {
                                        }
                                    }
                                    if (fileInputStream2 != null) {
                                        try {
                                            fileInputStream2.close();
                                        } catch (Exception e5) {
                                        }
                                    }
                                    if (file2 != null && file2.exists()) {
                                        try {
                                            file2.delete();
                                        } catch (Exception e6) {
                                        }
                                    }
                                    size = sparseArray.size();
                                    if (size <= 0) {
                                    }
                                }
                            } catch (Throwable th2) {
                                th = th2;
                                if (bufferedReader != null) {
                                    try {
                                        bufferedReader.close();
                                    } catch (Exception e7) {
                                    }
                                }
                                if (fileInputStream != null) {
                                    try {
                                        fileInputStream.close();
                                    } catch (Exception e8) {
                                    }
                                }
                                if (file == null) {
                                    throw th;
                                }
                                if (!file.exists()) {
                                    throw th;
                                }
                                try {
                                    file.delete();
                                    throw th;
                                } catch (Exception e9) {
                                    throw th;
                                }
                            }
                        }
                    } catch (Exception e10) {
                        fileInputStream2 = fileInputStream;
                        file2 = file;
                    } catch (Throwable th3) {
                        bufferedReader = null;
                        th = th3;
                    }
                } else {
                    bufferedReader = null;
                    fileInputStream = null;
                }
                if (bufferedReader != null) {
                    try {
                        bufferedReader.close();
                    } catch (Exception e11) {
                    }
                }
                if (fileInputStream != null) {
                    try {
                        fileInputStream.close();
                    } catch (Exception e12) {
                    }
                }
                if (file != null && file.exists()) {
                    try {
                        file.delete();
                    } catch (Exception e13) {
                    }
                }
            } catch (Exception e14) {
                fileInputStream2 = null;
                file2 = file;
            } catch (Throwable th4) {
                fileInputStream = null;
                th = th4;
                bufferedReader = null;
            }
        } catch (Exception e15) {
            fileInputStream2 = null;
            file2 = null;
        } catch (Throwable th5) {
            fileInputStream = null;
            file = null;
            bufferedReader = null;
            th = th5;
        }
        try {
            size = sparseArray.size();
            if (size <= 0) {
                for (int i4 = 0; i4 < size; i4++) {
                    ArrayList arrayList = new ArrayList();
                    int keyAt = sparseArray.keyAt(i4);
                    SparseIntArray sparseIntArray3 = (SparseIntArray) sparseArray.valueAt(i4);
                    int size2 = sparseIntArray3.size();
                    for (int i5 = 0; i5 < size2; i5++) {
                        arrayList.add(SQLiteDatabase.KeyEmpty + sparseIntArray3.keyAt(i5) + ":" + sparseIntArray3.valueAt(i5));
                    }
                    FeatureTunnelDB.b bVar = new FeatureTunnelDB.b();
                    bVar.SS = ba.dBk;
                    bVar.fPx = keyAt;
                    bVar.count = 1;
                    bVar.fPz = com.meri.service.feature.a.P(arrayList);
                    bVar.fPA = 1;
                    bVar.azW = 0;
                    bVar.bir = 1;
                    bVar.w = 1;
                    FeatureTunnelDB.UH().b(bVar);
                }
            }
        } catch (Exception e16) {
        }
    }

    public static void RX() {
        if (!sn.CQ()) {
            getHandler().post(new Runnable() {
                @Override
                public void run() {
                    C0008a.C0009a c0009a = new C0008a.C0009a();
                    c0009a.type = 1;
                    C0008a.a(c0009a, true);
                }
            });
        }
    }

    public static void H(final String str, final Object obj) {
        if (!sn.CQ() && !TextUtils.isEmpty(str) && obj != null) {
            getHandler().post(new Runnable() {
                @Override
                public void run() {
                    StringBuilder sb = new StringBuilder();
                    sb.append(str);
                    sb.append("|");
                    if (obj instanceof Integer) {
                        int intValue = ((Integer) obj).intValue();
                        sb.append("0");
                        sb.append("|");
                        sb.append(intValue);
                    } else if (obj instanceof String) {
                        String str2 = (String) obj;
                        sb.append("1");
                        sb.append("|");
                        sb.append(str2);
                    }
                    C0008a.C0009a c0009a = new C0008a.C0009a();
                    c0009a.type = 2;
                    c0009a.data = sb.toString().getBytes();
                    C0008a.a(c0009a, true);
                }
            });
        }
    }

    static class C0008a {

        public static final class C0009a {
            public byte[] data;
            public int size;
            public int type;

            C0009a() {
            }

            void writeToStream(OutputStream outputStream) throws IOException {
                this.size = this.data != null ? this.data.length : 0;
                byte[] bArr = new byte[8];
                System.arraycopy(com.tencent.tcuser.util.a.er(this.type), 0, bArr, 0, 4);
                System.arraycopy(com.tencent.tcuser.util.a.er(this.size), 0, bArr, 4, 4);
                outputStream.write(bArr);
                if (this.data != null && this.data.length > 0) {
                    outputStream.write(this.data);
                }
                outputStream.flush();
            }
        }

        public static final class b {
            public int cqG;
            public byte[] data;
            public int size;

            b() {
            }

            void p(InputStream inputStream) throws IOException {
                int i = 0;
                byte[] bArr = new byte[8];
                if (inputStream.read(bArr) == 8) {
                    byte[] bArr2 = new byte[4];
                    byte[] bArr3 = new byte[4];
                    System.arraycopy(bArr, 0, bArr2, 0, 4);
                    System.arraycopy(bArr, 4, bArr3, 0, 4);
                    this.cqG = com.tencent.tcuser.util.a.v(bArr2);
                    this.size = com.tencent.tcuser.util.a.v(bArr3);
                    try {
                        if (this.size > 0) {
                            byte[] bArr4 = new byte[this.size];
                            while (true) {
                                int read = inputStream.read(bArr4, i, this.size - i);
                                if (read <= 0) {
                                    break;
                                } else {
                                    i += read;
                                }
                            }
                            if (i == this.size) {
                                this.data = bArr4;
                                return;
                            }
                            return;
                        }
                        this.data = new byte[0];
                    } catch (Error e) {
                    }
                }
            }
        }

        static b a(C0009a c0009a, boolean z) {
            InputStream inputStream;
            InputStream inputStream2;
            OutputStream outputStream;
            b bVar;
            OutputStream outputStream2 = null;
            if (c0009a == null || TextUtils.isEmpty(a.fNT)) {
                return null;
            }
            LocalSocket localSocket = new LocalSocket();
            try {
                localSocket.connect(new LocalSocketAddress(a.fNT));
                localSocket.setSoTimeout(30000);
                try {
                    bVar = new b();
                    inputStream = localSocket.getInputStream();
                    try {
                        OutputStream outputStream3 = localSocket.getOutputStream();
                        try {
                            c0009a.writeToStream(outputStream3);
                            bVar.p(inputStream);
                            if (outputStream3 != null) {
                                try {
                                    outputStream3.close();
                                } catch (Exception e) {
                                }
                            }
                            if (inputStream != null) {
                                try {
                                    inputStream.close();
                                } catch (Exception e2) {
                                }
                            }
                            try {
                                localSocket.close();
                            } catch (Exception e3) {
                            }
                        } catch (Exception e4) {
                            inputStream2 = inputStream;
                            outputStream = outputStream3;
                            if (outputStream != null) {
                                try {
                                    outputStream.close();
                                } catch (Exception e5) {
                                }
                            }
                            if (inputStream2 != null) {
                                try {
                                    inputStream2.close();
                                } catch (Exception e6) {
                                }
                            }
                            try {
                                localSocket.close();
                                bVar = null;
                            } catch (Exception e7) {
                                bVar = null;
                            }
                            return bVar;
                        } catch (Throwable th) {
                            th = th;
                            outputStream2 = outputStream3;
                            if (outputStream2 != null) {
                                try {
                                    outputStream2.close();
                                } catch (Exception e8) {
                                }
                            }
                            if (inputStream != null) {
                                try {
                                    inputStream.close();
                                } catch (Exception e9) {
                                }
                            }
                            try {
                                localSocket.close();
                                throw th;
                            } catch (Exception e10) {
                                throw th;
                            }
                        }
                    } catch (Exception e11) {
                        inputStream2 = inputStream;
                        outputStream = null;
                    } catch (Throwable th2) {
                        th = th2;
                    }
                } catch (Exception e12) {
                    inputStream2 = null;
                    outputStream = null;
                } catch (Throwable th3) {
                    th = th3;
                    inputStream = null;
                }
                return bVar;
            } catch (Exception e13) {
                if (!z || a.SC()) {
                    return null;
                }
                a.RK();
                try {
                    Thread.sleep(200L);
                } catch (Exception e14) {
                }
                return a(c0009a, false);
            }
        }
    }

    private static void RZ() {
        fNW = b.SM();
        getHandler().postDelayed(new Runnable() {
            @Override
            public void run() {
                b.setProcessState(1);
            }
        }, 2000L);
        Sv();
    }

    public static int aL(int i, int i2) {
        if (!((1048575 & i) == 0 ? i > 1048576 : false)) {
            d.bT("InvalidBootReasonException\nmain: " + i + ", sub: " + i2, null);
            return -1;
        }
        if (i2 < 0 || i2 >= 1048576) {
            d.bT("InvalidBootReasonException\nmain: " + i + ", sub: " + i2, null);
            return i + 0;
        }
        return i + i2;
    }

    public static int pJ(int i) {
        return (-1048576) & i;
    }

    private static int Sb() {
        try {
            fLl.readLock().lock();
            return fNX;
        } finally {
            fLl.readLock().unlock();
        }
    }

    private static void pK(int i) {
        try {
            fLl.writeLock().lock();
            fNX = i;
        } finally {
            fLl.writeLock().unlock();
        }
    }

    public static void mk(String str) {
        fNY = str;
    }

    private static String Sc() {
        return fNY;
    }

    public static int i(String str, String str2, String str3) {
        int i;
        try {
            if (!TextUtils.isEmpty(str)) {
                if (!TextUtils.isEmpty(str3)) {
                    try {
                        i = Integer.valueOf(str3).intValue();
                    } catch (Exception e) {
                        i = -1;
                    }
                    if (i > 0 && i <= 999999) {
                        return i;
                    }
                }
                if (str.contains("wechat") || str.contains("com.tencent.mm")) {
                    return 201;
                }
                if (str.contains(rl.b.dcY) || str.contains(d.ah.fbM)) {
                    return 202;
                }
                if (str.contains("yyb") || str.contains("myapp_m") || str.contains(d.ah.fbO)) {
                    return 203;
                }
                if (str.contains(d.ah.fbN)) {
                    return 204;
                }
                if (str.contains("com.meizu.safe")) {
                    return 205;
                }
                if (str.contains("com.mycheering.apps")) {
                    return 206;
                }
            }
        } catch (Exception e2) {
        }
        return 0;
    }

    public static void a(final int i, final int i2, final String str, final int i3, final String str2, final String str3, final boolean z) {
        if (com.tencent.server.base.d.aTi() != 1) {
            getHandler().post(new Runnable() {
                @Override
                public void run() {
                    int i4 = i;
                    int i5 = i2;
                    String str4 = str;
                    String str5 = str2;
                    String str6 = str3;
                    int i6 = i3;
                    boolean z2 = z;
                    Bundle bundle = new Bundle();
                    bundle.putInt("flag", 2);
                    bundle.putInt(meri.pluginsdk.d.ewm, i4);
                    bundle.putString(meri.pluginsdk.d.ewn, str4);
                    bundle.putString(meri.pluginsdk.d.ewo, str5);
                    bundle.putString(meri.pluginsdk.d.ewp, str6);
                    bundle.putBoolean(meri.pluginsdk.d.ewq, z2);
                    bundle.putInt(meri.pluginsdk.d.eBh, i6);
                    bundle.putInt(meri.pluginsdk.d.eBi, i5);
                    com.tencent.server.fore.d.aUW().v(8219, bundle);
                }
            });
            return;
        }
        int Sb = Sb();
        long currentTimeMillis = System.currentTimeMillis() - QQSecureApplication.bbZ;
        if (Sb > 0 && ((i != 7340032 || z) && (currentTimeMillis > 3000 || pJ(Sb) == 3145728 || (i != 3145728 && i != 7340032)))) {
            if (i == 3145728 || i == 6291456 || i == 7340032 || i == 8388608 || i == 9437184 || i == 10485760) {
                getHandler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            HashMap a = a.a(i, i2, str, i3, str2, str3);
                            if (a != null && a.size() > 0) {
                                Iterator it = a.keySet().iterator();
                                if (it.hasNext()) {
                                    Integer num = (Integer) it.next();
                                    int intValue = num.intValue();
                                    int intValue2 = ((Integer) a.get(num)).intValue();
                                    a.l(intValue, intValue2, z);
                                    if (!a.pL(intValue)) {
                                        a.a(intValue, a.aL(intValue, intValue2), 0, QQSecureApplication.bbZ, QQSecureApplication.mSystemElapsedTimeWhenBoot, 2);
                                    }
                                }
                            }
                        } catch (Exception e) {
                        }
                    }
                }, 20000L);
                return;
            }
            return;
        }
        getHandler().postDelayed(new Runnable() {
            @Override
            public void run() {
                HashMap a = a.a(i, i2, str, i3, str2, str3);
                if (a != null && a.size() > 0) {
                    Iterator it = a.keySet().iterator();
                    if (it.hasNext()) {
                        Integer num = (Integer) it.next();
                        a.l(num.intValue(), ((Integer) a.get(num)).intValue(), z);
                        a.mk(SQLiteDatabase.KeyEmpty + (TextUtils.isEmpty(str) ? "NA" : str) + ";" + i3 + ";" + (TextUtils.isEmpty(str2) ? "NA" : str2) + ";" + (TextUtils.isEmpty(str3) ? "NA" : str3));
                    }
                }
            }
        }, z ? 1000 : 1);
    }

    public static HashMap<Integer, Integer> a(int i, int i2, String str, int i3, String str2, String str3) {
        int i4 = 3;
        HashMap<Integer, Integer> hashMap = new HashMap<>(1);
        switch (i) {
            case WtloginHelper.SigType.WLOGIN_LHSIG:
                if (!"android.net.wifi.WIFI_STATE_CHANGED".equals(str) && !"android.net.wifi.STATE_CHANGE".equals(str)) {
                    if (!"android.bluetooth.adapter.action.STATE_CHANGED".equals(str)) {
                        if (!"android.net.conn.CONNECTIVITY_CHANGE".equals(str) && !"android.intent.action.ANY_DATA_STATE".equals(str)) {
                            if (!"android.intent.action.USER_PRESENT".equals(str)) {
                                if (auv.g.d.SMS_RECEIVED_ACTION.equals(str) || "android.provider.Telephony.GSM_SMS_RECEIVED".equals(str)) {
                                    i4 = 6;
                                    break;
                                } else if ("android.intent.action.TIME_SET".equals(str) || "android.intent.action.DATE_CHANGED".equals(str)) {
                                    i4 = 8;
                                    break;
                                } else {
                                    if ("android.intent.action.MEDIA_UNMOUNTED".equals(str) || "android.intent.action.MEDIA_REMOVED".equals(str) || "android.intent.action.MEDIA_CHECKING".equals(str) || "android.intent.action.MEDIA_EJECT".equals(str)) {
                                        i4 = 7;
                                        break;
                                    }
                                    i4 = 0;
                                    break;
                                }
                            } else {
                                i4 = 5;
                                break;
                            }
                        } else {
                            i4 = 4;
                            break;
                        }
                    }
                } else {
                    i4 = 2;
                    break;
                }
                break;
            case 6291456:
                i4 = i(str, str2, str3);
                break;
            case 7340032:
                if ("shortcut".equals(str)) {
                    i4 = i(str, str2, str3);
                    if (i4 != 0) {
                        i = 3145728;
                        break;
                    } else {
                        i4 = 2;
                        i = 3145728;
                        break;
                    }
                } else if (!"sysmms".equals(str)) {
                    if (!"reboot".equals(str)) {
                        if (!"wifiset".equals(str)) {
                            if ("daemon".equals(str)) {
                                i = 10485760;
                            } else if (str != null && i3 == 65537) {
                                i = 10485760;
                            }
                            i4 = i(str, str2, str3);
                            break;
                        } else {
                            i4 = 5;
                            i = 3145728;
                            break;
                        }
                    } else {
                        i4 = 4;
                        i = 3145728;
                        break;
                    }
                } else {
                    i = 3145728;
                    break;
                }
                break;
            default:
                i4 = 0;
                break;
        }
        if (i2 <= 0) {
            i2 = i4;
        }
        hashMap.put(Integer.valueOf(i), Integer.valueOf(i2));
        return hashMap;
    }

    public static void k(final int i, final int i2, final boolean z) {
        if (com.tencent.server.base.d.aTi() != 1) {
            getHandler().post(new Runnable() {
                @Override
                public void run() {
                    Bundle bundle = new Bundle();
                    bundle.putInt("flag", 1);
                    bundle.putInt(meri.pluginsdk.d.ewm, i);
                    bundle.putInt(meri.pluginsdk.d.ewn, i2);
                    com.tencent.server.fore.d.aUW().v(8219, bundle);
                }
            });
            return;
        }
        int Sb = Sb();
        long currentTimeMillis = System.currentTimeMillis() - QQSecureApplication.bbZ;
        if (Sb > 0 && ((i != 7340032 || z) && (currentTimeMillis > 3000 || pJ(Sb) == 3145728 || (i != 3145728 && i != 7340032)))) {
            if (i == 3145728 || i == 6291456 || i == 7340032 || i == 8388608 || i == 9437184 || i == 10485760) {
                getHandler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            int i3 = i;
                            int i4 = i2;
                            if (!a.pL(i3)) {
                                a.a(i3, a.aL(i3, i4), 0, QQSecureApplication.bbZ, QQSecureApplication.mSystemElapsedTimeWhenBoot, 2);
                            }
                        } catch (Exception e) {
                        }
                    }
                }, 20000L);
                return;
            }
            return;
        }
        getHandler().postDelayed(new Runnable() {
            @Override
            public void run() {
                a.l(i, i2, z);
            }
        }, z ? 1000 : 1);
    }

    public static boolean pL(int i) {
        return false;
    }

    public static void l(int i, int i2, boolean z) {
        int Sb = Sb();
        long currentTimeMillis = System.currentTimeMillis() - QQSecureApplication.bbZ;
        if (Sb > 0 && ((i != 7340032 && i != 10485760) || z)) {
            if (currentTimeMillis > 3000 || pJ(Sb) == 3145728) {
                return;
            }
            if (i != 3145728 && i != 7340032) {
                return;
            }
        }
        long j = QQSecureApplication.mSystemElapsedTimeWhenBoot;
        if (i == 4194304 && j < rf.cNk) {
            i = 5242880;
        }
        int aL = aL(i, i2);
        pK(aL);
        b.pR(aL);
        bja.TE().pT(i2);
    }

    public static int Sf() {
        if (!fNZ) {
            return -1;
        }
        int Sb = Sb();
        if (Sb <= 0) {
            int SW = b.SW();
            pK(SW);
            return SW;
        }
        return Sb;
    }

    public static boolean Sn() {
        return Sb() < 0;
    }

    public static boolean Su() {
        int pJ = pJ(Sb());
        if (3145728 == pJ || 5242880 == pJ) {
            return true;
        }
        return false;
    }

    private static void Sv() {
        getHandler().postDelayed(new Runnable() {
            @Override
            public void run() {
                String[] split;
                ahk xs;
                aav kM;
                boolean unused = a.fNZ = true;
                int Sf = a.Sf();
                int pJ = a.pJ(Sf);
                int i = a.fNW;
                if (i <= 0) {
                    if (b.SL()) {
                        i = 2;
                    } else {
                        i = 999;
                        b.bJ(true);
                    }
                }
                if (i == 1) {
                    i = 3;
                }
                int i2 = 0;
                long SX = b.SX();
                if (Build.VERSION.SDK_INT < 23) {
                    long SJ = a.SJ();
                    if (SJ != SX) {
                        b.aL(SJ);
                        if (SX > 0) {
                            i2 = 1;
                        }
                    }
                } else {
                    long currentTimeMillis = System.currentTimeMillis() - SystemClock.elapsedRealtime();
                    if (Math.abs(currentTimeMillis - SX) > d.ag.eOv) {
                        b.aL(currentTimeMillis);
                        if (SX > 0) {
                            i2 = 1;
                        }
                    }
                }
                a.a(pJ, Sf, i, QQSecureApplication.bbZ, QQSecureApplication.mSystemElapsedTimeWhenBoot, i2);
                if (i2 > 0) {
                    ArrayList arrayList = new ArrayList();
                    arrayList.add(SQLiteDatabase.KeyEmpty + pJ);
                    arrayList.add(SQLiteDatabase.KeyEmpty + Sf);
                    arrayList.add(SQLiteDatabase.KeyEmpty + i);
                    arrayList.add(SQLiteDatabase.KeyEmpty + QQSecureApplication.bbZ);
                    arrayList.add(SQLiteDatabase.KeyEmpty + QQSecureApplication.mSystemElapsedTimeWhenBoot);
                    arrayList.add(SQLiteDatabase.KeyEmpty + i2);
                    yz.b(bim.QJ().kH(), ba.eBE, arrayList, 22);
                    long j = QQSecureApplication.mSystemElapsedTimeWhenBoot;
                    if (j >= 0 && j <= rf.cNk) {
                        h.mu().bn(true);
                        if ((1048575 & pJ) == 0) {
                            h.mu().la((pJ >> 20) & 4095);
                        } else {
                            h.mu().la(4095);
                        }
                        if (h.mu().IN() > 0) {
                            h.mu().T(5, 5);
                            ahk xs2 = ahk.xs();
                            aav kM2 = xs2.kM(vv.a.b.eSO);
                            if (kM2 != null && kM2.cui != null) {
                                xs2.d(vv.a.b.eSO, 1, h.mu().dY(4), 0, kM2.cui.awC);
                            }
                        }
                    } else {
                        h.mu().bn(false);
                        h.mu().la(0);
                        h.mu().aC(0L);
                        h.mu().aB(0L);
                        if (h.mu().IN() > 0 && (kM = (xs = ahk.xs()).kM(vv.a.b.eSO)) != null && kM.cui != null) {
                            xs.d(vv.a.b.eSO, 0, h.mu().dY(4), 0, kM.cui.awC);
                        }
                    }
                }
                int i3 = 0;
                switch (i) {
                    case 1:
                    case 3:
                        i3 = ba.dan;
                        break;
                    case 2:
                        i3 = ba.dam;
                        break;
                    case 4:
                        i3 = ba.dao;
                        break;
                    case 5:
                        i3 = ba.dap;
                        break;
                    case 7:
                        i3 = ba.afw;
                        yz.a(bim.QJ().kH(), ba.dAD, 1, 1);
                        break;
                    case 8:
                        i3 = ba.afw;
                        yz.a(bim.QJ().kH(), ba.dAE, 1, 1);
                        if (p.aTC().getBoolean("ac", false)) {
                            String SY = b.SY();
                            if (!TextUtils.isEmpty(SY)) {
                                com.tencent.server.base.d.bT("InvisbleAnrException\n" + SY, null);
                                b.mp(SQLiteDatabase.KeyEmpty);
                                break;
                            }
                        }
                        break;
                }
                if (i3 > 0) {
                    yz.a(bim.QJ().kH(), i3, 1, 1);
                }
                int SN = b.SN();
                if (SN > 0) {
                    b.pP(0);
                    yz.a(bim.QJ().kH(), ba.afx, SN, 1);
                }
                if (pJ == 7340032) {
                    try {
                        ArrayList arrayList2 = new ArrayList();
                        arrayList2.add("OutJump");
                        String SK = a.SK();
                        if (SK != null && (split = SK.split(";")) != null && split.length > 0) {
                            for (String str : split) {
                                arrayList2.add(str);
                            }
                        }
                        arrayList2.add(SQLiteDatabase.KeyEmpty + QQSecureApplication.bbZ);
                        yz.b(bim.QJ().kH(), ba.bfO, arrayList2, 22);
                    } catch (Exception e) {
                    }
                }
            }
        }, 10000L);
    }

    public static void a(int i, int i2, int i3, long j, long j2, int i4) {
        ArrayList arrayList = new ArrayList();
        arrayList.add(SQLiteDatabase.KeyEmpty + i);
        arrayList.add(SQLiteDatabase.KeyEmpty + i2);
        arrayList.add(SQLiteDatabase.KeyEmpty + i3);
        arrayList.add(SQLiteDatabase.KeyEmpty + j);
        arrayList.add(SQLiteDatabase.KeyEmpty + j2);
        arrayList.add(SQLiteDatabase.KeyEmpty + i4);
        yz.b(bim.QJ().kH(), ba.cjQ, arrayList, 22);
    }

    public static long pM(int i) {
        BufferedReader bufferedReader;
        long j = 0;
        BufferedReader bufferedReader2 = null;
        try {
            bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("/proc/" + i + "/stat")), 1000);
        } catch (Exception e) {
            bufferedReader = null;
        } catch (Throwable th) {
            th = th;
        }
        try {
            String readLine = bufferedReader.readLine();
            bufferedReader.close();
            if (readLine != null && readLine.length() > 0) {
                j = Long.parseLong(readLine.split(" ")[21]);
            }
            if (bufferedReader != null) {
                try {
                    bufferedReader.close();
                } catch (IOException e2) {
                }
            }
        } catch (Exception e3) {
            if (bufferedReader != null) {
                try {
                    bufferedReader.close();
                } catch (IOException e4) {
                }
            }
            return j;
        } catch (Throwable th2) {
            th = th2;
            bufferedReader2 = bufferedReader;
            if (bufferedReader2 != null) {
                try {
                    bufferedReader2.close();
                } catch (IOException e5) {
                }
            }
            throw th;
        }
        return j;
    }

    private static long Sw() {
        long j;
        int i;
        if (sn.CQ()) {
            return 0L;
        }
        try {
            ArrayList arrayList = new ArrayList();
            arrayList.add("system_server");
            List<Encode.ProcessInfo> aE = Encode.aE(arrayList);
            int i2 = 0;
            while (true) {
                int i3 = i2;
                if (i3 >= aE.size()) {
                    i = -1;
                    break;
                }
                if (!"system_server".equalsIgnoreCase(aE.get(i3).name)) {
                    i2 = i3 + 1;
                } else {
                    i = aE.get(i3).pid;
                    break;
                }
            }
            j = pM(i) + i;
        } catch (Throwable th) {
            j = 0;
        }
        return j;
    }

    public static void Sx() {
        if (Build.VERSION.SDK_INT >= 21) {
            try {
                Context agJ = com.tencent.server.base.d.agJ();
                JobScheduler jobScheduler = (JobScheduler) agJ.getSystemService("jobscheduler");
                JobInfo.Builder builder = new JobInfo.Builder(1, new ComponentName(agJ.getPackageName(), JobSchedulerService.class.getName()));
                builder.setPeriodic(7200000L);
                builder.setPersisted(true);
                jobScheduler.schedule(builder.build());
            } catch (Exception e) {
            }
        }
    }

    public static int Sy() {
        return fNW;
    }

    public static void Sz() {
        try {
            boolean z = p.aTC().getBoolean("ap", true);
            Context agJ = com.tencent.server.base.d.agJ();
            AccountManager accountManager = AccountManager.get(agJ);
            Account[] accountsByType = accountManager.getAccountsByType("com.tencent.qqpimsecure");
            if (accountsByType == null || accountsByType.length <= 0) {
                if (z) {
                    Account account = new Account(agJ.getString(bql.i.gzQ), "com.tencent.qqpimsecure");
                    w.nI().vK();
                    if (accountManager.addAccountExplicitly(account, null, null)) {
                        ContentResolver.setIsSyncable(account, "com.tencent.qqpimsecure.SyncProvider", 1);
                        ContentResolver.setSyncAutomatically(account, "com.tencent.qqpimsecure.SyncProvider", true);
                    }
                    if (Build.VERSION.SDK_INT >= 8) {
                        ContentResolver.addPeriodicSync(account, "com.tencent.qqpimsecure.SyncProvider", new Bundle(), 18000L);
                        return;
                    }
                    return;
                }
                return;
            }
            if (!z && Build.VERSION.SDK_INT >= 22) {
                accountManager.removeAccountExplicitly(accountsByType[0]);
            }
        } catch (Throwable th) {
            com.tencent.server.base.d.l(th);
        }
    }
}