New issue
Advanced search Search tips

Issue 901954 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocked on: View detail
issue 907951
issue 909714
issue 911420
issue 918459

Blocking:
issue 817263



Sign in to add a comment

WebAPK is relaunched as a result of tapping app icon after first launch

Project Member Reported by pkotw...@chromium.org, Nov 5

Issue description

Repro steps:
1) Install NewSplashWebApk.apk
2) Install super new browser which is compatible with SplashActivity
3) Tap WebAPK app icon. WebAPK should launch
4) Go to app drawer and tap app icon again
Expected:
WebAPK is brought to the front
Actual:
WebAPK is relaunched
 
This bug occurs because the root of the task stack for the initial launch 
is H2OMainActivity. The second time that the user taps the app icon,
H2OMainActivity is disabled so Android launches the main intent
handler - SplashActivity.
To fix this bug we need the WebAPK to as part of the initial launch:
1) Enable SplashActivity
2) Launch SplashActivity

When enabling SplashActivity we allow PackageManager#setComponentEnabledSetting()
to kill the WebAPK because allowing the PackageManager to kill the WebAPK
makes Android update the shortcut in the app drawer faster (and avoids the user
tapping on the app icon and getting a message "the app is not installed").
We cannot launch SplashActivity till after PackageManager has killed the WebAPK.

We want to relaunch the SplashActivity as fast as possible. AlarmManager and
JobScheduler have a minimum delay which is too high (several seconds).
I suggest getting WebappLauncherActivity to relaunch the WebAPK.


Blocking: 817263
Blockedon: 907951
Project Member

Comment 4 by bugdroid1@chromium.org, Nov 27

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

commit 7cdb553955e7283aabc5bf59a7d80bae57480366
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Tue Nov 27 21:45:17 2018

[Android WebAPK Refactor] Make WebAPK validity logic in WebappLauncherActivity more correct 10/X

A WebAPK is valid if all the requirements below are true:
Requirement#1: The APK is correctly signed (WebApkValidator#isValidWebApk())
Requirement#2: The APK handles the URL in the intent (WebApkValidator#canWebApkHandleUrl())
Requirement#3: The APK has <meta-data> in a format that Chrome can read.
  (WebApkInfo#create() returns non-null)

This CL changes the logic in WebappLauncherActivity to make Requirement#3 clearer. This CL:
- Introduces WebappInfo#isForWebApk() and makes WebappLauncherActivity use this instead
  of the return value of WebappLauncherActivity#isValidWebApk() which did not check
  Requirement #3.
- Changes WebApkValidator#canWebApkHandleUrl() to no longer check whether the passed in
  APK package is a valid WebAPK. This reduces the number of extras read directly in
  WebappLauncherActivity (outside of WebApkInfo#create/WebappInfo#create)

BUG=901954

Change-Id: I51ef612c641d9d7c2e9535db33f0baee17694edb
Reviewed-on: https://chromium-review.googlesource.com/c/1351456
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#611346}
[modify] https://crrev.com/7cdb553955e7283aabc5bf59a7d80bae57480366/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkInfo.java
[modify] https://crrev.com/7cdb553955e7283aabc5bf59a7d80bae57480366/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDelegateFactory.java
[modify] https://crrev.com/7cdb553955e7283aabc5bf59a7d80bae57480366/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
[modify] https://crrev.com/7cdb553955e7283aabc5bf59a7d80bae57480366/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java

Blockedon: 909714
Project Member

Comment 6 by bugdroid1@chromium.org, Nov 30

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

commit b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Fri Nov 30 06:12:13 2018

[Android WebAPK] Launch SplashActivity after enabling it 11/X

This CL changes the behaviour of H2OMainActivity when it enables
SplashActivity. This CL changes H2OMainActivity to launch
SplashActivity after enabling it.

H2OMainActivity needs to launch SplashActivity so that when a user
1) Launches the WebAPK for the first time (and the user has a
   SplashActivity compatible browser installed)
2) The user returns to the home screen without swiping away the WebAPK
3) The users taps the WebAPK's app icon
The already launched WebAPK is brought to the foreground instead of
being relaunched.

The WebAPK is killed as a result of the PackageManager call to enable
SplashActivity. This CL relaunches SplashActivity by sending an intent
to the host browser with a boolean extra -
org.chromium.webapk.relaunch - indicating that it wants to be
relaunched.

Doc summarizing all of the "New Splash WebAPK" launch flows:
https://goo.gl/J2yB87

BUG=901954
TEST=LaunchTest.*, MainActivityTest.*

Change-Id: I6f34cb71a1e1bfe63cad664f24dd48b9b5791c7d
Reviewed-on: https://chromium-review.googlesource.com/c/1318377
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612585}
[modify] https://crrev.com/b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
[modify] https://crrev.com/b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060/chrome/android/webapk/libs/common/src/org/chromium/webapk/lib/common/WebApkConstants.java
[modify] https://crrev.com/b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060/chrome/android/webapk/shell_apk/current_version/current_version.gni
[modify] https://crrev.com/b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/MainActivityTest.java
[modify] https://crrev.com/b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060/chrome/android/webapk/shell_apk/junit/src/org/chromium/webapk/shell_apk/h2o/LaunchTest.java
[modify] https://crrev.com/b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserLauncher.java
[modify] https://crrev.com/b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserLauncherParams.java
[modify] https://crrev.com/b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/WebApkSharedPreferences.java
[modify] https://crrev.com/b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/h2o/H2OLauncher.java
[modify] https://crrev.com/b3d4f4e869ff6b8ae5293d70eee6b8e3d88a4060/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/h2o/H2OMainActivity.java

