Skip to content

Commit

Permalink
1.9.4版本发布
Browse files Browse the repository at this point in the history
  • Loading branch information
crazysunj committed Feb 15, 2019
1 parent b63cc19 commit 4cc99be
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@
public class CrazyDailyCrashHandler implements Thread.UncaughtExceptionHandler {

private Context context;
private final Thread.UncaughtExceptionHandler mDefaultCrashHandler;

private CrazyDailyCrashHandler(Context context) {
this.context = context;
mDefaultCrashHandler = Thread.getDefaultUncaughtExceptionHandler();
}

private static volatile CrazyDailyCrashHandler sCrashHandler;
Expand All @@ -54,13 +52,14 @@ static void init(Context context) {

/**
* crash退出程序,0.5s后重启
* 如果在系统onCreate前写的代码产生crash,需要特殊处理
*/
@Override
public void uncaughtException(Thread t, Throwable e) {
if (mDefaultCrashHandler != null) {
mDefaultCrashHandler.uncaughtException(t, e);
}
final Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
if (intent != null) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
}
PendingIntent restartIntent = PendingIntent.getActivity(
context, 0, intent,
PendingIntent.FLAG_ONE_SHOT);
Expand Down

0 comments on commit 4cc99be

Please sign in to comment.