Chromium Code Reviews| 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..cbe128826cb535934552febd0460cae9dac5f8c4 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,24 @@ 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) { |
| + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
| + if (((WebApkInfo) info).shellApkVersion() |
| + > SHELL_APK_VERSION_BEFORE_REMOVE_DOCUMENT_LAUNCH_MODE) { |
|
gone
2017/03/29 18:48:41
This conditional logic should be a method on the W
|
| + // 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 RecentsPlaceholderActivity} in the same task stack on L+. See |
| + // crbug.com/700157. |
| + 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()); |