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


package com.uc.crashsdk.a;

import android.os.Process;
import androidx.exifinterface.media.ExifInterface;
import androidx.work.PeriodicWorkRequest;
import com.facebook.appevents.codeless.internal.Constants;
import com.facebook.internal.ServerProtocol;
import com.uc.crashsdk.a;
import com.uc.crashsdk.b;
import com.uc.crashsdk.e;
import com.uc.crashsdk.g;
import com.umeng.analytics.pro.ak;
import com.umeng.commonsdk.framework.UMModuleRegister;
import io.netty.handler.codec.memcache.binary.BinaryMemcacheOpcodes;
import java.util.Locale;

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

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

    /* renamed from: b  reason: collision with root package name */
    private static boolean f45146b = true;

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

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

    /* renamed from: e  reason: collision with root package name */
    private static String f45149e = "hsdk";

    /* renamed from: f  reason: collision with root package name */
    private static String f45150f = "alid ";

    /* renamed from: g  reason: collision with root package name */
    private static String f45151g;

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

    /* renamed from: i  reason: collision with root package name */
    private static String f45153i;

    private static StringBuilder a(StringBuilder sb2, String str, String str2) {
        if (sb2.length() > 0) {
            sb2.append("`");
        }
        sb2.append(str);
        sb2.append("=");
        sb2.append(str2);
        return sb2;
    }

    public static void a() {
        f.a(0, new e(500), b.H() ? PeriodicWorkRequest.MIN_PERIODIC_INTERVAL_MILLIS : 90000);
    }

    public static void a(int i10) {
        if (i10 == 500) {
            synchronized (f45147c) {
                f45151g = null;
                a(!b.F());
                if (g.b(f45151g)) {
                    h.a(f45151g);
                }
            }
        } else if (!f45145a) {
            throw new AssertionError();
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:19:0x0061  */
    /* JADX WARNING: Removed duplicated region for block: B:30:0x0083 A[ADDED_TO_REGION] */
    private static boolean a(boolean z10) {
        int i10;
        boolean z11;
        String str;
        if (f45148d) {
            return false;
        }
        f45148d = !z10;
        if ((a.f45115b.equals("2.0") && b.c(536870912)) || !b.A()) {
            return false;
        }
        String n10 = b.n();
        String a10 = b.a(n10);
        String str2 = null;
        long j2 = 0;
        if (g.b(a10)) {
            String[] split = a10.split(" ", 4);
            if (split.length == 3) {
                str2 = split[0];
                j2 = g.a(split[1], false);
                i10 = (int) g.a(split[2], false);
                f45146b = true;
                if (System.currentTimeMillis() - j2 < 259200000) {
                    if (!"o".equals(str2)) {
                        if (ExifInterface.GPS_MEASUREMENT_2D.equals(str2)) {
                            f45146b = false;
                        } else if ("1".equals(str2)) {
                            f45146b = false;
                        }
                    }
                    z11 = false;
                    if (z11 || z10) {
                        return true;
                    }
                    if (i10 == Process.myPid()) {
                        return false;
                    }
                    f45151g = "per";
                    String g2 = g();
                    if (g2 == null || !g2.contains("retcode=")) {
                        if (g2 == null) {
                            f45151g = "ner";
                        } else {
                            f45151g = "ser";
                        }
                        return false;
                    }
                    if (g2.contains("retcode=0")) {
                        f45146b = true;
                        str = "o";
                        f45151g = "aus";
                    } else {
                        f45146b = false;
                        if ("1".equals(str2)) {
                            str = ExifInterface.GPS_MEASUREMENT_2D;
                            f45151g = "auf2";
                        } else {
                            str = "1";
                            f45151g = "auf1";
                        }
                    }
                    b.a(n10, String.format(Locale.US, "%s %d %d", str, Long.valueOf(System.currentTimeMillis()), Integer.valueOf(Process.myPid())));
                    if (g.b(g2)) {
                        for (String str3 : g2.split("`", 30)) {
                            String[] split2 = str3.split("=", 2);
                            if (split2.length == 2) {
                                String trim = split2[0].trim();
                                String trim2 = split2[1].trim();
                                boolean z12 = g.b(trim2) && trim2.startsWith("http");
                                if ("logurl".equals(trim)) {
                                    if (z12) {
                                        e.b(trim2);
                                    }
                                } else if ("staturl".equals(trim)) {
                                    if (z12) {
                                        h.b(trim2);
                                    }
                                } else if ("policyurl".equals(trim)) {
                                    if (z12) {
                                        synchronized (f45152h) {
                                            f45153i = trim2;
                                            b.a(b.j(), trim2 + "\n");
                                        }
                                    } else {
                                        continue;
                                    }
                                } else if ("logpolicy".equals(trim)) {
                                    e.c(trim2);
                                }
                            }
                        }
                    }
                    return true;
                }
                z11 = true;
                if (z11) {
                }
                return true;
            }
        }
        i10 = 0;
        f45146b = true;
        if (System.currentTimeMillis() - j2 < 259200000) {
        }
        z11 = true;
        if (z11) {
        }
        return true;
    }

    public static String b() {
        try {
            return "inv" + f45150f + "cras" + f45149e;
        } catch (Throwable th) {
            g.b(th);
            return "";
        }
    }

    public static void c() {
        synchronized (f45152h) {
            f45153i = null;
        }
    }

    static byte[] d() {
        return new byte[]{6, 0, BinaryMemcacheOpcodes.QUITQ, 8};
    }

    public static boolean e() {
        try {
            if (!e.F()) {
                if (!b.L()) {
                    a(true);
                    return f45146b;
                }
            }
            return true;
        } catch (Throwable unused) {
        }
    }

    private static String f() {
        String str = f45153i;
        if (g.a(str)) {
            synchronized (f45152h) {
                String str2 = "https://errlog.umeng.com";
                if (g.P()) {
                    str2 = "https://errlogos.umeng.com";
                }
                str = g.a(b.j(), str2 + "/api/crashsdk/validate", true);
                f45153i = str;
            }
        }
        return str;
    }

    private static String g() {
        byte[] bArr;
        String f10;
        byte[] a10;
        byte[] bArr2;
        StringBuilder sb2 = new StringBuilder();
        a(sb2, "platform", g.e());
        a(sb2, "pkgname", a.f45114a);
        a(sb2, UMModuleRegister.PROCESS, e.h());
        a(sb2, ServerProtocol.FALLBACK_DIALOG_PARAM_VERSION, a.a());
        a(sb2, "cver", "3.3.1.1");
        a(sb2, "ctag", "release");
        a(sb2, "inter", g.P() ? ServerProtocol.DIALOG_RETURN_SCOPES_TRUE : "false");
        a(sb2, ak.f45418x, Constants.PLATFORM);
        String sb3 = sb2.toString();
        byte[] bArr3 = new byte[16];
        c.a(bArr3, 0, h.j());
        c.a(bArr3, 4, c.a());
        c.a(bArr3, 8, d());
        c.a(bArr3, 12, a.f());
        try {
            bArr = c.a(sb3.getBytes(), bArr3, true);
        } catch (Throwable th) {
            g.a(th);
            bArr = null;
        }
        if (bArr == null || (f10 = f()) == null || (a10 = c.a(f10, bArr, false)) == null) {
            return null;
        }
        try {
            bArr2 = c.a(a10, bArr3, false);
        } catch (Throwable th2) {
            g.a(th2);
            bArr2 = null;
        }
        if (bArr2 != null) {
            return new String(bArr2);
        }
        return null;
    }
}