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

Issue 736457 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Jan 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocked on:
issue 774513



Sign in to add a comment

WebAPK installs fail often due to too little available space

Project Member Reported by yfried...@chromium.org, Jun 23 2017

Issue description

Per thread "Initial Data About INSTALL_ERRORs and DOWNLOAD_ERRORS"

There's a certain threshold where the framework will automatically fail package installs to avoid the device getting too low on memory. Investigate what this number is (some indication it's ~500mb) and don't bother trying to install a WebApk if so (but record metrics for this)
 
As part of this we can see if that limit is a hard limit or is somehow configurable (does play set it?) and see if we can be more lax since these apks are O(100kb)
Owner: hanxi@chromium.org
Status: Assigned (was: Untriaged)
How this system calculates it's "full" (wont' install) https://github.com/android/platform_frameworks_base/blob/master/core/java/android/provider/Settings.java
We should also add metrics for when we're actually doing this
Cc: dominickn@chromium.org owe...@chromium.org
Should we instead give an error to the user about disk space?

I'm worried if we fallback to adding shortcuts when users are low on space that users will get an inconsistent experience, with apps sometimes working one way and sometimes another.
Cc: sbirch@chromium.org klo...@chromium.org
I could see arguments for either. I definitely agree that in medium to long term  we could notify since we'd want to use "old A2HS" less and less. For short-term though while we're still working to roll this out, falling back is a possibility IMHO.

If we're going to warn users, we should probably try and make it actionable, right? Perhaps point to the android "clear caches" setting and/or proactively remove chrome's disk cache?
Looks like we could send them to a "manage storage" page: https://developer.android.com/reference/android/os/storage/StorageManager.html#ACTION_MANAGE_STORAGE

On Android O, you can even include an extra to say how much space you need and presumably android will help the user find that space. Seems like there you can also ask android to free up space programmatically: https://developer.android.com/reference/android/os/storage/StorageManager.html#allocateBytes(java.util.UUID, long)
Yes, making it actionable would be great. Would be good to get a product opinion on this.

Sam / Owen, what do you think?
And yes, having a short term fix while we figure out a longer term option sounds good, if the long term option is too hard to do quickly.

Comment 9 by sbirch@chromium.org, Jun 28 2017

My vote:

Short term -- skip to A2HS silently if the user doesn't have space.

