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

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: Fix on K. 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 64906a676c9cfc65600c40023b17160cce71b088..f22ba58e323f9e7bab811d4195f346b1677fec04 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
@@ -40,6 +40,12 @@ public class WebappLauncherActivity extends Activity {
private static final String TAG = "webapps";
+ /**
+ * We remove android:documentLaunchMode="intoExisting" attribute from WebApkActivity since this
+ * version.
+ */
+ private static final int SHELL_APK_VERSION_BEFORE_REMOVE_DOCUMENT_LAUNCH_MODE = 1;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -149,9 +155,20 @@ 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_CLEAR_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
+ // main activity in the same task stack. See crbug.com/700157.
+ if (((WebApkInfo) info).shellApkVersion()
+ > SHELL_APK_VERSION_BEFORE_REMOVE_DOCUMENT_LAUNCH_MODE) {
+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ } else {
+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | ApiCompatibilityUtils.getActivityNewDocumentFlag());
+ }
+ } else {
launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| ApiCompatibilityUtils.getActivityNewDocumentFlag());

Powered by Google App Engine
This is Rietveld 408576698