小源钱包 v1.0.0版本的 MD5 值为:2fddb51fa9867693f901004082511bea

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


package com.uc.crashsdk.a;

import android.os.Build;
import android.os.Process;
import android.text.TextUtils;
import android.util.SparseArray;
import com.uc.crashsdk.JNIBridge;
import com.uc.crashsdk.export.CrashStatKey;
import com.umeng.analytics.pro.am;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
public class h {
    static final boolean f16327a = true;
    private static final Object f16328b = new Object();
    private static final Map<String, String> f16329c = new HashMap();
    private static int f16330d = 0;
    private static final Map<String, a> f16331e = new HashMap();
    private static final Object f16332f = new Object();
    private static final Object f16333g = new Object();
    private static final SparseArray<String> f16334h = new SparseArray<>();
    private static boolean f16335i = false;
    private static boolean f16336j = false;
    private static final Object f16337k = new Object();
    private static String f16338l = null;

    public static class a {
        long f16339a = 0;
        int f16340b = 0;
        Map<String, String> f16341c = new HashMap();
        private String f16342d;
        private boolean f16343e;
        private boolean f16344f;

        a(String str, boolean z10, boolean z11) {
            this.f16343e = false;
            this.f16344f = false;
            this.f16342d = str;
            this.f16343e = z10;
            this.f16344f = z11;
        }

        private long d(String str) {
            return g.c(a(str));
        }

        final String a(String str) {
            return this.f16341c.get(str);
        }

        final String a(boolean z10, boolean z11, boolean z12) {
            String format;
            if (this.f16342d == null) {
                return null;
            }
            StringBuilder sb = new StringBuilder();
            if (z10) {
                h.b(sb, "lt", "uc");
                h.b(sb, "pre", com.uc.crashsdk.g.e());
                h.b(sb, "pkg", com.uc.crashsdk.a.f16265a);
                h.b(sb, "rom", Build.VERSION.RELEASE);
                h.b(sb, "brd", Build.BRAND);
                h.b(sb, "model", Build.MODEL);
                h.a(sb, "sdk", Build.VERSION.SDK_INT);
                h.b(sb, am.f16562w, com.uc.crashsdk.e.e());
                h.b(sb, "hdw", com.uc.crashsdk.e.f());
                long l6 = h.l();
                h.a(sb, "ram", l6);
                h.b(sb, "aram", h.a(l6));
                h.b(sb, "cver", "3.3.2.2");
                h.b(sb, "cseq", "211215141717");
                h.b(sb, "ctag", "release");
                h.b(sb, "aver", com.uc.crashsdk.a.a());
                h.b(sb, "ver", com.uc.crashsdk.g.T());
                h.b(sb, "sver", com.uc.crashsdk.g.U());
                h.b(sb, "seq", com.uc.crashsdk.g.V());
                h.b(sb, "grd", com.uc.crashsdk.b.A() ? "fg" : "bg");
                h.b(sb, am.f16563x, "android");
                h.b(sb, "dn", com.uc.crashsdk.e.q());
                String ab = com.uc.crashsdk.g.ab();
                if (TextUtils.isEmpty(ab)) {
                    ab = com.uc.crashsdk.e.q();
                }
                h.b(sb, "k_uid", ab);
                String ac = com.uc.crashsdk.g.ac();
                if (!TextUtils.isEmpty(ac)) {
                    h.b(sb, "k_channel", ac);
                }
                sb.append("\n");
            }
            h.b(sb, "lt", this.f16342d);
            h.a(sb, this.f16341c);
            if (this.f16343e && !z11) {
                long j10 = this.f16339a;
                if (j10 != 0) {
                    h.b(sb, "up", String.valueOf(j10));
                }
                if (z12) {
                    format = String.format(Locale.US, "%d", Integer.valueOf(Process.myPid()));
                } else {
                    int i10 = this.f16340b;
                    if (i10 != 0) {
                        format = String.format(Locale.US, "%d", Integer.valueOf(i10));
                    }
                }
                h.b(sb, "pid", format);
            }
            sb.append("\n");
            return sb.toString();
        }