Longer term as a (P2?) polish issue -- make this more actionable using the system dialog on O and something else pre-O. (I don't think we should send them to Chrome's manage space section -- it could encourage users to clear all their web data, which would lead to a pretty bad experience in other WebAPKs. It's also unlikely to be the root issue since (IIRC) we have an adaptive cache size.)
I'm increasingly in favour of entirely removing the legacy A2HS flow once WebAPKs are fully launched, and I want to pursue that as a top-priority for code health post-launch. And as benwells@ said, having an inconsistent experience is really bad.

If we do use a fallback to legacy PWAs as a stopgap, it should be a very short-term solution. But is it possible to show a space warning dialog with an action button to intent into Settings > Storage as an alternative stop gap? Users in this situation might already know about their low storage issues and have some familiarity with clearing.
 Issue 681603  has been merged into this issue.

Comment 12 by hanxi@chromium.org, Jul 26 2017

We can only know how many space left on the device, but there isn't an API to know that next install will fail based on the current free space. So we can't predict whether the install will success or fail before the install happens. I think for short term, we may have to keep the existing behavior, i.e., fall backs to the legacy A2HS and show a failure toast.

David (dyouyang@) in the Play team has a plan to fix it in the Play side: he is working on the Uninstall Manager, which prompts the user to uninstall other apps when a new app fails installation due to low space. He want to make it so this manager also launches for WebAPK installs. After user free up space, Play will be able to continue install the WebAPK. This is on his Q3 OKR.
Owner: ranj@chromium.org
We're going to add some instrumentation to see if install fails due to lack of space, whether we can clear some cached data in chrome to enable install to work before falling back to a2hs. As a nice-to-have we can also see if we can predict whether install will fail due to lack of space to save time on install latency
Project Member

Comment 14 by bugdroid1@chromium.org, Aug 29 2017

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

commit b0726de7c850c32363ab65e9ec9b59fb9a121d0d
Author: Ran Ji <ranj@chromium.org>
Date: Tue Aug 29 18:59:24 2017

Add UMA to track disk space on installation

The UMA is used to know how many available space can be used to install WebAPK.
Ideally, if the WebAPK size < the available space, the installation will fail,
otherwise it will succeed.

This is an attemp to predict the installation outcome by looking at the available space.

Bug:  736457 
Change-Id: I5b40107aae4bb28dd6a5977d9515a9da91e903e5
Reviewed-on: https://chromium-review.googlesource.com/627720
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Commit-Queue: Ran Ji <ranj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#498186}
[modify] https://crrev.com/b0726de7c850c32363ab65e9ec9b59fb9a121d0d/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java
[modify] https://crrev.com/b0726de7c850c32363ab65e9ec9b59fb9a121d0d/tools/metrics/histograms/histograms.xml

Project Member

Comment 15 by bugdroid1@chromium.org, Aug 29 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/clank/internal/apps/+/53c52300c471ecfc8a0bcc83fa029650658e1864

commit 53c52300c471ecfc8a0bcc83fa029650658e1864
Author: Ran Ji <ranj@google.com>
Date: Tue Aug 29 22:24:45 2017

Project Member

Comment 16 by bugdroid1@chromium.org, Aug 30 2017

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

commit d4fd17e98c44ec29c6d5a5934463c23e6a6857a6
Author: Yaron Friedman <yfriedman@chromium.org>
Date: Wed Aug 30 15:03:12 2017

Fix strictmode violation from new disk available metrics.

Noticed this during local development
BUG= 736457 

Change-Id: Ib0ec6e7cd54f5e7d28426550dd3e8638e6def177
Reviewed-on: https://chromium-review.googlesource.com/643330
Commit-Queue: Xi Han <hanxi@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#498462}
[modify] https://crrev.com/d4fd17e98c44ec29c6d5a5934463c23e6a6857a6/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java

Can we also add the metrics for size we can free up? ManageSpaceActivity does some calculation of "not important storage" - not sure what that is exactly? and perhaps we could clear some disk cache
Project Member

Comment 18 by bugdroid1@chromium.org, Sep 5 2017

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

commit a1952145e494da27a30afd26a402880d1cf3c870
Author: Ran Ji <ranj@chromium.org>
Date: Tue Sep 05 15:47:39 2017

Add UMA to track unimportant storage size on WebAPK installation

We may use this space if there is not enough space to install WebAPK by freeing it up.

Bug:  736457 
Change-Id: I2ad6a50f0f199e54c46f073b5c97e34618c42485
Reviewed-on: https://chromium-review.googlesource.com/646085
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Commit-Queue: Ran Ji <ranj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#499643}
[modify] https://crrev.com/a1952145e494da27a30afd26a402880d1cf3c870/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java
[modify] https://crrev.com/a1952145e494da27a30afd26a402880d1cf3c870/tools/metrics/histograms/histograms.xml

Project Member

Comment 19 by bugdroid1@chromium.org, Sep 6 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/clank/internal/apps/+/4316c3c5e5669ae1f4fa1f4cf2d91bfd9d53f061

commit 4316c3c5e5669ae1f4fa1f4cf2d91bfd9d53f061
Author: Ran Ji <ranj@google.com>
Date: Wed Sep 06 17:31:32 2017

Project Member

Comment 20 by bugdroid1@chromium.org, Sep 28 2017

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

commit 7502909a9a279859629bfd6dbb0ccc8b6c997085
Author: Ran Ji <ranj@chromium.org>
Date: Thu Sep 28 02:21:17 2017

Add UMA to track Chrome cache size on WebAPK installation

We may clean up cache if there is not enough space to install WebAPK.

Bug:  736457 
Change-Id: Iaaf2e3d7b456bc08576b958eadb5af07bcc4fc62
Reviewed-on: https://chromium-review.googlesource.com/679276
Commit-Queue: Ran Ji <ranj@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504870}
[modify] https://crrev.com/7502909a9a279859629bfd6dbb0ccc8b6c997085/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java
[modify] https://crrev.com/7502909a9a279859629bfd6dbb0ccc8b6c997085/tools/metrics/histograms/histograms.xml

Cc: slightlyoff@chromium.org
+slightlyoff FYI
Blockedon: 774513
Summary: WebAPK installs fail often due to too little available space (was: Fall-back to old A2HS dialog (or possibly notify user) if we know WebApk install would fail due to low disk space)
Project Member

Comment 23 by bugdroid1@chromium.org, Oct 27 2017

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

commit b0690c992022ee527c147feebe2f1d8bee49cd3b
Author: Ran Ji <ranj@chromium.org>
Date: Fri Oct 27 17:25:54 2017

Combine disk usage uma and cache size uma to predict installation outcome

If "WebApk.Install.AvailableSpaceAfterFreeUpCache.Fail" > 0, installation
will success if we free up cache before installing, otherwise fails as before.

