New issue
Advanced search Search tips

Issue 750320 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Intent picker is shown after tapping on notification from PWA

Project Member Reported by pkotw...@chromium.org, Jul 28 2017

Issue description

Repro steps:
1) Disable "Improved Add to Homescreen" in chrome://flags
2) Navigate to https://tests.peter.sh/notification-generator/
3) Tap "Add to Home screen" in the app menu
4) Tap the newly added homescreen icon
5) Change the "Action" <select> to "Only open a new window"
6) Tap the "Display the notification" button
7) Swipe away the webapp in Android Recents
8) Tap the notification

Expected:
The webapp is launched
Actual:
An intent picker is shown which allows me to pick the a browser to handle the intent. After picking a browser the URL is launched in a new tab
 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 9 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/524465a1372efcd98ec44c4ee1fb8cda38e227f4

commit 524465a1372efcd98ec44c4ee1fb8cda38e227f4
Author: Xi Han <hanxi@google.com>
Date: Wed Aug 09 18:12:14 2017

Skip WebAPKs when querying WebappDataStorage for existing legacy Webapps for a URL.

In CL (https://chromium-review.googlesource.com/c/583438), a check of whether
the browser backs the found WebAPK is added in the ServiceTabLauncher when
service worker launches tab. As a result, as long as there is an WebAPK can
handle the URL, ServiceTabLauncher will create an intent to launch a
WebappActivity when Chrome doesn't back the WebAPK.

WebappDataStorage has an incorrect WebappDataStorage#KEY_ACTION for WebAPKs.
WebappDataStorage#KEY_ACTION is populated via
WebappDataStorage#updateFromShortcutIntent(). In the case of webapps,
WebappDataStorage#updateFromShortcutIntent() is initially called with the
WebappLauncherActivity launch intent from ShortcutHelper#addWebapp().
WebappDataStorage#updateFromShortcutIntent() is called with the intent to launch
WebappActivity / WebApkActivity when a WebAPK / webapp is launched. The action for
launching WebappLauncherActivity and for launching WebappActivity are different
(WebappLauncherActivity#ACTION_START_WEBAPP and Intent#ACTION_VIEW respectively). When
using a WebAPK's WebappDataStorage to launch a webapp, Android shows a weird intent
picker because it cannot figure out which app to launch for Intent#ACTION_VIEW
(WebappDataStorage#updateFromShortcutIntent() does not set the target package name and
does not set the data URI)

This CL makes two improvements:
1) Since launching a webapp with an intent generated from WebappDataStorage for a
WebAPK is bad , we skip WebAPKs in WebappDataStorage#getWebappDataStorageForUrl().
The query of Webapps will return the storage of a legacy Webapp if exists.
2) The CL sets the target package name in
WebappDataStorage#getWebappDataStorageForUrl().

Bug:  749084 ,  750320 
Change-Id: I7349fdea9412d9419ed07946ffd42d04d21f2e58
Reviewed-on: https://chromium-review.googlesource.com/590582
Commit-Queue: Xi Han <hanxi@chromium.org>
Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#493056}
[modify] https://crrev.com/524465a1372efcd98ec44c4ee1fb8cda38e227f4/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
[modify] https://crrev.com/524465a1372efcd98ec44c4ee1fb8cda38e227f4/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java
[modify] https://crrev.com/524465a1372efcd98ec44c4ee1fb8cda38e227f4/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java
[modify] https://crrev.com/524465a1372efcd98ec44c4ee1fb8cda38e227f4/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java

Comment 2 by hanxi@chromium.org, Aug 9 2017

Status: Fixed (was: Assigned)

Sign in to add a comment