        final void a(String str, long j10) {
            long d10 = d(str) + j10;
            if (d10 <= 100) {
                j10 = d10 < 0 ? 0L : d10;
            }
            a(str, String.valueOf(j10));
        }

        final void a(String str, String str2) {
            this.f16341c.put(str, str2);
        }

        final boolean a(a aVar) {
            if (!this.f16344f) {
                com.uc.crashsdk.a.a.a("crashsdk", String.format(Locale.US, "WaItem '%s' is not mergable!", this.f16342d), null);
                return false;
            }
            for (String str : aVar.f16341c.keySet()) {
                if (!str.startsWith("c_")) {
                    long d10 = aVar.d(str);
                    if (d10 != 0) {
                        if (d10 < 100) {
                            a(str, d10);
                        }
                    }
                }
                a(str, aVar.a(str));
            }
            return true;
        }

        final String b(String str) {
            String a10 = a(str);
            return a10 == null ? "" : a10;
        }

        final boolean c(String str) {
            if (g.a(str)) {
                return false;
            }
            String str2 = null;
            long j10 = 0;
            HashMap hashMap = new HashMap();
            Map c10 = h.c(str);
            int i10 = 0;
            for (String str3 : c10.keySet()) {
                String str4 = (String) c10.get(str3);
                if (str3.equals("lt")) {
                    str2 = str4;
                } else if (this.f16343e && str3.equals("up")) {
                    j10 = g.c(str4);
                } else if (this.f16343e && str3.equals("pid")) {
                    i10 = (int) g.c(str4);
                } else {
                    hashMap.put(str3, str4);
                }
            }
            String str5 = this.f16342d;
            if (str5 == null || str5.equals(str2)) {
                this.f16339a = j10;
                this.f16340b = i10;
                this.f16342d = str2;
                this.f16341c = hashMap;
                return true;
            }
            return false;
        }
    }

    static String a(long j10) {
        return j10 < 524288 ? "512M" : String.format(Locale.US, "%dG", Long.valueOf(((j10 / 1024) + 512) / 1024));
    }

    private static StringBuilder a(Iterable<a> iterable, boolean z10, boolean z11) {
        StringBuilder sb = new StringBuilder();
        boolean z12 = true;
        for (a aVar : iterable) {
            if (z12) {
                sb.append(aVar.a(z10, z10, z11));
                z12 = false;
            } else {
                sb.append(aVar.a(false, z10, z11));
            }
        }
        return sb;
    }

    private static ArrayList<a> a(File file, String str, int i10) {
        ArrayList<String> a10 = g.a(file, i10);
        ArrayList<a> arrayList = new ArrayList<>();
        Iterator<String> it = a10.iterator();
        while (it.hasNext()) {
            a aVar = new a(str, false, false);
            if (aVar.c(it.next())) {
                arrayList.add(aVar);
            }
        }
        return arrayList;
    }

    public static void a() {
        a(0, com.uc.crashsdk.b.H() ? 700000L : 70000L);
    }

    private static void a(int i10, long j10) {
        if (com.uc.crashsdk.b.F()) {
            f.a(0, new e(302, new Object[]{Integer.valueOf(i10)}), j10);
        }
    }

    private static void a(int i10, String str) {
        f16334h.put(i10, str);
    }

    private static void a(int i10, boolean z10) {
        if (a(z10, "crash rate")) {
            return;
        }
        String str = com.uc.crashsdk.g.W() + "cr.wa";
        com.uc.crashsdk.b.a(f16328b, str, new e(351, new Object[]{str, Integer.valueOf(i10)}));
    }

