CamScanner.apk(点击下载) / h.java


package com.uc.crashsdk.a;

import android.os.Build;
import android.os.Process;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import android.util.SparseArray;
import com.facebook.appevents.AppEventsConstants;
import com.facebook.appevents.codeless.internal.Constants;
import com.facebook.internal.ServerProtocol;
import com.intsig.camscanner.attention.PurhcaseUsingCoupon;
import com.onedrive.sdk.http.HttpResponseCode;
import com.uc.crashsdk.JNIBridge;
import com.uc.crashsdk.b;
import com.uc.crashsdk.e;
import com.uc.crashsdk.g;
import com.umeng.analytics.pro.ak;
import com.vungle.warren.AdLoader;
import io.netty.handler.codec.rtsp.RtspHeaders;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;

/* compiled from: ProGuard */
public class h {

    /* renamed from: a  reason: collision with root package name */
    static final /* synthetic */ boolean f45176a = true;

    /* renamed from: b  reason: collision with root package name */
    private static final Object f45177b = new Object();

    /* renamed from: c  reason: collision with root package name */
    private static final Map<String, String> f45178c = new HashMap();

    /* renamed from: d  reason: collision with root package name */
    private static int f45179d = 0;

    /* renamed from: e  reason: collision with root package name */
    private static final Map<String, a> f45180e = new HashMap();

    /* renamed from: f  reason: collision with root package name */
    private static final Object f45181f = new Object();

    /* renamed from: g  reason: collision with root package name */
    private static final Object f45182g = new Object();

    /* renamed from: h  reason: collision with root package name */
    private static final SparseArray<String> f45183h = new SparseArray<>();

    /* renamed from: i  reason: collision with root package name */
    private static boolean f45184i = false;

    /* renamed from: j  reason: collision with root package name */
    private static boolean f45185j = false;

    /* renamed from: k  reason: collision with root package name */
    private static final Object f45186k = new Object();

    /* renamed from: l  reason: collision with root package name */
    private static String f45187l = null;

    /* access modifiers changed from: private */
    /* compiled from: ProGuard */
    public static class a {

        /* renamed from: a  reason: collision with root package name */
        long f45188a = 0;

        /* renamed from: b  reason: collision with root package name */
        int f45189b = 0;

        /* renamed from: c  reason: collision with root package name */
        Map<String, String> f45190c = new HashMap();

        /* renamed from: d  reason: collision with root package name */
        private String f45191d;

        /* renamed from: e  reason: collision with root package name */
        private boolean f45192e = false;

        /* renamed from: f  reason: collision with root package name */
        private boolean f45193f = false;

        a(String str, boolean z10, boolean z11) {
            this.f45191d = str;
            this.f45192e = z10;
            this.f45193f = z11;
        }

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

        /* access modifiers changed from: package-private */
        public final String a(String str) {
            return this.f45190c.get(str);
        }

        /* access modifiers changed from: package-private */
        public final String a(boolean z10, boolean z11, boolean z12) {
            if (this.f45191d == null) {
                return null;
            }
            StringBuilder sb2 = new StringBuilder();
            if (z10) {
                h.b(sb2, "lt", "uc");
                h.b(sb2, "pre", g.e());
                h.b(sb2, "pkg", com.uc.crashsdk.a.f45114a);
                h.b(sb2, "rom", Build.VERSION.RELEASE);
                h.b(sb2, "brd", Build.BRAND);
                h.b(sb2, "model", Build.MODEL);
                h.a(sb2, ServerProtocol.DIALOG_PARAM_SDK_VERSION, (long) Build.VERSION.SDK_INT);
                h.b(sb2, ak.f45417w, e.e());
                h.b(sb2, "hdw", e.f());
                long o10 = h.o();
                h.a(sb2, "ram", o10);
                h.b(sb2, "aram", h.a(o10));
                h.b(sb2, "cver", "3.3.1.1");
                h.b(sb2, "cseq", "210916105822");
                h.b(sb2, "ctag", "release");
                h.b(sb2, "aver", com.uc.crashsdk.a.a());
                h.b(sb2, "ver", g.R());
                h.b(sb2, "sver", g.S());
                h.b(sb2, RtspHeaders.Values.SEQ, g.T());
                h.b(sb2, "grd", b.A() ? "fg" : "bg");
                h.b(sb2, ak.f45418x, Constants.PLATFORM);
                h.b(sb2, "dn", e.q());
                String Z = g.Z();
                if (TextUtils.isEmpty(Z)) {
                    Z = e.q();
                }
                h.b(sb2, "k_uid", Z);
                String aa2 = g.aa();
                if (!TextUtils.isEmpty(aa2)) {
                    h.b(sb2, "k_channel", aa2);
                }
                sb2.append("\n");
            }
            h.b(sb2, "lt", this.f45191d);
            h.a(sb2, this.f45190c);
            if (this.f45192e && !z11) {
                long j2 = this.f45188a;
                if (j2 != 0) {
                    h.b(sb2, "up", String.valueOf(j2));
                }
                if (z12) {
                    h.b(sb2, "pid", String.format(Locale.US, "%d", Integer.valueOf(Process.myPid())));
                } else {
                    int i10 = this.f45189b;
                    if (i10 != 0) {
                        h.b(sb2, "pid", String.format(Locale.US, "%d", Integer.valueOf(i10)));
                    }
                }
            }
            sb2.append("\n");
            return sb2.toString();
        }

