52 lines
1.5 KiB
Java
52 lines
1.5 KiB
Java
package com.baidu.cloud.media.player.a;
|
|
|
|
import android.content.Context;
|
|
import android.util.Log;
|
|
import java.io.PrintWriter;
|
|
import java.io.StringWriter;
|
|
import java.lang.Thread;
|
|
|
|
/* loaded from: classes.dex */
|
|
class d implements Thread.UncaughtExceptionHandler {
|
|
private static d a = new d();
|
|
private Thread.UncaughtExceptionHandler b = null;
|
|
private Context c = null;
|
|
|
|
private d() {
|
|
}
|
|
|
|
public static d a() {
|
|
return a;
|
|
}
|
|
|
|
public void a(Context context) {
|
|
if (this.b == null) {
|
|
this.b = Thread.getDefaultUncaughtExceptionHandler();
|
|
Thread.setDefaultUncaughtExceptionHandler(this);
|
|
}
|
|
if (this.c == null) {
|
|
this.c = context.getApplicationContext();
|
|
}
|
|
}
|
|
|
|
@Override // java.lang.Thread.UncaughtExceptionHandler
|
|
public void uncaughtException(Thread thread, Throwable th) {
|
|
try {
|
|
StringWriter stringWriter = new StringWriter();
|
|
PrintWriter printWriter = new PrintWriter(stringWriter);
|
|
th.printStackTrace(printWriter);
|
|
printWriter.close();
|
|
String obj = stringWriter.toString();
|
|
if (obj.contains("com.baidu.cloud.media")) {
|
|
b.a(this.c).e(obj);
|
|
}
|
|
} catch (Exception e) {
|
|
Log.d("SDKCrashHandler", "" + e.getMessage());
|
|
}
|
|
if (this.b.equals(this)) {
|
|
return;
|
|
}
|
|
this.b.uncaughtException(thread, th);
|
|
}
|
|
}
|