    public static void a(int i10, Object[] objArr) {
        String str;
        String q10;
        long j10;
        boolean z10;
        switch (i10) {
            case 301:
                if (!f16327a && objArr == null) {
                    throw new AssertionError();
                }
                a(((Integer) objArr[0]).intValue(), false);
                return;
            case 302:
                if (!f16327a && objArr == null) {
                    throw new AssertionError();
                }
                synchronized (f16328b) {
                    int intValue = ((Integer) objArr[0]).intValue();
                    if (intValue == 0) {
                        if (!f16335i) {
                            f16335i = true;
                        }
                    }
                    if (!com.uc.crashsdk.a.f16266b.equals("2.0") || !com.uc.crashsdk.b.c(268435456)) {
                        File file = new File(m());
                        String c10 = g.c(file);
                        a aVar = new a("pv", true, true);
                        if (!g.a(c10)) {
                            aVar.c(c10);
                        }
                        if (intValue == 0) {
                            if (aVar.f16340b != Process.myPid()) {
                                z10 = false;
                                break;
                            } else {
                                z10 = true;
                                break;
                            }
                        }
                        if (intValue == 0) {
                            aVar.a("pv", 1L);
                            str = "fjv";
                        } else if (intValue == 1) {
                            str = "hpv";
                        } else {
                            if (intValue == 2) {
                                aVar.a("pv", 1L);
                                str = "npv";
                            }
                            q10 = com.uc.crashsdk.e.q();
                            j10 = aVar.f16339a;
                            if ((j10 != 0 || System.currentTimeMillis() - j10 >= 28800000) ? c(q10, aVar.a(true, true, false)) : false) {
                                aVar.f16341c = new HashMap();
                                aVar.f16339a = System.currentTimeMillis();
                                aVar.f16340b = Process.myPid();
                            }
                            g.a(file, aVar.a(false, false, true));
                        }
                        aVar.a(str, 1L);
                        q10 = com.uc.crashsdk.e.q();
                        j10 = aVar.f16339a;
                        if ((j10 != 0 || System.currentTimeMillis() - j10 >= 28800000) ? c(q10, aVar.a(true, true, false)) : false) {
                        }
                        g.a(file, aVar.a(false, false, true));
                    }
                }
                return;
            case 303:
                b(false);
                return;
            default:
                if (!f16327a) {
                    throw new AssertionError();
                }
                return;
        }
    }

    private static void a(a aVar) {
        Map<String, String> map = f16329c;
        synchronized (map) {
            for (String str : map.keySet()) {
                aVar.a(str, f16329c.get(str));
            }
        }
    }

    public static void a(String str) {
        synchronized (f16328b) {
            File file = new File(m());
            a aVar = new a("pv", true, true);
            String c10 = g.c(file);
            if (!g.a(c10)) {
                aVar.c(c10);
            }
            aVar.a(str, 1L);
            aVar.a("aujv", 1L);
            g.a(file, aVar.a(false, false, false));
        }
    }

    public static void a(String str, int i10, int i11) {
        if (com.uc.crashsdk.g.Q()) {
            synchronized (f16332f) {
                Map<String, a> map = f16331e;
                a aVar = map.get(str);
                if (aVar == null) {
                    aVar = new a("cst", false, true);
                    map.put(str, aVar);
                    a(aVar);
                }
                SparseArray<String> sparseArray = f16334h;
                synchronized (sparseArray) {
                    if (sparseArray.size() == 0) {
                        a(100, "pv");
                        a(102, "hpv");
                        a(1, "all");
                        a(2, "afg");
                        a(101, "abg");
                        a(3, "jfg");
                        a(4, "jbg");
                        a(7, "nfg");
                        a(8, "nbg");
                        a(27, "nafg");
                        a(28, "nabg");
                        a(9, "nho");
                        a(10, "uar");
                        a(29, "ulm");
                        a(30, "ukt");
                        a(31, "uet");
                        a(32, "urs");
                        a(11, "ufg");
                        a(12, "ubg");
                        a(40, "anf");
                        a(41, "anb");
                        a(42, "ancf");
                        a(43, "ancb");
                        a(13, "lup");
                        a(14, "luf");
                        a(15, "lef");
                        a(200, "ltf");
                        a(16, "laf");
                        a(22, "lac");
                        a(23, "lau");
                        a(17, "llf");
                        a(18, "lul");
                        a(19, "lub");
                        a(20, "luc");
                        a(21, "luu");
                        a(24, "lzc");
                        a((int) CrashStatKey.LOG_UPLOAD_ENCRYPT_COUNT, "lec");
                        a(25, "lrc");
                        a(26, "lss");
                    }
                }
                String str2 = sparseArray.get(i10);
                if (str2 == null) {
                    com.uc.crashsdk.a.a.a("crashsdk", "map key is not set with: " + i10, null);
                }
                aVar.a("prc", str);
                if (str2 != null) {
                    aVar.a(str2, String.valueOf(i11));
                }
            }
        }
    }

