New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 594872 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Apr 2016
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Feature

Blocking:
issue 541711



Sign in to add a comment

Refactor homescreen launch data so webapps can be launched without the homescreen intent

Project Member Reported by dominickn@chromium.org, Mar 15 2016

Issue description

Homescreen shortcuts on Android contain several properties which are required to launch the app from homescreen (e.g. theme/background color). WebappActivity assumes that these properties are in the launch intent when it runs. This structure means that launching webapps from sources other than the homescreen (e.g. a notification) won't work correctly; at best, there will be some visual inconsistencies. The root problem is that Android does not have an API for querying shortcuts on the home screen after they have been added.

The data in the homescreen intent should be copied to the WebappDataStorage structure on first launch from homescreen. This will all non-homescreen sources to construct an intent for launching as a webapp by querying the storage.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Apr 6 2016

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

commit 6509a4deca126b49eb9121fefedcfc092dee0631
Author: dominickn <dominickn@chromium.org>
Date: Wed Apr 06 08:29:06 2016

Store standalone web app data in WebappDataStorage as well as the homescreen intent.

Homescreen launch intents for standalone web apps on Android contain
several properties which WebappActivity requires to launch the app in
the web frame (e.g. icon, names, theme/background color). This structure
means that launching webapps from sources other than the homescreen
(e.g. a notification) won't work. The root problem is that Android does
not have an API for querying shortcuts on the home screen after they
have been added.

This CL mirrors the homescreen intent data into Android Shared
Preferences via WebappDataStorage, and refactors how homescreen launch
intents for standalone apps are created. Standalone web apps added to
homescreen before this CL will have their data copied into a
WebappDataStorage when they are next launched. A new scope field is
computed from the URL to identify the URLs over which a web app may
control. This CL enables Chrome to launch a web app to standalone
mode without the homescreen intent.

The semantics of WebappDataStorage have also changed. Now, the only
correct way to access a WebappDataStorage is via the WebappRegistry.
New methods to access storage objects have been added to the registry,
and all clients should use these.

The existing WebappDataStorage expiry mechanism is maintained in this
CL, ensuring that web apps which have not been launched recently will
have their stored data removed. Additionally, URLs, scopes, and last
access times are purged when the user clears history.

Additional and updated tests for this functionality are also added.

BUG= 594872 

Review URL: https://codereview.chromium.org/1845233002

Cr-Commit-Position: refs/heads/master@{#385402}

[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/BUILD.gn
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/java/src/org/chromium/chrome/browser/ShortcutHelper.java
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTestBase.java
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappModeTest.java
[add] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/junit/src/org/chromium/chrome/browser/ShortcutHelperTest.java
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/browser/android/banners/app_banner_data_fetcher_android.cc
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/browser/android/banners/app_banner_data_fetcher_android.h
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/browser/android/banners/app_banner_infobar_delegate_android.cc
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/browser/android/shortcut_helper.cc
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/browser/android/shortcut_helper.h
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.h
[modify] https://crrev.com/6509a4deca126b49eb9121fefedcfc092dee0631/chrome/browser/android/webapps/add_to_homescreen_dialog_helper.cc

Project Member

Comment 2 by bugdroid1@chromium.org, Apr 8 2016

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

commit 1ce7d2f020a7452bd0399dd50e4580981deeb4dd
Author: dominickn <dominickn@chromium.org>
Date: Fri Apr 08 03:10:04 2016

Enable deep-linking from notifications for recently used web apps on the Android home screen.

This CL permits notifications pointing to a recently used,
standalone-capable web app on the Android home screen to open in the
standalone web frame.

The web app must be added to home screen, capable of opening in
standalone mode, and have been opened from the home screen within the
last ten days. If any of these conditions are not met, the notification
will fall back to the existing behaviour.

The search for a matching web app is conducted by comparing the URL
which the notification is asking to be opened with the scope of all web
apps known to Chromium. The scope for a web app is its URL, minus the
final component of its path, any query parameters, and any fragments.
A future CL will implement the manifest scope property, which will
replace this estimated scope. The web app with the longest scope that
matches the URL to be opened is chosen.

Additional tests for the scoped search are added in this CL. A new
shortcut source is added to indicate launches from a notification, and
the WebappRegistry is updated to not change the last updated time of web
app data which has not been opened from the home screen. This is
necessary to ensure web apps cannot spam the user with notifications to
update their last used time and hence how long Chromium will cache their
app data.

BUG= 541711 , 594872 
R=dfalcantara

Review URL: https://codereview.chromium.org/1867543002

Cr-Commit-Position: refs/heads/master@{#385967}

[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/android/java/src/org/chromium/chrome/browser/ChromeServiceTabLauncher.java
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/TabDelegate.java
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappRegistry.java
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/android/javatests/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferencesTest.java
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDataStorageTest.java
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappRegistryTest.java
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/chrome/browser/android/shortcut_info.h
[modify] https://crrev.com/1ce7d2f020a7452bd0399dd50e4580981deeb4dd/tools/metrics/histograms/histograms.xml

Status: Fixed (was: Assigned)

Sign in to add a comment