h.java 源代码


package com.apm.insight;

import android.annotation.SuppressLint;
import android.app.Application;
import android.content.Context;
import com.apm.insight.runtime.ConfigManager;
import com.apm.insight.runtime.t;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;

public final class h {

    private static Context f6475a = null;

    private static Application f6476b = null;

    private static long f6477c = 0;

    private static String f6478d = "default";

    private static boolean f6479e;

    @SuppressLint({"StaticFieldLeak"})
    private static com.apm.insight.runtime.d f6480f;

    private static volatile ConcurrentHashMap<Integer, String> f6483i;

    private static volatile String f6488n;

    private static ConfigManager f6481g = new ConfigManager();

    private static a f6482h = new a();

    private static t f6484j = null;

    private static volatile String f6485k = null;

    private static Object f6486l = new Object();

    private static volatile int f6487m = 0;

    private static int f6489o = 0;

    public static com.apm.insight.runtime.d a() {
        if (f6480f == null) {
            f6480f = com.apm.insight.runtime.i.a(f6475a);
        }
        return f6480f;
    }

    public static a b() {
        return f6482h;
    }

    public static t c() {
        if (f6484j == null) {
            synchronized (h.class) {
                f6484j = new t(f6475a);
            }
        }
        return f6484j;
    }

    public static boolean d() {
        if (i().isDebugMode() && n().contains("local_test")) {
            return true;
        }
        return false;
    }

    public static String e() {
        return f() + '_' + Long.toHexString(new Random().nextLong()) + "G";
    }

    public static String f() {
        if (f6485k == null) {
            synchronized (f6486l) {
                if (f6485k == null) {
                    f6485k = Long.toHexString(new Random().nextLong()) + "U";
                }
            }
        }
        return f6485k;
    }

    public static Context g() {
        return f6475a;
    }

    public static Application h() {
        return f6476b;
    }

    public static ConfigManager i() {
        return f6481g;
    }

    public static long j() {
        return f6477c;
    }

    public static String k() {
        return f6478d;
    }

    public static int l() {
        return f6489o;
    }

    public static boolean m() {
        return f6479e;
    }

    public static String n() {
        Object obj = a().a().get("channel");
        if (obj == null) {
            return "unknown";
        }
        return String.valueOf(obj);
    }

    public static ConcurrentHashMap<Integer, String> o() {
        return f6483i;
    }

    public static int p() {
        return f6487m;
    }

    public static String q() {
        return f6488n;
    }

    public static String a(long j6, CrashType crashType, boolean z6, boolean z7) {
        StringBuilder sb = new StringBuilder();
        sb.append(j6);
        sb.append("_");
        sb.append(crashType.getName());
        sb.append('_');
        sb.append(f());
        sb.append('_');
        sb.append(z6 ? "oom_" : "normal_");
        sb.append(j());
        sb.append('_');
        sb.append(z7 ? "ignore_" : "normal_");
        sb.append(Long.toHexString(new Random().nextLong()));
        sb.append("G");
        return sb.toString();
    }

    public static void b(int i6, String str) {
        f6487m = i6;
        f6488n = str;
    }

    public static void a(int i6) {
        f6489o = i6;
    }

    public static void a(int i6, String str) {
        if (f6483i == null) {
            synchronized (h.class) {
                if (f6483i == null) {
                    f6483i = new ConcurrentHashMap<>();
                }
            }
        }
        f6483i.put(Integer.valueOf(i6), str);
    }

    public static void a(Application application) {
        if (application != null) {
            f6476b = application;
        }
    }

    public static void a(Application application, Context context) {
        if (f6476b == null) {
            f6477c = System.currentTimeMillis();
            f6475a = context;
            f6476b = application;
            f6485k = Long.toHexString(new Random().nextLong()) + "G";
        }
    }

    public static void a(Application application, Context context, ICommonParams iCommonParams) {
        a(application, context);
        f6480f = new com.apm.insight.runtime.d(f6475a, iCommonParams, a());
    }

    public static void a(com.apm.insight.runtime.d dVar) {
        f6480f = dVar;
    }

    public static void a(String str) {
        f6478d = str;
    }

    public static void a(boolean z6) {
        f6479e = z6;
    }
}