    static void a(StringBuilder sb, String str, long j10) {
        b(sb, str, String.valueOf(j10));
    }

    static void a(StringBuilder sb, Map map) {
        for (String str : map.keySet()) {
            b(sb, str, (String) map.get(str));
        }
    }

    public static void a(boolean z10) {
        a(1, z10);
    }

    public static boolean a(String str, String str2) {
        try {
            String str3 = "c_" + str.replaceAll("[^0-9a-zA-Z-_]", "-");
            String replaceAll = g.a(str2) ? "" : str2.replaceAll("[`=]", "-");
            Map<String, String> map = f16329c;
            synchronized (map) {
                if (map.get(str3) == null) {
                    int i10 = f16330d;
                    if (i10 >= 20) {
                        return false;
                    }
                    f16330d = i10 + 1;
                }
                map.put(str3, replaceAll);
                return true;
            }
        } catch (Throwable th) {
            g.a(th);
            return false;
        }
    }

    public static boolean a(String str, String str2, boolean z10, boolean z11) {
        if (com.uc.crashsdk.g.Q()) {
            return com.uc.crashsdk.b.a(f16333g, n(), new e(353, new Object[]{str, str2, Boolean.valueOf(z10), Boolean.valueOf(z11)}));
        }
        return false;
    }

    public static boolean a(boolean z10, String str) {
        if (com.uc.crashsdk.b.f16349d && !z10 && JNIBridge.nativeIsCrashing()) {
            com.uc.crashsdk.a.a.b("crashsdk", "Native is crashing, skip stat for " + str);
            return true;
        }
        return false;
    }

    public static void b() {
        a(2, 0L);
    }

    private static void b(int i10, long j10) {
        if (com.uc.crashsdk.g.Q()) {
            f.a(1, new e(301, new Object[]{Integer.valueOf(i10)}), j10);
        }
    }

    public static void b(String str) {
        synchronized (f16337k) {
            f16338l = str;
            String k6 = com.uc.crashsdk.b.k();
            b.a(k6, str + "\n");
        }
    }

    public static void b(StringBuilder sb, String str, String str2) {
        sb.append(str);
        sb.append("=");
        sb.append(str2);
        sb.append("`");
    }

    public static void b(boolean z10) {
        if (a(z10, "crash detail upload")) {
            return;
        }
        String str = com.uc.crashsdk.g.W() + "dt.wa";
        com.uc.crashsdk.b.a(f16332f, str, new e(352, new Object[]{str}));
        String n6 = n();
        com.uc.crashsdk.b.a(f16333g, n6, new e(354, new Object[]{n6}));
    }

    public static boolean b(int i10, Object[] objArr) {
        switch (i10) {
            case 351:
                if (f16327a || objArr != null) {
                    String str = (String) objArr[0];
                    int intValue = ((Integer) objArr[1]).intValue();
                    if (intValue == 1) {
                        if (f16336j) {
                            return false;
                        }
                        f16336j = true;
                    }
                    if (com.uc.crashsdk.g.Z()) {
                        File file = new File(str);
                        ArrayList<a> a10 = a(file, "crp", 100);
                        if (intValue != 4) {
                            a aVar = new a("crp", false, false);
                            if (intValue == 1) {
                                aVar.a("et", String.valueOf(com.uc.crashsdk.b.I()));
                                aVar.a("ete", String.valueOf(com.uc.crashsdk.b.J()));
                            } else if (intValue == 3) {
                                aVar.a("et", "1");
                                aVar.a("ete", "1");
                            } else if (intValue == 2) {
                                aVar.a("hpv", "1");
                            }
                            aVar.a("prc", com.uc.crashsdk.e.h());
                            aVar.a("imp", com.uc.crashsdk.b.F() ? "1" : "0");
                            a(aVar);
                            a10.add(0, aVar);
                        }
                        if (!a10.isEmpty()) {
                            boolean c10 = c(com.uc.crashsdk.e.q(), a((Iterable<a>) a10, true, false).toString());
                            g.b(file);
                            if (!c10) {
                                g.a(file, a((Iterable<a>) a10, false, true).toString());
                            }
                        }
                        return true;
                    }
                    return false;
                }
                throw new AssertionError();
            case 352:
                if (f16327a || objArr != null) {
                    return d((String) objArr[0]);
                }
                throw new AssertionError();
            case 353:
                if (f16327a || objArr != null) {
                    return b((String) objArr[0], (String) objArr[1], ((Boolean) objArr[2]).booleanValue(), ((Boolean) objArr[3]).booleanValue());
                }
                throw new AssertionError();
            case 354:
                if (f16327a || objArr != null) {
                    File file2 = new File((String) objArr[0]);
                    boolean c11 = c(com.uc.crashsdk.e.q(), a((Iterable<a>) a(file2, "cst", 30), true, false).toString());
                    if (c11) {
                        g.b(file2);
                    }
                    return c11;
                }
                throw new AssertionError();
            default:
                return false;
        }
    }

