New issue
Advanced search Search tips

Issue 711147 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner: ----
Closed: May 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 1
Type: Bug

Blocked on:
issue 691739



Sign in to add a comment

Correctly record WebAPK install source for Launch.HomescreenSource

Project Member Reported by dominickn@chromium.org, Apr 13 2017

Issue description

Currently, WebAPKs drop the ShortcutInfo::Source that's set by the installability code once installed. This means that we can't distinguish between WebAPKs added via the banner versus WebAPKs added via the add to homescreen menu item in the Launch.HomescreenSource metric.

Having this distinction is important as this metric tells us how often users actually use the shortcuts (in contrast to metrics like InstallSource, which tell us how often the shortcuts are added). Given that banners are automatically offered to users, having a metric recording the proportion of launches from banner-sourced WebAPKs is an important data point for assessing their usefulness.

One possible way of solving this is to store the source int in the Android Manifest that's generated for the WebAPK. This could then be read out and set in MainActivity.java so that WebappLauncherActivity correctly receives the right source. The downside is that the Manifest will differ for a WebAPK that's added via the menu item versus added from a banner (and also potentially differ for different browsers).

pkotwicz@, do you have comments on any other potential downsides or solutions here?
 
Cc: hartma...@chromium.org
CCing the server folks

This is a particularly complicated issue.

Making the change that you suggest means that:
- A user who installs a WebAPK for airhorner.com via the app menu will get a different WebAPK than a user who installs airhorner.com via the banner
- When a WebAPK auto updates it needs to pass information on how it got created to the WebAPK server

From a cross browser perspective, it might be useful to add a "launch_extras" field to the proto sent to the WebAPK server. The extras will be stored as <meta-data> tags in the AndroidManifest.xml and will be sent in the browser launch intent. This is scary because this might produce an explosion of WebAPK flavors for a single page URL

The best solution might involve WebappDataStorage. It is possible for a user to clear Chrome's data. However, storing the source in WebappDataStorage should be able to answer: "Did the user ever launch the WebAPK that they installed?". For the sake of clarity, I am suggesting storing how the WebAPK got created into WebappDataStorage at creation time

Comment 2 by hanxi@chromium.org, Apr 13 2017

Agreed with Peter, storing how the WebAPK got created into WebappDataStorage or other place in Chrome's SharedPreference would be better than in the WebAPK's meta data. We only store these critical data without which will give a bad first time user experience if Chrome's data is cleaned. The "source" property doesn't cause bad user experience like missing "host browser", "background color" etc., so I don't suggest to store it in the APK. We are very careful when adding new meta data in AndroidManifest, since the two versions of Source will double the total number of WebAPKs that we need to cache in the WebAPK server, and in the Play store in the future.
Cc: yfried...@chromium.org
I agree with Peter & Xi - this should not be part of the manifest. We should cache it and best effort populate the source field. We could introduce a new entry which is WebAPK & Unknown installation source and only use it in the case of user clearing data which should be quite rare. wdyt?

Comment 4 by hanxi@chromium.org, Apr 25 2017

Components: Mobile>WebAPKs
Dominick, thoughts? We're pretty confident that we should do best effort in shared pref as opposed to baking it into the webapk
Sorry for the delay in response. I'm totally happy with adding this to WebappDataStorage (we may need to eagerly create it), and fall back to an explicitly WebAPK-only "Unknown" source if the storage is cleared. That should ensure:

 - we have a best case source
 - if it gets wiped, we don't lose WebAPKs in the mass of "Unknown" which includes legacy shortcuts from long ago

Comment 7 by hanxi@chromium.org, May 2 2017

Blockedon: 691739

Comment 8 by hanxi@chromium.org, May 2 2017

SGTM. @Dom: after your CL (https://codereview.chromium.org/2808263004/) is done, I can start working on this bug:)
Sorry for the delay on that one, I was waiting for some more feedback (and didn't see that it had come in). I'll sort it out ASAP.
Issue 710970 has been merged into this issue.
Good luck!
Project Member

Comment 12 by bugdroid1@chromium.org, May 18 2017

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

commit 257ccdb4fa9b6a50d24f0f736402874dab49a5d2
Author: pkotwicz <pkotwicz@chromium.org>
Date: Thu May 18 03:27:13 2017

Constrain ShortcutSource to valid values

When Chrome requests a WebAPK install, the WebAPK server uses the newest
available "WebAPK template". This means that if an old Chrome version
installs a WebAPK, it may have installed a WebAPK which sends
ShortcutSource values that the Chrome version does not support

This CL constrains the value of the ShortcutSource in the WebappLauncherActivity
launch intent to a valid value.

For instance, m58 Chrome does not know about ShortcutSource#EXTERNAL_INTENT
but the user might install a WebAPK which sends
source==ShortcutSource#EXTERNAL_INTENT to Chrome

BUG= 711147 

Review-Url: https://codereview.chromium.org/2880413002
Cr-Commit-Position: refs/heads/master@{#472632}

[modify] https://crrev.com/257ccdb4fa9b6a50d24f0f736402874dab49a5d2/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
[modify] https://crrev.com/257ccdb4fa9b6a50d24f0f736402874dab49a5d2/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebApkInfoTest.java

Project Member

Comment 13 by bugdroid1@chromium.org, May 24 2017

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

commit 80906b06689bd05c3b727c115242bedd7d6910f2
Author: hanxi <hanxi@chromium.org>
Date: Wed May 24 14:38:21 2017

Correctly record WebAPK install source for Launch.HomescreenSource

In this CL:
1) Introduces source WEBAPK_UNKNONW for WebAPKs whose source info are lost.
2) Stores the WebAPK's source info after the install is either succeeded or timed
   out.
3) Retrives the source info from WebappDataStorage when the WebAPK is launched,
   and records the launch metrics after the source is avaiable.

BUG= 711147 

Review-Url: https://codereview.chromium.org/2860193002
Cr-Commit-Position: refs/heads/master@{#474285}

[modify] https://crrev.com/80906b06689bd05c3b727c115242bedd7d6910f2/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java
[modify] https://crrev.com/80906b06689bd05c3b727c115242bedd7d6910f2/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
[modify] https://crrev.com/80906b06689bd05c3b727c115242bedd7d6910f2/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDataStorage.java
[modify] https://crrev.com/80906b06689bd05c3b727c115242bedd7d6910f2/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
[modify] https://crrev.com/80906b06689bd05c3b727c115242bedd7d6910f2/chrome/browser/android/shortcut_info.h
[modify] https://crrev.com/80906b06689bd05c3b727c115242bedd7d6910f2/chrome/browser/android/webapk/webapk_installer.cc
[modify] https://crrev.com/80906b06689bd05c3b727c115242bedd7d6910f2/tools/metrics/histograms/enums.xml

Comment 14 by hanxi@chromium.org, May 26 2017

Status: Fixed (was: Available)

Sign in to add a comment