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

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

Issue 2762873003: Fix: long-tapping a WebAPK in recents shows Chrome.
Patch Set: Change back to CLEAR_TOP flag. Created 3 years, 9 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
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..e191095fa096a84b222711c92d4bbbe7817243b7 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
@@ -39,6 +39,12 @@ public class WebappLauncherActivity extends Activity {
public static final String ACTION_START_WEBAPP =
"com.google.android.apps.chrome.webapps.WebappManager.ACTION_START_WEBAPP";
+ /**
+ * We remove android:documentLaunchMode="intoExisting" attribute from WebApkActivity since this
+ * version.
+ */
+ private static final int SHELL_APK_VERSION_BEFORE_REMOVE_DOCUMENT_LAUNCH_MODE = 1;
+
private static final String TAG = "webapps";
@Override
@@ -150,9 +156,21 @@ public class WebappLauncherActivity extends Activity {
launchIntent.setAction(Intent.ACTION_VIEW);
launchIntent.setData(Uri.parse(WebappActivity.WEBAPP_SCHEME + "://" + info.id()));
- if (!isWebApk) {
- // For WebAPK, we don't start a new task for WebApkActivity, it is just on top
- // of the WebAPK's main activity and in the same task.
+ if (isWebApk && info instanceof WebApkInfo) {
+ // Since shell APK version 2, we removes the android:documentLaunchMode="intoExisting"
+ // attribute from WebApkActivity. Instead, flag {@link FLAG_ACTIVITY_SINGLE_TOP} is used
+ // to deliver this intent to the WebApkActivity instance if it is already running on the
+ // top of the stack via onNewIntent(). WebApkActivity should be on top of the WebAPK's
+ // {@link ShellActivity} in the same task stack on L+. See crbug.com/700157.
+ if ((((WebApkInfo) info).shellApkVersion()
+ > SHELL_APK_VERSION_BEFORE_REMOVE_DOCUMENT_LAUNCH_MODE)
+ && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)) {
+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ } else {
+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
Yaron 2017/03/29 14:07:33 doesn't this change behaviour pre-L? We didn't use
Xi Han 2017/03/29 15:16:43 Rewrite the logic here to make the skd version che
+ | ApiCompatibilityUtils.getActivityNewDocumentFlag());
+ }
+ } else {
launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| ApiCompatibilityUtils.getActivityNewDocumentFlag());

Powered by Google App Engine
This is Rietveld 408576698