Project Member

Comment 7 by bugdroid1@chromium.org, Nov 30

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

commit 8e0a3712a2b2c7409d224747c10e3f6d56c41bad
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Fri Nov 30 15:57:44 2018

[Android WebAPK Refactor] Make SplashActivity not extend HostBrowserLauncherActivity 12/X

This CL is in preparation for making SplashActivity more complicated and overriding
SplashActivity#onResume().

This CL:
- Makes SplashActivity no longer inherit from HostBrowserLauncherActivity
- Changes TransparentLauncherActivity to call finish() after the call to
  onHostBrowserSelected()

BUG=901954

Change-Id: I2577031db9f132fc61757126ef9ffbe5c64d46cd
Reviewed-on: https://chromium-review.googlesource.com/c/1319342
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612661}
[modify] https://crrev.com/8e0a3712a2b2c7409d224747c10e3f6d56c41bad/chrome/android/webapk/shell_apk/BUILD.gn
[modify] https://crrev.com/8e0a3712a2b2c7409d224747c10e3f6d56c41bad/chrome/android/webapk/shell_apk/current_version/current_version.gni
[delete] https://crrev.com/0bdd3c25975f763d121802a092c1ef0925049976/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/HostBrowserLauncherActivity.java
[modify] https://crrev.com/8e0a3712a2b2c7409d224747c10e3f6d56c41bad/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/TransparentLauncherActivity.java
[modify] https://crrev.com/8e0a3712a2b2c7409d224747c10e3f6d56c41bad/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/h2o/H2OMainActivity.java
[modify] https://crrev.com/8e0a3712a2b2c7409d224747c10e3f6d56c41bad/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/h2o/H2OTransparentLauncherActivity.java
[modify] https://crrev.com/8e0a3712a2b2c7409d224747c10e3f6d56c41bad/chrome/android/webapk/shell_apk/src/org/chromium/webapk/shell_apk/h2o/SplashActivity.java

Blockedon: 911420
Project Member

Comment 9 by bugdroid1@chromium.org, Dec 7

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

commit a237af599ee6c49ac034759a7a26c2b3131efbad
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Fri Dec 07 22:12:38 2018

[Android FRE Refactor] Do not launch Chrome when user aborts FRE 1/4

This CL is part 1/4 of changing the first run experience not to launch
Chrome when the user aborts the first run experience.
This gets rid of UI flicker https://crbug.com/788153
This CL is also preparation for changing the intent which is launched
when the first run experience is completed for new-style WebAPKs.

BUG=901954

Change-Id: I13da4a52a6745f0e2f87e5b23c445f758a48defb
Reviewed-on: https://chromium-review.googlesource.com/c/1359919
Reviewed-by: Yusuf Ozuysal <yusufo@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614843}
[modify] https://crrev.com/a237af599ee6c49ac034759a7a26c2b3131efbad/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java

Project Member

Comment 10 by bugdroid1@chromium.org, Dec 8

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

commit d737733aaa17aa0dd6a64c908e4bc53dda61a198
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Sat Dec 08 03:08:54 2018

Project Member

Comment 11 by bugdroid1@chromium.org, Dec 10

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

commit 4d25c185b96203ef6783438177035b7ab3810a89
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Mon Dec 10 17:57:40 2018

[Android FRE Refactor] Do not launch Chrome when user aborts FRE 3/5

This CL:
- Changes the first run experience not to launch Chrome when the user
  aborts the first run experience
- Copies the extras from the Chrome launch intent to the
  FirstRunActivity intent. This enables FirstRunActivity to locate the
  associated CustomTabsConnection and and trigger the custom tab FRE
  callback.
- Renames FirstRunActivityBase#EXTRA_CHROME_LAUNCH_INTENT to make
  it clear that the PendingIntent should be run only when the user
  finishes the first run experience.

BUG=901954

Change-Id: I7c58c8bf8882d8aecd099d3edf8237faef5762ae
Reviewed-on: https://chromium-review.googlesource.com/c/1359867
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: Yusuf Ozuysal <yusufo@chromium.org>
Reviewed-by: Peter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615168}
[modify] https://crrev.com/4d25c185b96203ef6783438177035b7ab3810a89/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivity.java
[modify] https://crrev.com/4d25c185b96203ef6783438177035b7ab3810a89/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunActivityBase.java
[modify] https://crrev.com/4d25c185b96203ef6783438177035b7ab3810a89/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencer.java
[modify] https://crrev.com/4d25c185b96203ef6783438177035b7ab3810a89/chrome/android/java/src/org/chromium/chrome/browser/firstrun/LightweightFirstRunActivity.java

Project Member

Comment 12 by bugdroid1@chromium.org, Dec 11

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

commit 3249311522469cbfadfb5b80a3d3c2e7d0f694da
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Tue Dec 11 21:28:25 2018

Project Member

Comment 13 by bugdroid1@chromium.org, Dec 13

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

commit 7840262c899394d2bbcfd9509d64212291473f21
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Thu Dec 13 23:26:13 2018

[Android FRE Refactor] Do not launch Chrome when user aborts FRE 5/5

This CL removes the Intent-version of
CustomTabsConnection#sendFirstRunCallbackIfNecessary() whose usage was
removed in parts 3-4.

BUG=901954

Change-Id: I50c00d0688794fec304267e4cd9a4d6365e64d90
Reviewed-on: https://chromium-review.googlesource.com/c/1370888
Reviewed-by: Yusuf Ozuysal <yusufo@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#616483}
[modify] https://crrev.com/7840262c899394d2bbcfd9509d64212291473f21/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java

Blockedon: 918459

Sign in to add a comment