Files
rr3-apk/decompiled-community/sources/androidx/core/os/TraceCompat.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- Added realracing3-community.apk (71.57 MB)
- Removed 32-bit support (armeabi-v7a)
- Only includes arm64-v8a libraries
- Decompiled source code included
- Added README-community.md with analysis
2026-02-18 15:48:36 -08:00

111 lines
3.4 KiB
Java

package androidx.core.os;
import android.os.Build;
import android.os.Trace;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import java.lang.reflect.Method;
@Deprecated
/* loaded from: classes.dex */
public final class TraceCompat {
private static final String TAG = "TraceCompat";
private static Method sAsyncTraceBeginMethod;
private static Method sAsyncTraceEndMethod;
private static Method sIsTagEnabledMethod;
private static Method sTraceCounterMethod;
private static long sTraceTagApp;
static {
if (Build.VERSION.SDK_INT < 29) {
try {
sTraceTagApp = Trace.class.getField("TRACE_TAG_APP").getLong(null);
Class cls = Long.TYPE;
sIsTagEnabledMethod = Trace.class.getMethod("isTagEnabled", cls);
Class cls2 = Integer.TYPE;
sAsyncTraceBeginMethod = Trace.class.getMethod("asyncTraceBegin", cls, String.class, cls2);
sAsyncTraceEndMethod = Trace.class.getMethod("asyncTraceEnd", cls, String.class, cls2);
sTraceCounterMethod = Trace.class.getMethod("traceCounter", cls, String.class, cls2);
} catch (Exception unused) {
}
}
}
public static boolean isEnabled() {
if (Build.VERSION.SDK_INT >= 29) {
return Api29Impl.isEnabled();
}
try {
return ((Boolean) sIsTagEnabledMethod.invoke(null, Long.valueOf(sTraceTagApp))).booleanValue();
} catch (Exception unused) {
return false;
}
}
public static void beginSection(@NonNull String str) {
Trace.beginSection(str);
}
public static void endSection() {
Trace.endSection();
}
public static void beginAsyncSection(@NonNull String str, int i) {
if (Build.VERSION.SDK_INT >= 29) {
Api29Impl.beginAsyncSection(str, i);
} else {
try {
sAsyncTraceBeginMethod.invoke(null, Long.valueOf(sTraceTagApp), str, Integer.valueOf(i));
} catch (Exception unused) {
}
}
}
public static void endAsyncSection(@NonNull String str, int i) {
if (Build.VERSION.SDK_INT >= 29) {
Api29Impl.endAsyncSection(str, i);
} else {
try {
sAsyncTraceEndMethod.invoke(null, Long.valueOf(sTraceTagApp), str, Integer.valueOf(i));
} catch (Exception unused) {
}
}
}
public static void setCounter(@NonNull String str, int i) {
if (Build.VERSION.SDK_INT >= 29) {
Api29Impl.setCounter(str, i);
} else {
try {
sTraceCounterMethod.invoke(null, Long.valueOf(sTraceTagApp), str, Integer.valueOf(i));
} catch (Exception unused) {
}
}
}
private TraceCompat() {
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
public static boolean isEnabled() {
return Trace.isEnabled();
}
public static void endAsyncSection(String str, int i) {
Trace.endAsyncSection(str, i);
}
public static void beginAsyncSection(String str, int i) {
Trace.beginAsyncSection(str, i);
}
public static void setCounter(String str, long j) {
Trace.setCounter(str, j);
}
}
}