From 0d1e816757f6e7320c3416fdd049056f6f1a158d Mon Sep 17 00:00:00 2001 From: James Willcox Date: Wed, 22 Aug 2018 10:07:05 -0500 Subject: [PATCH] Bug 1485382 - Show Fennec crash reporter immediately from CrashReporterService r=jchen --- .../mozilla/gecko/CrashReporterService.java | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashReporterService.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashReporterService.java index 6ca3d840a47b..53eb3de1bd4a 100644 --- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashReporterService.java +++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashReporterService.java @@ -65,25 +65,30 @@ public class CrashReporterService extends JobIntentService { return; } - Class reporterActivityCls = getFennecReporterActivity(); - if (reporterActivityCls != null) { - intent.setClass(this, reporterActivityCls); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); - return; - } - submitCrash(intent); } @Override public int onStartCommand(@Nullable Intent intent, int flags, int startId) { + Class reporterActivityCls = getFennecReporterActivity(); + if (reporterActivityCls != null) { + intent.setClass(this, reporterActivityCls); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + + // Exit now so we don't trigger an ANR + System.exit(0); + } + // When running on pre-O devices the work will be dispatched to onHandleWork() automatically // When running on Oreo and later devices we will enqueue the work for the JobIntentService to perform if (Build.VERSION.SDK_INT >= 26) { // Only when the system restarts the service because of Service.START_STICKY // the intent will be null. So the intent is safe to be passed to the JobIntentService. enqueueWork(this, intent); + + // Exit now so we don't trigger an ANR + System.exit(0); } return super.onStartCommand(intent, flags, startId);