        /* access modifiers changed from: package-private */
        public final void a(String str, long j2) {
            long d10 = d(str) + j2;
            if (d10 <= 100) {
                j2 = d10 < 0 ? 0 : d10;
            }
            a(str, String.valueOf(j2));
        }

        /* access modifiers changed from: package-private */
        public final void a(String str, String str2) {
            this.f45190c.put(str, str2);
        }

        /* access modifiers changed from: package-private */
        public final boolean a(a aVar) {
            if (!this.f45193f) {
                a.a("crashsdk", String.format(Locale.US, "WaItem '%s' is not mergable!", this.f45191d), null);
                return false;
            }
            for (String str : aVar.f45190c.keySet()) {
                if (str.startsWith("c_")) {
                    a(str, aVar.a(str));
                } else {
                    long d10 = aVar.d(str);
                    if (d10 == 0) {
                        a(str, aVar.a(str));
                    } else if (d10 < 100) {
                        a(str, d10);
                    }
                }
            }
            return true;
        }

        /* access modifiers changed from: package-private */
        public final String b(String str) {
            String a10 = a(str);
            return a10 == null ? "" : a10;
        }

        /* access modifiers changed from: package-private */
        public final boolean c(String str) {
            if (g.a(str)) {
                return false;
            }
            String str2 = null;
            long j2 = 0;
            HashMap hashMap = new HashMap();
            Map c9 = h.c(str);
            int i10 = 0;
            for (String str3 : c9.keySet()) {
                String str4 = (String) c9.get(str3);
                if (str3.equals("lt")) {
                    str2 = str4;
                } else if (this.f45192e && str3.equals("up")) {
                    j2 = g.a(str4, true);
                } else if (!this.f45192e || !str3.equals("pid")) {
                    hashMap.put(str3, str4);
                } else {
                    i10 = (int) g.a(str4, true);
                }
            }
            String str5 = this.f45191d;
            if (!(str5 == null || str5.equals(str2))) {
                return false;
            }
            this.f45188a = j2;
            this.f45189b = i10;
            this.f45191d = str2;
            this.f45190c = hashMap;
            return true;
        }
    }