    private static boolean b(String str, String str2) {
        boolean z10;
        byte[] a10;
        byte[] a11;
        if (g.a(str2)) {
            return true;
        }
        byte[] bytes = str2.getBytes();
        long currentTimeMillis = System.currentTimeMillis();
        String d10 = g.d(com.uc.crashsdk.g.e() + str + currentTimeMillis + "AppChk#2014");
        try {
            a11 = c.a(bytes, d10.substring(d10.length() - 16, d10.length()).getBytes());
        } catch (Throwable th) {
            g.a(th);
        }
        if (a11 != null) {
            bytes = a11;
            z10 = true;
            String substring = d10.substring(d10.length() - 8, d10.length());
            StringBuilder sb = new StringBuilder();
            sb.append(com.uc.crashsdk.g.z());
            sb.append("/api/v1/crashtrack/upload?chk=");
            sb.append(substring);
            sb.append("&vno=");
            sb.append(currentTimeMillis);
            sb.append("&uuid=");
            sb.append(str);
            sb.append("&app=");
            sb.append(com.uc.crashsdk.g.e());
            if (z10) {
                sb.append("&enc=aes");
            }
            String sb2 = sb.toString();
            return sb2 == null && (a10 = c.a(sb2, bytes)) != null && new String(a10).contains("retcode=0");
        }
        z10 = false;
        String substring2 = d10.substring(d10.length() - 8, d10.length());
        StringBuilder sb3 = new StringBuilder();
        sb3.append(com.uc.crashsdk.g.z());
        sb3.append("/api/v1/crashtrack/upload?chk=");
        sb3.append(substring2);
        sb3.append("&vno=");
        sb3.append(currentTimeMillis);
        sb3.append("&uuid=");
        sb3.append(str);
        sb3.append("&app=");
        sb3.append(com.uc.crashsdk.g.e());
        if (z10) {
        }
        String sb22 = sb3.toString();
        if (sb22 == null) {
            return false;
        }
    }

    private static boolean b(String str, String str2, boolean z10, boolean z11) {
        a aVar;
        File file = new File(n());
        ArrayList<a> a10 = a(file, "cst", 30);
        String str3 = str + str2;
        Iterator<a> it = a10.iterator();
        while (true) {
            if (!it.hasNext()) {
                aVar = null;
                break;
            }
            aVar = it.next();
            if (str3.equals(aVar.b("prc") + aVar.b("typ"))) {
                break;
            }
        }
        if (aVar == null) {
            aVar = new a("cst", false, true);
            aVar.a("prc", str);
            aVar.a("typ", str2);
            a(aVar);
            a10.add(aVar);
        }
        aVar.a("cnt", 1L);
        if (z10) {
            aVar.a("lim", 1L);
        }
        if (z11) {
            aVar.a("syu", 1L);
        }
        return g.a(file, a((Iterable<a>) a10, false, false).toString());
    }

    static Map c(String str) {
        String[] split;
        HashMap hashMap = new HashMap();
        for (String str2 : str.split("`")) {
            if (str2.length() > 1) {
                String[] split2 = str2.split("=", 3);
                if (split2.length == 2) {
                    hashMap.put(split2[0], split2[1]);
                }
            }
        }
        return hashMap;
    }

    public static void c() {
        a(3, 0L);
    }

