Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/Preferences.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/Preferences.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/Preferences.java |
index 06ecba30fc44d10df6ec878eab752ea0e76e3eb4..6cd85f0dfb04e04c65d4031f0469df921db7bdd4 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/Preferences.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/Preferences.java |
@@ -157,13 +157,14 @@ public class Preferences extends AppCompatActivity implements |
// Prevent the user from interacting with multiple instances of Preferences at the same time |
// (e.g. in multi-instance mode on a Samsung device), which would cause many fun bugs. |
- if (sResumedInstance != null && !mIsNewlyCreated) { |
+ if (sResumedInstance != null && sResumedInstance != this && !mIsNewlyCreated) { |
// This activity was unpaused or recreated while another instance of Preferences was |
// already showing. The existing instance takes precedence. |
finish(); |
} else { |
// This activity was newly created and takes precedence over sResumedInstance. |
- if (sResumedInstance != null) sResumedInstance.finish(); |
+ if (sResumedInstance != null && sResumedInstance != this) sResumedInstance.finish(); |
+ |
sResumedInstance = this; |
mIsNewlyCreated = false; |
} |
@@ -172,10 +173,15 @@ public class Preferences extends AppCompatActivity implements |
@Override |
protected void onPause() { |
super.onPause(); |
- if (sResumedInstance == this) sResumedInstance = null; |
ChromeApplication.flushPersistentData(); |
} |
+ @Override |
+ protected void onStop() { |
+ super.onStop(); |
+ if (sResumedInstance == this) sResumedInstance = null; |
+ } |
+ |
/** |
* Returns the fragment showing as this activity's main content, typically a PreferenceFragment. |
* This does not include DialogFragments or other Fragments shown on top of the main content. |