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

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: 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..cebb6b4760da79494df283f17b6234a8acd31935 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_BEFROE_REMOVE_DOCUMENT_LAUNCH_MODE = 1;
gone 2017/03/22 22:20:07 BEFORE
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -149,11 +155,15 @@ 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.
- launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | ApiCompatibilityUtils.getActivityNewDocumentFlag());
+ if ((isWebApk && info instanceof WebApkInfo
+ && ((WebApkInfo) info).shellApkVersion()
+ > SHELL_APK_VERSION_BEFROE_REMOVE_DOCUMENT_LAUNCH_MODE)
+ || source == ShortcutSource.NOTIFICATION) {
+ // 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 this is launching from a notification, we want to ensure that the URL being
// launched is the URL in the intent. If a paused WebappActivity exists for this id,
@@ -162,9 +172,10 @@ public class WebappLauncherActivity extends Activity {
// the existing Activity is cleared and relaunched with this intent.
// TODO(dominickn): ideally, we want be able to route an intent to
// WebappActivity.onNewIntent instead of restarting the Activity.
- if (source == ShortcutSource.NOTIFICATION) {
- launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- }
+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ } else {
gone 2017/03/22 22:20:07 You've changed this logic here so that non WebApks
gone 2017/03/22 22:23:28 Well, I can see how this would stay the same logic
+ launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | ApiCompatibilityUtils.getActivityNewDocumentFlag());
}
return launchIntent;
}

Powered by Google App Engine
This is Rietveld 408576698