    static /* synthetic */ String a(long j2) {
        if (j2 < PlaybackStateCompat.ACTION_SET_SHUFFLE_MODE_ENABLED) {
            return "512M";
        }
        return String.format(Locale.US, "%dG", Long.valueOf(((j2 / 1024) + 512) / 1024));
    }

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

    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, b.H() ? 700000 : 70000);
    }

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

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

    private static void a(int i10, boolean z10) {
        if (!a(z10, "crash rate")) {
            String str = g.U() + "cr.wa";
            b.a(f45177b, str, new e(351, new Object[]{str, Integer.valueOf(i10)}));
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:33:0x009d, code lost:
        if (r3 == false) goto L_0x009f;
     */
    /* JADX WARNING: Removed duplicated region for block: B:44:0x00ca  */
    /* JADX WARNING: Removed duplicated region for block: B:49:0x0103  */
    static void a(int i10, Object[] objArr) {
        long j2;
        boolean z10;
        String str;
        boolean z11;
        switch (i10) {
            case 301:
                if (f45176a || objArr != null) {
                    a(((Integer) objArr[0]).intValue(), false);
                    return;
                }
                throw new AssertionError();
            case 302:
                if (f45176a || objArr != null) {
                    synchronized (f45177b) {
                        int intValue = ((Integer) objArr[0]).intValue();
                        if (intValue == 0) {
                            if (!f45184i) {
                                f45184i = true;
                            }
                        }
                        if (!com.uc.crashsdk.a.f45115b.equals("2.0") || !b.c(268435456)) {
                            File file = new File(m());
                            String c9 = g.c(file);
                            a aVar = new a("pv", true, true);
                            a.a("wa", "addPvStatImpl, read data: " + c9);
                            if (!g.a(c9)) {
                                aVar.c(c9);
                            }
                            if (intValue == 0) {
                                a.a("wa", String.format(Locale.US, "Last upload pid is %d", Integer.valueOf(aVar.f45189b)));
                                if (aVar.f45189b != Process.myPid()) {
                                    z11 = false;
                                    break;
                                } else {
                                    z11 = true;
                                    break;
                                }
                            }
                            if (intValue == 0) {
                                aVar.a("pv", 1);
                                str = "fjv";
                            } else if (intValue == 1) {
                                str = "hpv";
                            } else {
                                if (intValue == 2) {
                                    aVar.a("pv", 1);
                                    str = "npv";
                                }
                                String q10 = e.q();
                                j2 = aVar.f45188a;
                                if (j2 != 0) {
                                    long currentTimeMillis = System.currentTimeMillis();
                                    long j10 = currentTimeMillis - j2;
                                    a.a("wa", String.format(Locale.US, "Upload delta %d s, min interval: %d s", Long.valueOf(j10 / 1000), 28800L));
                                    if (j10 < 28800000) {
                                        z10 = false;
                                        if (z10) {
                                            aVar.f45190c = new HashMap();
                                            aVar.f45188a = System.currentTimeMillis();
                                            aVar.f45189b = Process.myPid();
                                        }
                                        String a10 = aVar.a(false, false, true);
                                        a.a("wa", "addPvStatImpl, save data: " + a10);
                                        g.a(file, a10);
                                    }
                                }
                                z10 = c(q10, aVar.a(true, true, false));
                                if (z10) {
                                }
                                String a102 = aVar.a(false, false, true);
                                a.a("wa", "addPvStatImpl, save data: " + a102);
                                g.a(file, a102);
                            }
                            aVar.a(str, 1);
                            String q102 = e.q();
                            j2 = aVar.f45188a;
                            if (j2 != 0) {
                            }
                            z10 = c(q102, aVar.a(true, true, false));
                            if (z10) {
                            }
                            String a1022 = aVar.a(false, false, true);
                            a.a("wa", "addPvStatImpl, save data: " + a1022);
                            g.a(file, a1022);
                        } else {
                            a.a("wa", "pv stat is disabled");
                        }
                    }
                    return;
                }
                throw new AssertionError();
            case HttpResponseCode.HTTP_SEE_OTHER:
                b(false);
                return;
            default:
                if (!f45176a) {
                    throw new AssertionError();
                }
                return;
        }
    }

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

    static void a(String str) {
        synchronized (f45177b) {
            File file = new File(m());
            a aVar = new a("pv", true, true);
            String c9 = g.c(file);
            a.a("wa", "addAuthStat, read data: " + c9);
            if (!g.a(c9)) {
                aVar.c(c9);
            }
            aVar.a(str, 1);
            aVar.a("aujv", 1);
            String a10 = aVar.a(false, false, false);
            a.a("wa", "addAuthStat, save data: " + a10);
            g.a(file, a10);
        }
    }

    public static void a(String str, int i10, int i11) {
        if (g.O()) {
            synchronized (f45181f) {
                Map<String, a> map = f45180e;
                a aVar = map.get(str);
                if (aVar == null) {
                    aVar = new a("cst", false, true);
                    map.put(str, aVar);
                    a(aVar);
                }
                SparseArray<String> sparseArray = f45183h;
                synchronized (sparseArray) {
                    if (sparseArray.size() == 0) {
                        a(100, "pv");
                        a(102, "hpv");
                        a(1, PurhcaseUsingCoupon.CTION_UPDATE_USER_INFO_TYPE_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(201, "lec");
                        a(25, "lrc");
                        a(26, "lss");
                    }
                }
                String str2 = sparseArray.get(i10);
                if (str2 == null) {
                    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 /* synthetic */ void a(StringBuilder sb2, String str, long j2) {
        b(sb2, str, String.valueOf(j2));
    }

    static /* synthetic */ void a(StringBuilder sb2, Map map) {
        for (String str : map.keySet()) {
            b(sb2, 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 = f45178c;
            synchronized (map) {
                if (map.get(str3) == null) {
                    int i10 = f45179d;
                    if (i10 >= 20) {
                        return false;
                    }
                    f45179d = 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 (!g.O()) {
            return false;
        }
        String n10 = n();
        return b.a(f45182g, n10, new e(353, new Object[]{str, str2, Boolean.valueOf(z10), Boolean.valueOf(z11)}));
    }

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

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

    private static void b(int i10, long j2) {
        if (g.O()) {
            f.a(1, new e(301, new Object[]{Integer.valueOf(i10)}), j2);
        }
    }

    static void b(String str) {
        synchronized (f45186k) {
            f45187l = str;
            String k10 = b.k();
            b.a(k10, str + "\n");
        }
    }

    /* access modifiers changed from: private */
    public static void b(StringBuilder sb2, String str, String str2) {
        sb2.append(str);
        sb2.append("=");
        sb2.append(str2);
        sb2.append("`");
    }

    public static void b(boolean z10) {
        if (!a(z10, "crash detail upload")) {
            String str = g.U() + "dt.wa";
            b.a(f45181f, str, new e(352, new Object[]{str}));
            String n10 = n();
            b.a(f45182g, n10, new e(354, new Object[]{n10}));
        }
    }

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

    /* JADX WARNING: Removed duplicated region for block: B:13:0x007c  */
    /* JADX WARNING: Removed duplicated region for block: B:14:0x007f  */
    /* JADX WARNING: Removed duplicated region for block: B:17:0x00aa  */
    /* JADX WARNING: Removed duplicated region for block: B:20:0x00c6 A[RETURN] */
    /* JADX WARNING: Removed duplicated region for block: B:21:0x00c7  */
    private static boolean b(String str, String str2) {
        boolean z10;
        String sb2;
        if (g.a(str2)) {
            return true;
        }
        a.a("wa", "Reporting datas: " + str2);
        byte[] bytes = str2.getBytes();
        long currentTimeMillis = System.currentTimeMillis();
        String c9 = g.c(g.e() + str + currentTimeMillis + "AppChk#2014");
        try {
            byte[] a10 = c.a(bytes, c9.substring(c9.length() - 16, c9.length()).getBytes());
            if (a10 != null) {
                bytes = a10;
                z10 = true;
                String substring = c9.substring(c9.length() - 8, c9.length());
                StringBuilder sb3 = new StringBuilder();
                sb3.append(!g.P() ? "https://px-intl.ucweb.com" : "https://px.ucweb.com");
                sb3.append("/api/v1/crashtrack/upload?chk=");
                sb3.append(substring);
                sb3.append("&vno=");
                sb3.append(currentTimeMillis);
                sb3.append("&uuid=");
                sb3.append(str);
                sb3.append("&app=");
                sb3.append(g.e());
                if (z10) {
                    sb3.append("&enc=aes");
                }
                sb2 = sb3.toString();
                a.a("wa", "url: " + sb2);
                if (sb2 != null) {
                    return false;
                }
                byte[] a11 = c.a(sb2, bytes, true);
                if (a11 == null) {
                    a.a("wa", "px response is empty!");
                    return false;
                }
                String str3 = new String(a11);
                a.a("wa", "px response: " + str3);
                return str3.contains("retcode=0");
            }
        } catch (Throwable th) {
            g.a(th);
        }
        z10 = false;
        String substring2 = c9.substring(c9.length() - 8, c9.length());
        StringBuilder sb32 = new StringBuilder();
        sb32.append(!g.P() ? "https://px-intl.ucweb.com" : "https://px.ucweb.com");
        sb32.append("/api/v1/crashtrack/upload?chk=");
        sb32.append(substring2);
        sb32.append("&vno=");
        sb32.append(currentTimeMillis);
        sb32.append("&uuid=");
        sb32.append(str);
        sb32.append("&app=");
        sb32.append(g.e());
        if (z10) {
        }
        sb2 = sb32.toString();
        a.a("wa", "url: " + sb2);
        if (sb2 != null) {
        }
    }

    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", 1);
        if (z10) {
            aVar.a("lim", 1);
        }
        if (z11) {
            aVar.a("syu", 1);
        }
        return g.a(file, a((Iterable<a>) a10, false, false).toString());
    }

    static /* synthetic */ Map c(String str) {
        HashMap hashMap = new HashMap();
        String[] split = str.split("`");
        for (String str2 : 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, 0);
    }

    /* JADX WARNING: Removed duplicated region for block: B:12:0x0055  */
    /* JADX WARNING: Removed duplicated region for block: B:15:0x005d  */
    /* JADX WARNING: Removed duplicated region for block: B:16:0x0060  */
    /* JADX WARNING: Removed duplicated region for block: B:19:0x0087  */
    /* JADX WARNING: Removed duplicated region for block: B:20:0x0089  */
    /* JADX WARNING: Removed duplicated region for block: B:32:0x0106 A[RETURN] */
    /* JADX WARNING: Removed duplicated region for block: B:33:0x0107 A[RETURN] */
    private static boolean c(String str, String str2) {
        boolean z10;
        String c9;
        String str3;
        byte[] a10;
        if (g.a(str2)) {
            return true;
        }
        a.a("wa", "Reporting datas: " + str2);
        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());
            byte[] a11 = c.a(bytes, bArr);
            if (a11 != null) {
                bytes = a11;
                z10 = true;
                if (str == null) {
                    str = "unknown";
                }
                String str4 = !g.P() ? "4ea4e41a3993" : "28ef1713347d";
                String valueOf = String.valueOf(System.currentTimeMillis());
                c9 = g.c(str4 + str + valueOf + "AppChk#2014");
                if (c9 != null) {
                    str3 = null;
                } else {
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append(p());
                    sb2.append("?chk=");
                    sb2.append(c9.substring(c9.length() - 8, c9.length()));
                    sb2.append("&vno=");
                    sb2.append(valueOf);
                    sb2.append("&uuid=");
                    sb2.append(str);
                    sb2.append("&app=");
                    sb2.append(str4);
                    if (z10) {
                        sb2.append("&enc=aes");
                    }
                    str3 = sb2.toString();
                }
                a.a("wa", "url: " + str3);
                if (str3 != null || (a10 = c.a(str3, bytes, true)) == null) {
                    return false;
                }
                String str5 = new String(a10);
                a.a("wa", "wa response: " + str5);
                return !str5.contains("retcode=0");
            }
        } catch (Throwable th) {
            g.a(th);
        }
        z10 = false;
        if (str == null) {
        }
        if (!g.P()) {
        }
        String valueOf2 = String.valueOf(System.currentTimeMillis());
        c9 = g.c(str4 + str + valueOf2 + "AppChk#2014");
        if (c9 != null) {
        }
        a.a("wa", "url: " + str3);
        if (str3 != null) {
            return false;
        }
        String str52 = new String(a10);
        a.a("wa", "wa response: " + str52);
        if (!str52.contains("retcode=0")) {
        }
    }

    public static void d() {
        b(2, (long) AdLoader.RETRY_DELAY);
        a(1, 70000);
    }

    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 = f45180e;
                a aVar = map.get(a10);
                if (aVar != null) {
                    aVar.a(next);
                } else {
                    map.put(a10, next);
                }
            }
        }
        Map<String, a> map2 = f45180e;
        StringBuilder a11 = a((Iterable<a>) map2.values(), true, false);
        boolean b10 = g.Y() ? b(e.q(), a11.toString()) : c(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 f45185j;
    }

    public static void f() {
        b(1, (long) AdLoader.RETRY_DELAY);
    }

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

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

    public static void i() {
        if (g.O()) {
            f.a(1, new e(HttpResponseCode.HTTP_SEE_OTHER));
        }
    }

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

    public static void k() {
        synchronized (f45186k) {
            f45187l = null;
        }
    }

    private static String m() {
        return g.U() + "pv.wa";
    }

    private static String n() {
        return g.U() + "cdt.wa";
    }

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

    private static String p() {
        String str = f45187l;
        if (g.a(str)) {
            synchronized (f45186k) {
                String str2 = "https://errlog.umeng.com/api/crashsdk/logcollect";
                if (g.P()) {
                    str2 = "https://errlogos.umeng.com/api/crashsdk/logcollect";
                }
                str = g.a(b.k(), str2, true);
                f45187l = str;
            }
        }
        return str;
    }
}