New issue
Advanced search Search tips

Issue 900464 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 20
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

WebAPK data directory not cleared when Identity service changes the selected host browser

Project Member Reported by pkotw...@chromium.org, Oct 31

Issue description

Repro steps:
1) Install Chrome Canary
2) Navigate to https://tests.peter.sh/notification-generator/
3) In app menu select "Add to Home screen". This should add a WebAPK to the Android app list.
4) Uninstall Chrome Canary.
5) Install Chrome Dev.
6) Launch WebAPK. Select Chrome Dev as the host browser.
7) Swipe away WebAPK.
8) Uninstall Chrome Dev.
9) Install Chrome Canary.
10) Launch Chrome Canary.
11) Type https://tests.peter.sh/notification-generator/ into the omnibox and navigate
12) Send a notification

Expected:
Identity service either:
- Does not update the cached host browser.
OR
- Updates the cached host browser and clears the WebAPK's data directory

Actual:
Identity service updates the cached host browser but does not clear the WebAPK's data directory.

I am unaware of any breakages due to this bug

 
Summary: WebAPK data directory not cleared when Identity service changes the selected host browser (was: ABCD)
Owner: pkotw...@chromium.org
Status: Started (was: Untriaged)
Description: Show this description
Description: Show this description
Description: Show this description
Project Member

Comment 6 by bugdroid1@chromium.org, Nov 1

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

commit 09c286ca1ec6fadede6471012b455a436636324e
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Thu Nov 01 22:29:01 2018

[Android WebAPK Refactor] Group all of the public methods in HostBrowserUtils together

BUG= 900464 

Change-Id: Iabdce98f4f3a362d1376860277fc9d1c31757c12
Reviewed-on: https://chromium-review.googlesource.com/c/1309296
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604728}
[modify] https://crrev.com/09c286ca1ec6fadede6471012b455a436636324e/chrome/android/webapk/shell_apk/current_version/current_version.gni
[modify] https://crrev.com/09c286ca1ec6fadede6471012b455a436636324e/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserUtils.java

Project Member

Comment 7 by bugdroid1@chromium.org, Nov 16

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

commit 523539ae815b004d395a305585c9644c972eaae4
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Fri Nov 16 17:34:58 2018

[Android WebAPK] Clear cached data when identity service selects different host

This CL fixes IdentityService#getRuntimeHostBrowserPackageName(). In some
scenarios (like the default browser supporting WebAPKs for an unbound WebAPK),
calling HostBrowserUtils#getHostBrowserPackageName() updates the host browser
in shared preferences. This CL changes the call so that when the
IdentityService changes the host browser in Shared Preferences the identity
service also clears that WebAPK's shared preferences and data directory.

This CL:
- Splits HostBrowserUtils#getHostBrowserPackageName() into 2 functions:
  HostBrowserUtils#getCachedHostBrowserPackage()
    which returns the host browser cached in shared preferences if it is still
    installed. HostBrowserUtils#getCachedHostBrowserPackage() does not update any
    state.
  HostBrowserUtils#computeHostBrowserPackageClearCachedDataOnChange()
    which computes the new host browser. If the computed host browser is
    different than the cached host browser in shared preferences, the WebAPK's
    shared preferences and data directory are cleared.
- Reduces the number of functions with hidden calls to
  HostBrowserUtils#getHostBrowserPackageName().
  HostBrowserUtils#getHostBrowserContext() and
  HostBrowserUtils#getHostBrowserUid() are changed to take a package name
  parameter and are moved to WebApkUtils.

BUG= 900464 
TEST=HostBrowserUtilsTest.*

Change-Id: Ie6dea7de5eaca770d8a1261c2742308bc1165419
Reviewed-on: https://chromium-review.googlesource.com/c/1310569
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608834}
[modify] https://crrev.com/523539ae815b004d395a305585c9644c972eaae4/chrome/android/webapk/shell_apk/current_version/current_version.gni
[modify] https://crrev.com/523539ae815b004d395a305585c9644c972eaae4/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/HostBrowserUtilsTest.java
[modify] https://crrev.com/523539ae815b004d395a305585c9644c972eaae4/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserClassLoader.java
[modify] https://crrev.com/523539ae815b004d395a305585c9644c972eaae4/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserUtils.java
[modify] https://crrev.com/523539ae815b004d395a305585c9644c972eaae4/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/IdentityService.java
[modify] https://crrev.com/523539ae815b004d395a305585c9644c972eaae4/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/LaunchHostBrowserSelector.java
[modify] https://crrev.com/523539ae815b004d395a305585c9644c972eaae4/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/WebApkServiceFactory.java
[modify] https://crrev.com/523539ae815b004d395a305585c9644c972eaae4/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/WebApkUtils.java

Status: Fixed (was: Started)

Sign in to add a comment