package p070x0;

import android.os.Build;
import android.os.Trace;
import android.util.Log;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/* renamed from: x0.b */
/* loaded from: classes.dex */
public final class C1805b {

    /* renamed from: a */
    public static long f4521a;

    /* renamed from: b */
    public static Method f4522b;

    /* renamed from: a */
    public static void m370a(String str) {
        if (Build.VERSION.SDK_INT >= 18) {
            C1806c.m365a(str);
        }
    }

    /* renamed from: b */
    public static void m369b() {
        if (Build.VERSION.SDK_INT >= 18) {
            C1806c.m364b();
        }
    }

    /* renamed from: c */
    public static void m368c(String str, Exception exc) {
        if (exc instanceof InvocationTargetException) {
            Throwable cause = exc.getCause();
            if (!(cause instanceof RuntimeException)) {
                throw new RuntimeException(cause);
            }
            throw ((RuntimeException) cause);
        }
        Log.v("Trace", "Unable to call " + str + " via reflection", exc);
    }

    /* renamed from: d */
    public static boolean m367d() {
        boolean isEnabled;
        try {
            if (f4522b == null) {
                isEnabled = Trace.isEnabled();
                return isEnabled;
            }
        } catch (NoClassDefFoundError | NoSuchMethodError unused) {
        }
        return m366e();
    }

    /* renamed from: e */
    public static boolean m366e() {
        if (Build.VERSION.SDK_INT >= 18) {
            try {
                if (f4522b == null) {
                    f4521a = Trace.class.getField("TRACE_TAG_APP").getLong(null);
                    f4522b = Trace.class.getMethod("isTagEnabled", Long.TYPE);
                }
                return ((Boolean) f4522b.invoke(null, Long.valueOf(f4521a))).booleanValue();
            } catch (Exception e) {
                m368c("isTagEnabled", e);
            }
        }
        return false;
    }
}