Bug 905371 - Remove session restore pref. r=mfinkle a=lsblakk
☠☠ backed out by 674c5378780c ☠ ☠
authorBrian Nicholson <bnicholson@mozilla.com>
Mon, 26 Aug 2013 16:05:31 -0700
changeset 153879 98feaf977ea2e12662d314f3616a82acecf2f239
parent 153878 7c2b0341e3ded6991b7f6114ed52886620933313
child 153880 674c5378780cff63c3f3a77b5a4f1b8df78edb8c
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, lsblakk
bugs905371
milestone25.0a2
Bug 905371 - Remove session restore pref. r=mfinkle a=lsblakk
mobile/android/base/GeckoApp.java
mobile/android/base/GeckoPreferences.java
mobile/android/base/resources/xml-v11/preferences_customize.xml
mobile/android/base/resources/xml-v11/preferences_customize_tablet.xml
mobile/android/base/resources/xml/preferences_customize.xml
--- a/mobile/android/base/GeckoApp.java
+++ b/mobile/android/base/GeckoApp.java
@@ -1654,17 +1654,16 @@ abstract public class GeckoApp
             mProfile = GeckoProfile.get(this);
         }
         return mProfile;
     }
 
     protected int getSessionRestoreState(Bundle savedInstanceState) {
         final SharedPreferences prefs = GeckoApp.getAppSharedPreferences();
         int restoreMode = RESTORE_NONE;
-        boolean allowCrashRestore = true;
 
         // If the version has changed, the user has done an upgrade, so restore
         // previous tabs.
         final int versionCode = getVersionCode();
         if (prefs.getInt(PREFS_VERSION_CODE, 0) != versionCode) {
             ThreadUtils.postToBackgroundThread(new Runnable() {
                 @Override
                 public void run() {
@@ -1672,46 +1671,33 @@ abstract public class GeckoApp
                          .putInt(PREFS_VERSION_CODE, versionCode)
                          .commit();
                 }
             });
 
             restoreMode = RESTORE_NORMAL;
         } else if (savedInstanceState != null) {
             restoreMode = RESTORE_NORMAL;
-        } else {
-            String restorePref = PreferenceManager.getDefaultSharedPreferences(this)
-                                                  .getString(GeckoPreferences.PREFS_RESTORE_SESSION, "crash");
-            if ("always".equals(restorePref)) {
-                restoreMode = RESTORE_NORMAL;
-            } else {
-                restoreMode = RESTORE_NONE;
-                if ("never".equals(restorePref)) {
-                    allowCrashRestore = false;
-                }
-            }
         }
 
         // We record crashes in the crash reporter. If sessionstore.js
         // exists, but we didn't flag a crash in the crash reporter, we
         // were probably just force killed by the user, so we shouldn't do
         // a restore.
         if (prefs.getBoolean(PREFS_CRASHED, false)) {
             ThreadUtils.postToBackgroundThread(new Runnable() {
                 @Override
                 public void run() {
                     prefs.edit()
                          .putBoolean(PREFS_CRASHED, false)
                          .commit();
                 }
             });
 
-            if (allowCrashRestore) {
-                restoreMode = RESTORE_CRASH;
-            }
+            restoreMode = RESTORE_CRASH;
         }
 
         return restoreMode;
     }
 
     /**
      * Enable Android StrictMode checks (for supported OS versions).
      * http://developer.android.com/reference/android/os/StrictMode.html
--- a/mobile/android/base/GeckoPreferences.java
+++ b/mobile/android/base/GeckoPreferences.java
@@ -72,18 +72,16 @@ public class GeckoPreferences
     private static String PREFS_CRASHREPORTER_ENABLED = "datareporting.crashreporter.submitEnabled";
     private static String PREFS_MENU_CHAR_ENCODING = "browser.menu.showCharacterEncoding";
     private static String PREFS_MP_ENABLED = "privacy.masterpassword.enabled";
     private static String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload";
     private static String PREFS_GEO_REPORTING = "app.geo.reportdata";
     private static String PREFS_HEALTHREPORT_LINK = NON_PREF_PREFIX + "healthreport.link";
     private static String PREFS_DEVTOOLS_REMOTE_ENABLED = "devtools.debugger.remote-enabled";
 
-    public static String PREFS_RESTORE_SESSION = NON_PREF_PREFIX + "restoreSession2";
-
     // These values are chosen to be distinct from other Activity constants.
     private static int REQUEST_CODE_PREF_SCREEN = 5;
     private static int RESULT_CODE_EXIT_SETTINGS = 6;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         // For fragment-capable devices, display the default fragment if no explicit fragment to show.
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB &&
@@ -316,25 +314,16 @@ public class GeckoPreferences
                         public boolean onPreferenceClick(Preference preference) {
                             // Display toast to remind setting up tcp forwarding.
                             if (((CheckBoxPreference) preference).isChecked()) {
                                 Toast.makeText(thisContext, R.string.devtools_remote_debugging_forward, Toast.LENGTH_SHORT).show();
                             }
                             return true;
                         }
                     });
-                } else if (PREFS_RESTORE_SESSION.equals(key)) {
-                    // Set the summary string to the current entry. The summary
-                    // for other list prefs will be set in the PrefsHelper
-                    // callback, but since this pref doesn't live in Gecko, we
-                    // need to handle it separately.
-                    ListPreference listPref = (ListPreference) pref;
-                    CharSequence selectedEntry = listPref.getEntry();
-                    listPref.setSummary(selectedEntry);
-                    continue;
                 }
 
                 // Some Preference UI elements are not actually preferences,
                 // but they require a key to work correctly. For example,
                 // "Clear private data" requires a key for its state to be
                 // saved when the orientation changes. It uses the
                 // "android.not_a_preference.privacy.clear" key - which doesn't
                 // exist in Gecko - to satisfy this requirement.
--- a/mobile/android/base/resources/xml-v11/preferences_customize.xml
+++ b/mobile/android/base/resources/xml-v11/preferences_customize.xml
@@ -20,23 +20,16 @@
                   gecko:entries="@array/pref_import_android_entries"
                   gecko:entryKeys="@array/pref_import_android_keys"
                   gecko:initialValues="@array/pref_import_android_values"
                   android:title="@string/pref_import_android"
                   android:positiveButtonText="@string/bookmarkhistory_button_import"
                   android:negativeButtonText="@string/button_cancel"
                   android:persistent="false" />
 
-    <ListPreference android:key="android.not_a_preference.restoreSession2"
-                    android:title="@string/pref_restore"
-                    android:defaultValue="crash"
-                    android:entries="@array/pref_restore_entries"
-                    android:entryValues="@array/pref_restore_values"
-                    android:persistent="true" />
-
    <ListPreference android:key="app.update.autodownload"
                    android:title="@string/pref_update_autodownload"
                    android:entries="@array/pref_update_autodownload_entries"
                    android:entryValues="@array/pref_update_autodownload_values"
                    android:persistent="false" />
 
 </PreferenceScreen>
 
--- a/mobile/android/base/resources/xml-v11/preferences_customize_tablet.xml
+++ b/mobile/android/base/resources/xml-v11/preferences_customize_tablet.xml
@@ -25,23 +25,16 @@
             android:negativeButtonText="@string/button_cancel"
             android:persistent="false" />
 
     <CheckBoxPreference android:key="browser.search.suggest.enabled"
                         android:title="@string/pref_search_suggestions"
                         android:defaultValue="true"
                         android:persistent="false" />
 
-    <ListPreference android:key="android.not_a_preference.restoreSession2"
-                    android:title="@string/pref_restore"
-                    android:defaultValue="crash"
-                    android:entries="@array/pref_restore_entries"
-                    android:entryValues="@array/pref_restore_values"
-                    android:persistent="true" />
-
     <ListPreference android:key="app.update.autodownload"
                     android:title="@string/pref_update_autodownload"
                     android:entries="@array/pref_update_autodownload_entries"
                     android:entryValues="@array/pref_update_autodownload_values"
                     android:persistent="false" />
 
 </PreferenceScreen>
 
--- a/mobile/android/base/resources/xml/preferences_customize.xml
+++ b/mobile/android/base/resources/xml/preferences_customize.xml
@@ -17,23 +17,16 @@
                   android:negativeButtonText="@string/button_cancel"
                   android:persistent="false" />
 
     <CheckBoxPreference android:key="browser.search.suggest.enabled"
                         android:title="@string/pref_search_suggestions"
                         android:defaultValue="false"
                         android:persistent="false" />
 
-    <ListPreference android:key="android.not_a_preference.restoreSession2"
-                    android:title="@string/pref_restore"
-                    android:defaultValue="crash"
-                    android:entries="@array/pref_restore_entries"
-                    android:entryValues="@array/pref_restore_values"
-                    android:persistent="true" />
-
    <ListPreference android:key="app.update.autodownload"
                    android:title="@string/pref_update_autodownload"
                    android:entries="@array/pref_update_autodownload_entries"
                    android:entryValues="@array/pref_update_autodownload_values"
                    android:persistent="false" />
 
 </PreferenceScreen>