New issue
Advanced search Search tips

Issue 871266 link

Starred by 4 users

Issue metadata

Status: Started
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 1
Type: Task



Sign in to add a comment

Move Trusted Web Activities over to CustomTabActivity

Project Member Reported by peconn@chromium.org, Aug 6

Issue description

Trusted Web Activities are currently implemented on top of WebappActivity. With their current goals in mind it would make more sense to implement them on top of CustomTabActivity.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 8

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

commit 7cb96734f0115a54e126f77c4610cddb00dc3681
Author: Peter E Conn <peconn@chromium.org>
Date: Wed Aug 08 11:30:45 2018

🤝 Separate WebappActivity ContentProvider and VerificationListener.

Splitting out the Trusted Web Activity logic to make moving it over to
CustomTabActivity easier.

Bug: 871266
Change-Id: If2c86e74e4f40e4354e5e8a5ef2d7a97566ae462
Reviewed-on: https://chromium-review.googlesource.com/1163716
Commit-Queue: Peter Conn <peconn@chromium.org>
Reviewed-by: Bernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581519}
[add] https://crrev.com/7cb96734f0115a54e126f77c4610cddb00dc3681/chrome/android/java/src/org/chromium/chrome/browser/browserservices/VerificationState.java
[modify] https://crrev.com/7cb96734f0115a54e126f77c4610cddb00dc3681/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
[modify] https://crrev.com/7cb96734f0115a54e126f77c4610cddb00dc3681/chrome/android/java_sources.gni

Example video - I know the transitions are a bit janky/jumpy.
2018-08-09_18-11-24.mp4
14.2 MB View Download
Project Member

Comment 4 by bugdroid1@chromium.org, Aug 15

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

commit 19090f0be68c5209c25230f36d8f4cb0b1f790e2
Author: Peter E Conn <peconn@chromium.org>
Date: Wed Aug 15 13:26:53 2018

🤝 Hide toolbar when on verified origin.

When a Trusted Web Activity is launched (a Custom Tab is launched with
android.support.customtabs.extra.LAUNCH_AS_TRUSTED_WEB_ACTIVITY) it now
launches into a CustomTabActivity instead of a WebappActivity.

This CustomTabActivity has a TrustedWebActivityUi that tracks whether
we are on an origin that the client is verified for, and hides the
top bar if this is the case.

When the client leaves the verified origin, the top bar is shown and
the CustomTabActivity acts like a normal Custom Tab (including things
like styling and such).

This also adds a "Running in Chrome" disclosure that shows once per
client app until dismissed.

Bug: 871266
Change-Id: I02927501f93d49353db02f5130714a16b512b08b
Reviewed-on: https://chromium-review.googlesource.com/1169604
Commit-Queue: Peter Conn <peconn@chromium.org>
Reviewed-by: Bernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583230}
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
[add] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityDisclosure.java
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityUi.java
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceManager.java
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/src/org/chromium/chrome/browser/snackbar/Snackbar.java
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDisclosureSnackbarController.java
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/strings/android_chrome_strings.grd
[add] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java/strings/android_chrome_strings_grd/IDS_TWA_RUNNING_IN_CHROME.png.sha1
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/chrome/android/java_sources.gni
[modify] https://crrev.com/19090f0be68c5209c25230f36d8f4cb0b1f790e2/tools/metrics/histograms/enums.xml

Project Member

Comment 5 by bugdroid1@chromium.org, Aug 16

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

commit c293710c8d4d0732b2fa49b608b1f8c7c2d5b07e
Author: Peter E Conn <peconn@chromium.org>
Date: Thu Aug 16 15:56:25 2018

🤝 Trigger Origin Verification on Trusted Web Activity start.

This will display Trusted Web Activities correctly when they are
launched when verification hasn't been completed.

It also ensures that Trusted Web Activities show the top bar when they
are launched to a non-verified origin.

Bug: 871266
Change-Id: Ibd245812647a2f1d6b6a9405f14d12f46f6ae6f9
Reviewed-on: https://chromium-review.googlesource.com/1177611
Reviewed-by: Bernhard Bauer <bauerb@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583674}
[modify] https://crrev.com/c293710c8d4d0732b2fa49b608b1f8c7c2d5b07e/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityUi.java
[modify] https://crrev.com/c293710c8d4d0732b2fa49b608b1f8c7c2d5b07e/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java

Project Member

Comment 6 by bugdroid1@chromium.org, Aug 17

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

commit f39cb55a1451df9a1f48fb2f27a0789db2f74428
Author: Peter E Conn <peconn@chromium.org>
Date: Fri Aug 17 12:55:47 2018

🤝  Don't initially show the Snackbar if we've left the verified origin.

