From a0b3d243cca0eac2fc7def7ef1dcc72276c2b613 Mon Sep 17 00:00:00 2001 From: Brian Nicholson Date: Thu, 24 Apr 2014 12:27:42 -0700 Subject: [PATCH] Bug 999203 - Add a pref to record crashes. r=mfinkle --- mobile/android/base/CrashReporter.java | 1 + mobile/android/base/GeckoApp.java | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/mobile/android/base/CrashReporter.java b/mobile/android/base/CrashReporter.java index d575668b4a66..ea39224f5d89 100644 --- a/mobile/android/base/CrashReporter.java +++ b/mobile/android/base/CrashReporter.java @@ -136,6 +136,7 @@ public class CrashReporter extends Activity SharedPreferences prefs = GeckoSharedPrefs.forApp(this); SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean(GeckoApp.PREFS_WAS_STOPPED, true); + editor.putBoolean(GeckoApp.PREFS_CRASHED, true); editor.commit(); final CheckBox allowContactCheckBox = (CheckBox) findViewById(R.id.allow_contact); diff --git a/mobile/android/base/GeckoApp.java b/mobile/android/base/GeckoApp.java index 058083ceab28..0eb30057c768 100644 --- a/mobile/android/base/GeckoApp.java +++ b/mobile/android/base/GeckoApp.java @@ -157,6 +157,7 @@ public abstract class GeckoApp public static final String PREFS_OOM_EXCEPTION = "OOMException"; public static final String PREFS_VERSION_CODE = "versionCode"; public static final String PREFS_WAS_STOPPED = "wasStopped"; + public static final String PREFS_CRASHED = "crashed"; public static final String PREFS_CLEANUP_TEMP_FILES = "cleanupTempFiles"; public static final String SAVED_STATE_IN_BACKGROUND = "inBackground"; @@ -1772,10 +1773,17 @@ public abstract class GeckoApp shouldRestore = true; } else if (savedInstanceState != null || getSessionRestorePreference().equals("always") || - getRestartFromIntent() || - prefs.getBoolean(GeckoApp.PREFS_WAS_STOPPED, false)) { + getRestartFromIntent()) { // We're coming back from a background kill by the OS, the user - // has chosen to always restore, we restarted, or we crashed. + // has chosen to always restore, or we restarted. + shouldRestore = true; + } else if (prefs.getBoolean(GeckoApp.PREFS_CRASHED, false)) { + ThreadUtils.postToBackgroundThread(new Runnable() { + @Override + public void run() { + prefs.edit().putBoolean(PREFS_CRASHED, false).commit(); + } + }); shouldRestore = true; }