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..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()); |