State was getting slightly out of sync with the following sequence of
events:
1. Open a TWA to a non-verified origin.
2. Navigation finishes, we notice and disable TWA UI.
3. finishNativeInitialization occurs, which is where we initially
   try to show the Disclosure Snackbar.

Bug: 871266
Change-Id: Iaf152b49de18cf22eca90b61df570e582dd2a435
Reviewed-on: https://chromium-review.googlesource.com/1179680
Reviewed-by: Bernhard Bauer <bauerb@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584035}
[modify] https://crrev.com/f39cb55a1451df9a1f48fb2f27a0789db2f74428/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityUi.java

Project Member

Comment 7 by bugdroid1@chromium.org, Aug 20

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

commit 20891520570f780b13ae9725d9aa5a909338d0a9
Author: Peter E Conn <peconn@chromium.org>
Date: Mon Aug 20 16:43:06 2018

🤝 Disable PostMessage on Trusted Web Activities.

Moving Trusted Web Activities over to CustomTabActivity gets us
PostMessage for free. Unfortunately we're not ready to launch that,
so disable it for the time being.

Bug: 871266
Change-Id: Iaef2c08aea87be888cd98b102aeb4a87e888fd04
Reviewed-on: https://chromium-review.googlesource.com/1181139
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Benoit L <lizeb@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584473}
[modify] https://crrev.com/20891520570f780b13ae9725d9aa5a909338d0a9/chrome/android/java/src/org/chromium/chrome/browser/ChromeFeatureList.java
[modify] https://crrev.com/20891520570f780b13ae9725d9aa5a909338d0a9/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
[modify] https://crrev.com/20891520570f780b13ae9725d9aa5a909338d0a9/chrome/browser/android/chrome_feature_list.cc
[modify] https://crrev.com/20891520570f780b13ae9725d9aa5a909338d0a9/chrome/browser/android/chrome_feature_list.h

peconn@ Can you give us an update on the status?

I believe that as of https://chromium-review.googlesource.com/c/chromium/src/+/1169604 TWA intents no longer launch a WebappActivity. However, there is still a ton of TWA code left in WebappActivity.
Yeah, TWAs now launch into Custom Tab Activity and are mostly working for that. I'm still in the process of cleaning up the leftover code in WebappActivity/etc.
Project Member

Comment 11 by bugdroid1@chromium.org, Sep 24

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

commit 84d4e78fb7741b45f038cfe5f8e3120396a9e370
Author: Peter E Conn <peconn@chromium.org>
Date: Mon Sep 24 08:10:03 2018

🤝 Remove TWA relevant code from Webapps.

Now that Trusted Web Activities have moved over to be based on
CustomTabActivity, we can remove some the code from the webapp classes.

Bug: 871266
Change-Id: If2cc69b27e58bb83c14e682a9231df9f3c78d25d
Reviewed-on: https://chromium-review.googlesource.com/1224116
Reviewed-by: Yaron Friedman <yfriedman@chromium.org>
Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org>
Commit-Queue: Peter Conn <peconn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593488}
[delete] https://crrev.com/a364af4a6afa22e077e1ec73d58be3dec026de24/chrome/android/java/src/org/chromium/chrome/browser/browserservices/VerificationState.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/java/src/org/chromium/chrome/browser/externalnav/ExternalNavigationHandler.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebApkActivity.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappBrowserControlsDelegate.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappCustomTabTimeSpentLogger.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappDisclosureSnackbarController.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappInfo.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappOfflineDialog.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/java_sources.gni
[delete] https://crrev.com/a364af4a6afa22e077e1ec73d58be3dec026de24/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/TrustedWebActivityTest.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappActivityTest.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/WebappVisibilityTest.java
[modify] https://crrev.com/84d4e78fb7741b45f038cfe5f8e3120396a9e370/chrome/android/junit/src/org/chromium/chrome/browser/webapps/WebappDisclosureSnackbarControllerTest.java

Project Member

Comment 13 by bugdroid1@chromium.org, Oct 19

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

commit a81e05221c77039e3cec7a7294c7dce7e29a5a45
Author: Peter Kotwicz <pkotwicz@chromium.org>
Date: Fri Oct 19 16:23:36 2018

[Android WebAPK] Ignore com.android.browser.headers intent extra for Webapps and WebAPKs

This CL removes the handling of the com.android.browser.headers intent extra in
WebappActivity. The handling was added in
https://chromium-review.googlesource.com/c/chromium/src/+/1116219
at the time that TWAs used WebappActivity. They no longer do so.

BUG=871266,  801487 

Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: Ife40f882f45900f33ff356c435ee1a9283a4419e
Reviewed-on: https://chromium-review.googlesource.com/c/1288012
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Peter Conn <peconn@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601176}
[modify] https://crrev.com/a81e05221c77039e3cec7a7294c7dce7e29a5a45/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java

Sign in to add a comment