Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(446)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java

Issue 2791383002: Fix Incorrect webapp behavior on Kitkat when reusing old WebappActivity. (Closed)
Patch Set: Nits. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
index d6f74bcde7396435f410b9c4333ca0b24ad235da..254a3c01086eced6705b77be521e2dcd7a7b0e6d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
@@ -138,6 +138,21 @@ public class WebappLauncherActivity extends Activity {
? ActivityAssigner.WEBAPK_NAMESPACE : ActivityAssigner.WEBAPP_NAMESPACE;
int activityIndex = ActivityAssigner.instance(namespace).assign(info.id());
activityName += String.valueOf(activityIndex);
+
+ // Finishes the old activity if it has been assigned to a different WebappActivity. See
+ // crbug.com/702998.
+ for (WeakReference<Activity> activityRef : ApplicationStatus.getRunningActivities()) {
+ Activity activity = activityRef.get();
+ if (!(activity instanceof WebappActivity)
+ || !activity.getClass().getName().equals(activityName)) {
+ continue;
+ }
+ WebappActivity webappActivity = (WebappActivity) activity;
+ if (!TextUtils.equals(webappActivity.mWebappInfo.id(), info.id())) {
+ activity.finish();
+ }
+ break;
+ }
}
// Create an intent to launch the Webapp in an unmapped WebappActivity.
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698