手机管家 v6.0.0版本的 MD5 值为:bf0bca2cb03f766137fe9ecf7383a634

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


package com.meri.util;

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.Process;
import android.text.TextUtils;
import android.util.SparseArray;
import android.util.SparseIntArray;
import com.meri.service.FeatureTunnelDB;
import com.meri.service.s;
import com.tencent.kingkong.database.SQLiteDatabase;
import com.tencent.mm.sdk.modelmsg.WXMediaMessage;
import com.tencent.qqpimsecure.model.w;
import com.tencent.server.base.QQSecureApplication;
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.Iterator;
import java.util.List;
import meri.pluginsdk.d;
import tcs.aaz;
import tcs.abn;
import tcs.ahi;
import tcs.ahy;
import tcs.aic;
import tcs.aif;
import tcs.ajy;
import tcs.ake;
import tcs.anr;
import tcs.azv;
import tcs.ba;
import tcs.ber;
import tcs.ke;
import tcs.lo;
import tcs.qf;
import tcs.te;
import tcs.tv;
import tcs.ub;
import tcs.uc;
import tcs.uf;
import tcs.yz;
import tmsdk.common.TMSDKContext;
import tmsdk.common.tcc.TccCryptor;

public class g {
    static int eJF = 3;
    private static String eKb = null;
    static volatile long eKc = -1;
    static volatile long bSu = -1;
    private static int eKd = -1;
    private static String eKe = null;
    private static volatile boolean eKf = false;

    static boolean BE() {
        return EA();
    }

    static boolean EP() {
        return Ey();
    }

    public static void vr() {
        EC();
        n(false, false);
        EE();
    }

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

