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 a232f04b66ad689b7d37309dd32e758ad99464f6..6d86fe2cfa7f4c3d2952793c2ff020feafe079be 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 |
| @@ -196,19 +196,19 @@ public class WebappLauncherActivity extends Activity { |
| launchIntent.setData(Uri.parse(WebappActivity.WEBAPP_SCHEME + "://" + info.id())); |
| launchIntent.setFlags( |
| Intent.FLAG_ACTIVITY_NEW_TASK | ApiCompatibilityUtils.getActivityNewDocumentFlag()); |
| - |
| - if (!isWebApk) { |
| - // 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, |
| - // then by default it will be focused and we have no way of sending the desired URL to |
| - // it (the intent is swallowed). As a workaround, set the CLEAR_TOP flag to ensure that |
| - // 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) { |
|
pkotwicz
2017/05/26 05:13:01
Given that this CL was reverted (not by me!) it is
piotrs
2017/05/26 05:39:31
Done.
|
| - launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); |
| - } |
| - } |
| + // Setting FLAG_ACTIVITY_CLEAR_TOP handles 2 edge cases: |
| + // - If a legacy PWA 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, |
| + // then by default it will be focused and we have no way of sending the desired URL to |
| + // it (the intent is swallowed). As a workaround, set the CLEAR_TOP flag to ensure that |
| + // the existing Activity is cleared and relaunched with this intent. |
| + // - If a WebAPK is having a CustomTabActivity on top of it in the same Task, and user |
| + // clicks a link to takes them back to the scope of a WebAPK, we want to destroy the |
| + // CustomTabActivity activity and go back to the WebAPK activity. It is intentional that |
| + // Custom Tab will not be reachable with a back button. |
| + // TODO(dominickn): ideally, we want be able to route an intent to onNewIntent() instead of |
| + // restarting the Activity. |
| + launchIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); |
| return launchIntent; |
| } |