Files
rr3-apk/decompiled/sources/com/github/anrwatchdog/ANRError.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

67 lines
2.3 KiB
Java

package com.github.anrwatchdog;
import android.os.Looper;
import com.github.anrwatchdog.ANRError$$;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
/* loaded from: classes2.dex */
public class ANRError extends Error {
private static final long serialVersionUID = 1;
public final long duration;
public ANRError(ANRError$$._Thread _thread, long j) {
super("Application Not Responding for at least " + j + " ms.", _thread);
this.duration = j;
}
@Override // java.lang.Throwable
public Throwable fillInStackTrace() {
setStackTrace(new StackTraceElement[0]);
return this;
}
public static ANRError New(long j, String str, boolean z) {
final Thread thread = Looper.getMainLooper().getThread();
TreeMap treeMap = new TreeMap(new Comparator() { // from class: com.github.anrwatchdog.ANRError.1
@Override // java.util.Comparator
public int compare(Thread thread2, Thread thread3) {
if (thread2 == thread3) {
return 0;
}
Thread thread4 = thread;
if (thread2 == thread4) {
return 1;
}
if (thread3 == thread4) {
return -1;
}
return thread3.getName().compareTo(thread2.getName());
}
});
for (Map.Entry<Thread, StackTraceElement[]> entry : Thread.getAllStackTraces().entrySet()) {
if (entry.getKey() == thread || (entry.getKey().getName().startsWith(str) && (z || entry.getValue().length > 0))) {
treeMap.put(entry.getKey(), entry.getValue());
}
}
if (!treeMap.containsKey(thread)) {
treeMap.put(thread, thread.getStackTrace());
}
ANRError$$._Thread _thread = null;
for (Map.Entry entry2 : treeMap.entrySet()) {
_thread = new ANRError$$._Thread(_thread);
}
return new ANRError(_thread, j);
}
public static ANRError NewMainOnly(long j) {
Thread thread = Looper.getMainLooper().getThread();
return new ANRError(new ANRError$$._Thread(null), j);
}
public static String getThreadTitle(Thread thread) {
return thread.getName() + " (state = " + thread.getState() + ")";
}
}