    private static boolean c(String str, String str2) {
        boolean z10;
        String d10;
        String sb;
        byte[] a10;
        byte[] a11;
        if (g.a(str2)) {
            return true;
        }
        byte[] bytes = str2.getBytes();
        try {
            byte[] bArr = new byte[16];
            c.a(bArr, 0, c.a());
            c.a(bArr, 4, j());
            c.a(bArr, 8, com.uc.crashsdk.a.f());
            c.a(bArr, 12, d.d());
            a11 = c.a(bytes, bArr);
        } catch (Throwable th) {
            g.a(th);
        }
        if (a11 != null) {
            bytes = a11;
            z10 = true;
            if (str == null) {
                str = "unknown";
            }
            String str3 = !com.uc.crashsdk.g.R() ? "4ea4e41a3993" : "28ef1713347d";
            String valueOf = String.valueOf(System.currentTimeMillis());
            d10 = g.d(str3 + str + valueOf + "AppChk#2014");
            if (d10 != null) {
                sb = null;
            } else {
                StringBuilder sb2 = new StringBuilder();
                sb2.append(com.uc.crashsdk.g.z());
                sb2.append("?chk=");
                sb2.append(d10.substring(d10.length() - 8, d10.length()));
                sb2.append("&vno=");
                sb2.append(valueOf);
                sb2.append("&uuid=");
                sb2.append(str);
                sb2.append("&app=");
                sb2.append(str3);
                if (z10) {
                    sb2.append("&enc=aes");
                }
                sb = sb2.toString();
            }
            return sb == null && (a10 = c.a(sb, bytes)) != null && new String(a10).contains("retcode=0");
        }
        z10 = false;
        if (str == null) {
        }
        if (!com.uc.crashsdk.g.R()) {
        }
        String valueOf2 = String.valueOf(System.currentTimeMillis());
        d10 = g.d(str3 + str + valueOf2 + "AppChk#2014");
        if (d10 != null) {
        }
        if (sb == null) {
            return false;
        }
    }

    public static void d() {
        b(2, 2000L);
        a(1, 70000L);
    }

    private static boolean d(String str) {
        File file = new File(str);
        Iterator<a> it = a(file, "cst", 30).iterator();
        while (it.hasNext()) {
            a next = it.next();
            String a10 = next.a("prc");
            if (!g.a(a10)) {
                Map<String, a> map = f16331e;
                a aVar = map.get(a10);
                if (aVar != null) {
                    aVar.a(next);
                } else {
                    map.put(a10, next);
                }
            }
        }
        Map<String, a> map2 = f16331e;
        StringBuilder a11 = a((Iterable<a>) map2.values(), true, false);
        boolean b10 = com.uc.crashsdk.g.aa() ? b(com.uc.crashsdk.e.q(), a11.toString()) : c(com.uc.crashsdk.e.q(), a11.toString());
        g.b(file);
        if (b10 || g.a(file, a((Iterable<a>) map2.values(), false, true).toString())) {
            map2.clear();
        }
        return true;
    }

    public static boolean e() {
        return f16336j;
    }

    public static void f() {
        b(1, 2000L);
    }

    public static void g() {
        b(3, 0L);
    }

    public static void h() {
        b(4, 0L);
    }

    public static void i() {
        if (com.uc.crashsdk.g.Q()) {
            f.a(1, new e(303));
        }
    }

    public static byte[] j() {
        return new byte[]{Byte.MAX_VALUE, 100, 110, 31};
    }

    public static void k() {
        synchronized (f16337k) {
            f16338l = null;
        }
    }

    static long l() {
        return o();
    }

    private static String m() {
        return com.uc.crashsdk.g.W() + "pv.wa";
    }

    private static String n() {
        return com.uc.crashsdk.g.W() + "cdt.wa";
    }

    private static long o() {
        Iterator<String> it = g.a(new File("/proc/meminfo"), 2).iterator();
        while (true) {
            if (!it.hasNext()) {
                break;
            }
            String next = it.next();
            if (next.contains("MemTotal:")) {
                try {
                    return Long.parseLong(next.replaceAll("\\D+", ""));
                } catch (NumberFormatException e10) {
                    g.a(e10);
                }
            }
        }
        return 0L;
    }
}