    public static synchronized void n(final boolean z, final boolean z2) {
        synchronized (g.class) {
            com.tencent.server.base.b.aKp().post(new Runnable() {
                @Override
                public void run() {
                    g.EF();
                    if (!z && g.BE()) {
                        com.tencent.server.base.b.aKp().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                g.n(true, z2);
                            }
                        }, aaz.cCG);
                        return;
                    }
                    if (g.EP()) {
                        g.Ev();
                        if (g.eKc <= 0) {
                            ahi.b bVar = new ahi.b() {
                                @Override
                                public void a(int i, Intent intent) {
                                    g.Ew();
                                }
                            };
                            ahi ahiVar = (ahi) s.kD(8);
                            ahiVar.a(1026, bVar);
                            ahiVar.a(1013, bVar);
                            ahiVar.a(1031, bVar);
                            ahiVar.a(1054, bVar);
                            ahiVar.a(1015, bVar);
                        }
                        boolean BE = g.BE();
                        if (BE) {
                            g.eKc = System.currentTimeMillis();
                        }
                        if (z2) {
                            if (BE) {
                                yz.a(ber.nV().kH(), ba.dBi, "1", 4);
                                return;
                            } else {
                                yz.a(ber.nV().kH(), ba.dBi, "0", 4);
                                return;
                            }
                        }
                        return;
                    }
                    if (g.eJF > 0) {
                        g.eJF--;
                        com.tencent.server.base.b.NB().postDelayed(new Runnable() {
                            @Override
                            public void run() {
                                g.n(false, z2);
                            }
                        }, 2000L);
                    }
                }
            });
        }
    }

    public static void Ev() {
        OutputStream outputStream;
        String a2 = tmsdk.common.internal.utils.i.a(com.tencent.server.base.b.agJ(), Es(), (String) null);
        ProcessBuilder processBuilder = new ProcessBuilder(new String[0]);
        processBuilder.command("sh");
        OutputStream outputStream2 = null;
        try {
            try {
                String packageName = com.tencent.server.base.b.agJ().getPackageName();
                if (TextUtils.isEmpty(packageName)) {
                    packageName = "com.tencent.qqpimsecure";
                }
                if (!"com.tencent.qqpimsecure".equalsIgnoreCase(packageName)) {
                    com.tencent.server.base.b.k(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(com.tencent.server.base.b.agJ()));
                String eu4 = uf.eu(ajy.k(com.tencent.server.base.b.agJ()));
                String eu5 = uf.eu(TMSDKContext.getStrFromEnvMap(TMSDKContext.CON_CHANNEL));
                String eu6 = uf.eu(ub.X(com.tencent.server.base.b.agJ()));
                int intFromEnvMap = TMSDKContext.getIntFromEnvMap(TMSDKContext.CON_SUB_PLATFORM);
                int i = tv.W(com.tencent.server.base.b.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 ln = ((ahy) s.kD(11)).ln();
                int myUid = Process.myUid();
                int i2 = ake.cOE ? 0 : 1;
                int i3 = ake.cOy ? 1 : 0;
                eKb = packageName + "_xdm_" + myUid;
                String str = TMSDKContext.getApplicaionContext().getPackageName() + "_" + TMSDKContext.getStrFromEnvMap(TMSDKContext.CON_ATHENA_NAME) + "_" + myUid;
                String cD = cD(com.tencent.server.base.b.agJ());
                String EM = EM();
                int bo = com.tencent.qqpimsecure.dao.k.bo();
                String fz = w.nI().fz();
                if (TextUtils.isEmpty(fz)) {
                    fz = w.nI().fA();
                }
                if (TextUtils.isEmpty(fz)) {
                    fz = ((aic) s.kD(5)).getGuid();
                }
                Object[] objArr = new Object[25];
                objArr[0] = a2;
                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(ln);
                objArr[7] = eu5;
                objArr[8] = !TextUtils.isEmpty(fz) ? fz : "0";
                objArr[9] = !TextUtils.isEmpty(eu6) ? eu6 : "0";
                objArr[10] = Integer.valueOf(myUid);
                objArr[11] = eKb;
                objArr[12] = str;
                objArr[13] = cD;
                objArr[14] = EM;
                objArr[15] = Integer.valueOf(bo);
                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;
                String format = String.format("chmod 755 %s\n%s\nexit\n", a2, 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);
                OutputStream outputStream3 = processBuilder.start().getOutputStream();
                try {
                    outputStream3.write(format.getBytes());
                    outputStream3.flush();
                    if (TextUtils.isEmpty(fz)) {
                        ((lo) s.kD(5)).c(new azv() {
                            @Override
                            public void E(int i4, String str2) {
                                if (i4 == 0) {
                                    g.v(abn.dQx, str2);
                                }
                            }
                        });
                    }
                    if (outputStream3 != null) {
                        try {
                            outputStream3.close();
                        } catch (Exception e) {
                        }
                    }
                } catch (Exception e2) {
                    outputStream = outputStream3;
                    if (outputStream != null) {
                        try {
                            outputStream.close();
                        } catch (Exception e3) {
                        }
                    }
                }
            } catch (Throwable th) {
                if (0 != 0) {
                    try {
                        outputStream2.close();
                    } catch (Exception e4) {
                    }
                }
                throw th;
            }
        } catch (Exception e5) {
            outputStream = null;
        }
    }

    public static void Ew() {
        com.tencent.server.base.b.aKp().postDelayed(new Runnable() {
            @Override
            public void run() {
                int i;
                if (g.eKc > 0) {
                    if (com.tencent.server.base.b.kL()) {
                        i = 60000;
                    } else {
                        i = 300000;
                    }
                    long currentTimeMillis = System.currentTimeMillis();
                    if (g.bSu <= 0 || Math.abs(currentTimeMillis - g.bSu) >= i) {
                        g.bSu = currentTimeMillis;
                        if (!g.BE()) {
                            g.n(true, true);
                        } else {
                            yz.c(ber.nV().kH(), ba.dAS, 2);
                        }
                    }
                }
            }
        }, anr.dZK);
    }

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

    private static ArrayList<Integer> Ez() {
        String[] split;
        int i;
        String[] split2;
        String[] split3;
        String[] split4;
        String[] split5;
        ArrayList<Integer> arrayList = new ArrayList<>();
        try {
            String c = c(new String[]{"pgrep", Es()}, null);
            if (TextUtils.isEmpty(c)) {
                c = c(new String[]{"pidof", Es()}, 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 " + Es()}, null);
                if (TextUtils.isEmpty(c2)) {
                    c2 = c(new String[]{NetworkMgrConst.key_province_str, Es()}, null);
                }
                if (!TextUtils.isEmpty(c2) && c2.indexOf(Es()) >= 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 EA() {
        String c = c(new String[]{"sh", "-c", "ps | grep " + Es()}, null);
        if (c == null || c.length() == 0) {
            c = c(new String[]{NetworkMgrConst.key_province_str, Es()}, null);
        }
        return c != null && c.indexOf(Es()) >= 0 && c.indexOf("com.tencent.qqpimsecure") >= 0;
    }

    public static boolean kN(int i) {
        boolean z;
        boolean z2;
        long currentTimeMillis = System.currentTimeMillis();
        long cD = com.tencent.qqpimsecure.dao.k.cD();
        if (i == 1) {
            if (currentTimeMillis > cD && currentTimeMillis - cD < 30000) {
                z = false;
                if (z) {
                    long afa = com.tencent.qqpimsecure.dao.k.afa();
                    if (i == 1) {
                        com.tencent.qqpimsecure.dao.k.cH(currentTimeMillis);
                    }
                    int afE = com.tencent.qqpimsecure.dao.k.afE();
                    if (afE < 0) {
                        afE = 0;
                    }
                    if (i == 1) {
                        if (!tmsdk.common.internal.utils.f.f(afa, currentTimeMillis)) {
                            afE = 0;
                        }
                        afE++;
                        com.tencent.qqpimsecure.dao.k.gc(afE);
                    }
                    int i2 = afE;
                    long j = -1;
                    if (currentTimeMillis >= 0 && afa >= 0) {
                        j = currentTimeMillis - afa;
                    }
                    if (j > 0) {
                        if (i2 <= 10 || i2 > 20) {
                            if (i2 <= 20 || i2 > 50) {
                                if (i2 > 50 && j < 300000) {
                                    z2 = false;
                                    if (i == 1 && i2 > 10 && z2) {
                                        com.tencent.qqpimsecure.dao.k.gc(0);
                                    }
                                }
                                z2 = z;
                                if (i == 1) {
                                    com.tencent.qqpimsecure.dao.k.gc(0);
                                }
                            } else {
                                if (j < 30000) {
                                    z2 = false;
                                    if (i == 1) {
                                    }
                                }
                                z2 = z;
                                if (i == 1) {
                                }
                            }
                        } else {
                            if (j < 20000) {
                                z2 = false;
                                if (i == 1) {
                                }
                            }
                            z2 = z;
                            if (i == 1) {
                            }
                        }
                        if (!z2) {
                            if (i == 0) {
                                i.hg(d.c.cDx);
                                i.hg("com.tencent.qqpimsecure");
                                i.hg("com.tencent.qqpimsecure:fore");
                            } else if (i == 1) {
                                i.hg(d.c.cDx);
                                i.hg("com.tencent.qqpimsecure:fore");
                                i.hg("com.tencent.qqpimsecure");
                            }
                            i.killProcess(Process.myPid());
                        }
                        return z2;
                    }
                }
                z2 = z;
                if (!z2) {
                }
                return z2;
            }
        } else if (i == 0) {
            com.tencent.qqpimsecure.dao.k.X(0L);
        }
        z = true;
        if (z) {
        }
        z2 = z;
        if (!z2) {
        }
        return z2;
    }

    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();
    }

    private static void EC() {
        eKd = com.tencent.qqpimsecure.dao.k.rw();
        com.tencent.server.base.b.NB().postDelayed(new Runnable() {
            @Override
            public void run() {
                com.tencent.qqpimsecure.dao.k.gv(1);
            }
        }, 2000L);
        com.tencent.server.base.b.aKp().postDelayed(new Runnable() {
            @Override
            public void run() {
                int i = ba.afw;
                int i2 = g.eKd;
                if (i2 <= 0) {
                    if (com.tencent.qqpimsecure.dao.k.rs()) {
                        i2 = 2;
                    } else {
                        i2 = 5;
                        com.tencent.qqpimsecure.dao.k.aw(true);
                    }
                }
                switch (i2) {
                    case 1:
                    case 3:
                        i = ba.dan;
                        break;
                    case 2:
                        i = ba.dam;
                        break;
                    case 4:
                        i = ba.dao;
                        break;
                    case 5:
                        i = ba.dap;
                        break;
                    case 6:
                    default:
                        i = 0;
                        break;
                    case 7:
                        yz.a(ber.nV().kH(), ba.dAD, 1, 1);
                        break;
                    case 8:
                        yz.a(ber.nV().kH(), ba.dAE, 1, 1);
                        break;
                }
                if (i > 0) {
                    yz.a(ber.nV().kH(), i, 1, 1);
                }
                int ry = com.tencent.qqpimsecure.dao.k.ry();
                if (ry > 0) {
                    com.tencent.qqpimsecure.dao.k.hd(0);
                    yz.a(ber.nV().kH(), ba.afx, ry, 1);
                }
            }
        }, 10000L);
    }

    public static void kO(int i) {
        FileOutputStream fileOutputStream;
        Throwable th;
        FileOutputStream fileOutputStream2 = null;
        try {
            String str = com.tencent.server.base.b.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 boolean ED() {
        return d.y.ehK.equalsIgnoreCase(eKe) || "AutoBoot".equalsIgnoreCase(eKe);
    }

    public static void p(final String str, boolean z) {
        if (!eKf && !TextUtils.isEmpty(str)) {
            long j = 1;
            if (z) {
                j = anr.dZK;
            }
            com.tencent.server.base.b.aKp().postDelayed(new Runnable() {
                @Override
                public void run() {
                    if (!g.eKf && TextUtils.isEmpty(g.eKe)) {
                        String unused = g.eKe = str;
                    }
                }
            }, j);
        }
    }

    private static void EE() {
        com.tencent.server.base.b.aKp().postDelayed(new Runnable() {
            @Override
            public void run() {
                if (TextUtils.isEmpty(g.eKe)) {
                    String unused = g.eKe = d.y.ehJ;
                }
                try {
                    String[] split = g.eKe.split(";");
                    if (split != null && split.length > 0) {
                        ArrayList arrayList = new ArrayList();
                        for (String str : split) {
                            arrayList.add(str);
                        }
                        arrayList.add(SQLiteDatabase.KeyEmpty + QQSecureApplication.startTime);
                        yz.b(ber.nV().kH(), ba.bfO, arrayList, 22);
                    }
                } catch (Exception e) {
                }
                boolean unused2 = g.eKf = true;
            }
        }, 20000L);
    }

    public static void EF() {
        if (!new File(com.tencent.server.base.b.agJ().getFilesDir().toString() + File.separator + "x_rb_j_al_ct.dat").exists()) {
            kP(1);
        }
    }

    public static void kP(int i) {
        FileOutputStream fileOutputStream;
        Throwable th;
        FileOutputStream fileOutputStream2 = null;
        try {
            String str = com.tencent.server.base.b.agJ().getFilesDir().toString() + File.separator + "x_rb_j_al_ct.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 EM() {
        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 cC(Context context) {
        String guid = ((te) qf.i(te.class)).getGuid();
        String i = ((aif) s.kD(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", tmsdk.common.internal.utils.e.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 cD(Context context) {
        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 = ((aif) s.kD(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 cC = cC(context);
                if (Build.VERSION.SDK_INT >= 17) {
                    return String.format("\"%s %s %s\"", format, cC, "--user 0");
                }
                return String.format("\"%s %s\"", format, cC);
            }
        }
        return "0";
    }

    public static void l(int i, String str) {
        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 AH = com.meri.service.e.AH();
        com.tencent.server.base.b.aKp().post(new Runnable() {
            @Override
            public void run() {
                FileOutputStream fileOutputStream;
                Throwable th;
                StringBuilder sb = new StringBuilder();
                sb.append(i);
                sb.append("|");
                sb.append(AH);
                sb.append("|");
                String D = com.meri.service.e.D(arrayList);
                if (TextUtils.isEmpty(D)) {
                    D = "NA";
                }
                sb.append(D);
                sb.append("|");
                String P = com.meri.service.e.P(arrayList2);
                if (TextUtils.isEmpty(P)) {
                    P = "NA";
                }
                sb.append(P);
                sb.append("|");
                FileOutputStream fileOutputStream2 = null;
                try {
                    try {
                        Context agJ = com.tencent.server.base.b.agJ();
                        String str = SQLiteDatabase.KeyEmpty + sb.toString() + "\n";
                        FileOutputStream openFileOutput = agJ.openFileOutput("x_rp_dt.dat", WXMediaMessage.THUMB_LENGTH_LIMIT);
                        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 EN() {
        FileInputStream fileInputStream;
        Throwable th;
        BufferedReader bufferedReader;
        FileInputStream fileInputStream2;
        int size;
        int i;
        int i2;
        BufferedReader bufferedReader2 = null;
        File file = new File(com.tencent.server.base.b.agJ().getFilesDir().toString() + File.separator + "x_nt_dt.dat");
        SparseArray sparseArray = new SparseArray();
        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 kk = com.meri.service.e.kk(i);
                                            SparseIntArray sparseIntArray = (SparseIntArray) sparseArray.get(kk);
                                            SparseIntArray sparseIntArray2 = sparseIntArray == null ? new SparseIntArray() : sparseIntArray;
                                            int i3 = sparseIntArray2.get(intValue);
                                            if (i3 < 0) {
                                                i3 = 0;
                                            }
                                            sparseIntArray2.put(intValue, i3 + 1);
                                            sparseArray.put(kk, sparseIntArray2);
                                        } catch (Exception e2) {
                                        }
                                    }
                                }
                            } catch (Exception e3) {
                                bufferedReader2 = bufferedReader;
                                fileInputStream2 = fileInputStream;
                                if (bufferedReader2 != null) {
                                    try {
                                        bufferedReader2.close();
                                    } catch (Exception e4) {
                                    }
                                }
                                if (fileInputStream2 != null) {
                                    try {
                                        fileInputStream2.close();
                                    } catch (Exception e5) {
                                    }
                                }
                                if (file.exists()) {
                                    try {
                                        file.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.exists()) {
                                throw th;
                            }
                            try {
                                file.delete();
                                throw th;
                            } catch (Exception e9) {
                                throw th;
                            }
                        }
                    }
                } catch (Exception e10) {
                    fileInputStream2 = fileInputStream;
                } 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.exists()) {
                try {
                    file.delete();
                } catch (Exception e13) {
                }
            }
        } catch (Exception e14) {
            fileInputStream2 = null;
        } catch (Throwable th4) {
            fileInputStream = null;
            th = th4;
            bufferedReader = null;
        }
        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.eFZ = keyAt;
                    bVar.count = 1;
                    bVar.eGb = com.meri.service.e.P(arrayList);
                    bVar.eGc = 1;
                    bVar.azW = 0;
                    FeatureTunnelDB.AT().b(bVar);
                }
            }
        } catch (Exception e15) {
        }
    }

    public static void EO() {
        com.tencent.server.base.b.aKp().post(new Runnable() {
            @Override
            public void run() {
                a.C0002a c0002a = new a.C0002a();
                c0002a.type = 1;
                a.a(c0002a, true);
            }
        });
    }

    public static void v(final String str, final Object obj) {
        if (!TextUtils.isEmpty(str) && obj != null) {
            com.tencent.server.base.b.aKp().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);
                    }
                    a.C0002a c0002a = new a.C0002a();
                    c0002a.type = 2;
                    c0002a.data = sb.toString().getBytes();
                    a.a(c0002a, true);
                }
            });
        }
    }

    static class a {

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

            C0002a() {
            }

            void writeToStream(OutputStream outputStream) throws IOException {
                this.size = this.data != null ? this.data.length : 0;
                byte[] bArr = new byte[8];
                System.arraycopy(tmsdk.common.internal.utils.e.er(this.type), 0, bArr, 0, 4);
                System.arraycopy(tmsdk.common.internal.utils.e.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 i(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 = tmsdk.common.internal.utils.e.v(bArr2);
                    this.size = tmsdk.common.internal.utils.e.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(C0002a c0002a, boolean z) {
            InputStream inputStream;
            InputStream inputStream2;
            OutputStream outputStream;
            b bVar;
            OutputStream outputStream2 = null;
            if (c0002a == null || TextUtils.isEmpty(g.eKb)) {
                return null;
            }
            LocalSocket localSocket = new LocalSocket();
            try {
                localSocket.connect(new LocalSocketAddress(g.eKb));
                localSocket.setSoTimeout(ke.YP);
                try {
                    bVar = new b();
                    inputStream = localSocket.getInputStream();
                    try {
                        OutputStream outputStream3 = localSocket.getOutputStream();
                        try {
                            c0002a.writeToStream(outputStream3);
                            bVar.i(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 || g.BE()) {
                    return null;
                }
                g.Ev();
                try {
                    Thread.sleep(200L);
                } catch (Exception e14) {
                }
                return a(c0002a, false);
            }
        }
    }
}