Bug:  736457 
Change-Id: Id70a4043a4d4af3efeaa15e5d20dabb6c984b225
Reviewed-on: https://chromium-review.googlesource.com/690518
Commit-Queue: Ran Ji <ranj@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512223}
[modify] https://crrev.com/b0690c992022ee527c147feebe2f1d8bee49cd3b/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java
[modify] https://crrev.com/b0690c992022ee527c147feebe2f1d8bee49cd3b/tools/metrics/histograms/histograms.xml

Project Member

Comment 24 by bugdroid1@chromium.org, Oct 30 2017

The following revision refers to this bug:
  https://chrome-internal.googlesource.com/clank/internal/apps/+/81cb61f32bb5fe7a9cf9a70b800d48dda3ed7f95

commit 81cb61f32bb5fe7a9cf9a70b800d48dda3ed7f95
Author: Ran Ji <ranj@google.com>
Date: Mon Oct 30 20:43:37 2017

Project Member

Comment 25 by bugdroid1@chromium.org, Nov 1 2017

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

commit 8b2f970348522c1103faed86cfabb0a1a07b8be6
Author: Ran Ji <ranj@chromium.org>
Date: Wed Nov 01 16:00:31 2017

Clean up and fix unimportant storage UMA

Previously this was inadvertently just reporting important storage size

Bug:  736457 
Change-Id: Iafad446779aaaccc513e3455c7c78cd5e61ff4c6
Reviewed-on: https://chromium-review.googlesource.com/744922
Commit-Queue: Ran Ji <ranj@chromium.org>
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513143}
[modify] https://crrev.com/8b2f970348522c1103faed86cfabb0a1a07b8be6/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java

Project Member

Comment 26 by bugdroid1@chromium.org, Dec 20 2017

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

commit 76a80d50480b548e27e7922cb8120060f91a0a99
Author: Ran Ji <ranj@chromium.org>
Date: Wed Dec 20 13:46:26 2017

Free cache if necessary when install, fail back to shortcut if no enough space

Fail back to shortcut if there is no enough space to install WebApk even after
freeing cache.

Free cache and install if there is no enough space but the space requirement
can be satisfied using the cache storage.

Bug: 774513, 736457 
Change-Id: I1beec2b3c26ebfb09e03014038a2657b27185284
Reviewed-on: https://chromium-review.googlesource.com/794532
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: David Trainor <dtrainor@chromium.org>
Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org>
Commit-Queue: Ran Ji <ranj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#525321}
[modify] https://crrev.com/76a80d50480b548e27e7922cb8120060f91a0a99/chrome/android/BUILD.gn
[modify] https://crrev.com/76a80d50480b548e27e7922cb8120060f91a0a99/chrome/android/java/src/org/chromium/chrome/browser/metrics/WebApkUma.java
[modify] https://crrev.com/76a80d50480b548e27e7922cb8120060f91a0a99/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInstaller.java
[modify] https://crrev.com/76a80d50480b548e27e7922cb8120060f91a0a99/chrome/browser/android/webapk/webapk_installer.cc
[modify] https://crrev.com/76a80d50480b548e27e7922cb8120060f91a0a99/chrome/browser/android/webapk/webapk_installer.h
[modify] https://crrev.com/76a80d50480b548e27e7922cb8120060f91a0a99/chrome/browser/android/webapk/webapk_installer_unittest.cc

Any idea on whether this is working yet? I suspect we only have canary data so probably not too interesting

Comment 28 by ranj@chromium.org, Jan 3 2018

It should work right now. We can check the UMA "WebApk.Install.AvailableSpaceAfterFreeUpCache.Fail" for recent data to confirm, if there is no positive value, means installation after freeing up cache is success.

Comment 30 by ranj@chromium.org, Jan 17 2018

Status: Fixed (was: Assigned)
Marked as fix. The space calculation correctly predicts > 99.9% of the failure by looking at the "WebApk.Install.AvailableSpace.Fail" UMA. As the fallback to shortcut behavior landed, there will be no new UMA data. Will keep an eye on it to confirm.
Project Member

Comment 31 by bugdroid1@chromium.org, Apr 27 2018

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

commit a79a2ad2ff5b5f9c7bbcc8403cd702f0a1e3b04a
Author: Ran Ji <ranj@chromium.org>
Date: Fri Apr 27 19:58:37 2018

Add field trial WebApkGooglePlay in fieldtrial_testing_config.json

Bug:  736457 
Change-Id: I818c4d048145ae77bfd5c0244cde67886c30f8be
Reviewed-on: https://chromium-review.googlesource.com/1031786
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Alexei Svitkine <asvitkine@chromium.org>
Commit-Queue: Ran Ji <ranj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#554470}
[modify] https://crrev.com/a79a2ad2ff5b5f9c7bbcc8403cd702f0a1e3b04a/testing/variations/fieldtrial_testing_config.json

Sign in to add a comment