Commit 0bf2743d authored by twellington's avatar twellington Committed by Commit bot

Use task id to determine if Preferences should be finished

Use the taskId rather to determine if finish() should be called
on Preferences. Previously, if a user navigated in Preferences,
sResumedInstance got set to the sub-Preference and the main
Preference got finished. Since they belong to the same task, this
shouldn't happen.

BUG=652572

Review-Url: https://codereview.chromium.org/2386213004
Cr-Commit-Position: refs/heads/master@{#422862}
parent af7cc2f1
......@@ -157,13 +157,16 @@ 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 && sResumedInstance != this && !mIsNewlyCreated) {
if (sResumedInstance != null && sResumedInstance.getTaskId() != getTaskId()
&& !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 != this) sResumedInstance.finish();
if (sResumedInstance != null && sResumedInstance.getTaskId() != getTaskId()) {
sResumedInstance.finish();
}
sResumedInstance = this;
mIsNewlyCreated = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment