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

Issue 681559 link

Starred by 2 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocking:
issue 695997



Sign in to add a comment

Investigate exporting CustomTabActivity to speed up Custom Tabs startup.

Project Member Reported by lizeb@chromium.org, Jan 16 2017

Issue description

The normal launch path for Chrome is through com.google.android.apps.chrome.Main, which is an alias to org.chromium.chrome.browser.document.ChromeLauncherActivity. This activity does mainly acts as a "router" between the various Chrome's activity, yet it adds a non-trivial delay to intent dispatch.

In theory, a client application could direcly send intents to CustomTabActivity, cutting the time taken to jump from ChromeLauncherActivity to CustomTabActivity. This requires the activity to be exported. 

 

Comment 1 by ltian@chromium.org, Feb 24 2017

Blocking: 695997

Comment 2 by lizeb@chromium.org, Mar 3 2017

Cc: -ian...@chromium.org
Owner: lizeb@chromium.org
Status: Started (was: Available)

Comment 3 by lizeb@chromium.org, Mar 3 2017

Testing on Android M, svelte:

Without ChromeLauncherActivity:

count     163.000000
mean     1218.325153
std       262.966643
min       871.000000
25%      1066.000000
50%      1132.000000
75%      1267.500000
max      2590.000000

With ChromeLauncherActivity:

count     149.000000
mean     1347.302013
std       301.930225
min       996.000000
25%      1157.000000
50%      1243.000000
75%      1456.000000
max      2879.000000

Comment 4 by pasko@chromium.org, Jul 26 2017

please add a pointer to the benchmark and the metric this is reflecting. Not everyone is aware of this context.

Comment 5 by pasko@chromium.org, Jul 26 2017

Cc: pasko@chromium.org
Project Member

Comment 6 by bugdroid1@chromium.org, Jul 26 2017

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

commit c5cfa455b463e46f9f5355f498ce811cb52c03a2
Author: Benoit Lize <lizeb@chromium.org>
Date: Wed Jul 26 16:20:54 2017

customtabs: Support skipping ChromeLauncherActivity in customtabs_benchmark.

This CL only contains the test code plumbing, the actual skipping of
ChromeLauncherActivity will be added on top of it.
Also clean up the result parsing code, and add unit tests.

Bug: 681559
Change-Id: I87444b83d33a01de4c6bfcbef12c4fa8d39ccb82
Reviewed-on: https://chromium-review.googlesource.com/586509
Reviewed-by: Egor Pasko <pasko@chromium.org>
Commit-Queue: Benoit L <lizeb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#489662}
[modify] https://crrev.com/c5cfa455b463e46f9f5355f498ce811cb52c03a2/tools/android/customtabs_benchmark/java/src/org/chromium/customtabs/test/MainActivity.java
[add] https://crrev.com/c5cfa455b463e46f9f5355f498ce811cb52c03a2/tools/android/customtabs_benchmark/scripts/PRESUBMIT.py
[modify] https://crrev.com/c5cfa455b463e46f9f5355f498ce811cb52c03a2/tools/android/customtabs_benchmark/scripts/customtabs_benchmark.py
[add] https://crrev.com/c5cfa455b463e46f9f5355f498ce811cb52c03a2/tools/android/customtabs_benchmark/scripts/customtabs_benchmark_unittest.py
[modify] https://crrev.com/c5cfa455b463e46f9f5355f498ce811cb52c03a2/tools/android/customtabs_benchmark/scripts/run_benchmark.py
[add] https://crrev.com/c5cfa455b463e46f9f5355f498ce811cb52c03a2/tools/android/customtabs_benchmark/scripts/run_tests
[modify] https://crrev.com/c5cfa455b463e46f9f5355f498ce811cb52c03a2/tools/android/customtabs_benchmark/scripts/sample_config.json

Another thing I noticed today is that EXTRA_IS_OPENED_BY_CHROME is not guarded by 
 isTrustedIntent().  We should make sure to not allow external apps to set that as it was previously removed on external intents in ChromeLauancherActivity

Comment 8 by dskiba@chromium.org, Jan 23 2018

Cc: dskiba@chromium.org
I'm curious what's the status of this?
Cc: tedc...@chromium.org
Owner: arthurso...@chromium.org
I am currently working on this, so I am updating it.

I ran the same benchmark Benoit did last year:
https://colab.research.google.com/drive/1P3VhudP1edK73Mwi906Jqe2-Nz45zaXn (https://example.com)
https://colab.research.google.com/drive/1xXckhHJoJ-kQ6wGNISmmCbWdIu8GTZMg (https://android.com)

I think the potential performance improvement is still the same than what Benoit showed in his benchmark last year.
I got an improvement of ~70ms (median). Benoit got ~100ms. I am using a Nexus 6P which is more high-end than what Benoit used.

I started a patch here: https://chromium-review.googlesource.com/c/chromium/src/+/1155114 which simply reuses Dmitry's patch: https://chromium-review.googlesource.com/c/chromium/src/+/667936. However, I still have a bit of work to do and things to check.
Project Member

Comment 10 by bugdroid1@chromium.org, Aug 31

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

commit aa76bac1230fc0b510d0299a5b51b6c2bdc86682
Author: arthursonzogni <arthursonzogni@chromium.org>
Date: Fri Aug 31 12:13:00 2018

Remove SeparateTaskcustomTabActivity for Android version > L.

Make SeparateTaskcustomTabActivity to be used only for Android version
pre L. The part used for Android version >= L is merged into
CustomTabActivity.

This is a prerequisite for skipping the ChromeLauncherActivity and
directly launch the CustomTabActivity.

Bug: 681559
Change-Id: Ifc33e25486bf70cb4fb25c15e6c33e16d6683157
Reviewed-on: https://chromium-review.googlesource.com/1188565
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#587995}
[modify] https://crrev.com/aa76bac1230fc0b510d0299a5b51b6c2bdc86682/chrome/android/java/AndroidManifest.xml
[modify] https://crrev.com/aa76bac1230fc0b510d0299a5b51b6c2bdc86682/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
[modify] https://crrev.com/aa76bac1230fc0b510d0299a5b51b6c2bdc86682/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
[modify] https://crrev.com/aa76bac1230fc0b510d0299a5b51b6c2bdc86682/chrome/android/java/src/org/chromium/chrome/browser/customtabs/SeparateTaskCustomTabActivity.java

Project Member

Comment 11 by bugdroid1@chromium.org, Aug 31

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

commit 2e1641787bfd4109f70d1b44c00f281e927b773b
Author: Arthur Sonzogni <arthursonzogni@chromium.org>
Date: Fri Aug 31 15:56:05 2018

Revert "Remove SeparateTaskcustomTabActivity for Android version > L."

This reverts commit aa76bac1230fc0b510d0299a5b51b6c2bdc86682.

Reason for revert: https://crbug.com/879587

Original change's description:
> Remove SeparateTaskcustomTabActivity for Android version > L.
> 
> Make SeparateTaskcustomTabActivity to be used only for Android version
> pre L. The part used for Android version >= L is merged into
> CustomTabActivity.
> 
> This is a prerequisite for skipping the ChromeLauncherActivity and
> directly launch the CustomTabActivity.
> 
> Bug: 681559
> Change-Id: Ifc33e25486bf70cb4fb25c15e6c33e16d6683157
> Reviewed-on: https://chromium-review.googlesource.com/1188565
> Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
> Reviewed-by: Ted Choc <tedchoc@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#587995}

TBR=tedchoc@chromium.org,lizeb@chromium.org,arthursonzogni@chromium.org

Change-Id: Iea4eb59149d1562edb021e01571c28d01b158f11
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 681559
Reviewed-on: https://chromium-review.googlesource.com/1199346
Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588039}
[modify] https://crrev.com/2e1641787bfd4109f70d1b44c00f281e927b773b/chrome/android/java/AndroidManifest.xml
[modify] https://crrev.com/2e1641787bfd4109f70d1b44c00f281e927b773b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
[modify] https://crrev.com/2e1641787bfd4109f70d1b44c00f281e927b773b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
[modify] https://crrev.com/2e1641787bfd4109f70d1b44c00f281e927b773b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/SeparateTaskCustomTabActivity.java

Project Member

Comment 12 by bugdroid1@chromium.org, Sep 5

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

commit 8eed4853f4f5c1be6721ac1116e1451c6ba0566f
Author: arthursonzogni <arthursonzogni@chromium.org>
Date: Wed Sep 05 07:40:35 2018

Reland: Remove SeparateTaskCustomTabActivity for Android version > L.

Cause of revert:
===============
A few MediaLauncherActivityTest don't run on the CQ. They were waiting
on SeparateTaskCustomTabActivity to finish, but it is no more used.

Original description:
=====================
Remove SeparateTaskcustomTabActivity for Android version > L.

Make SeparateTaskcustomTabActivity to be used only for Android version
pre L. The part used for Android version >= L is merged into
CustomTabActivity.

This is a prerequisite for skipping the ChromeLauncherActivity and
directly launch the CustomTabActivity.

TBR=tedchoc@chromium.org
R=lizeb@chromium.org

Bug: 681559
Change-Id: I121241a2f43f62c346a24adb153649bec3b80af3
Reviewed-on: https://chromium-review.googlesource.com/1201845
Reviewed-by: Benoit L <lizeb@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588788}
[modify] https://crrev.com/8eed4853f4f5c1be6721ac1116e1451c6ba0566f/chrome/android/java/AndroidManifest.xml
[modify] https://crrev.com/8eed4853f4f5c1be6721ac1116e1451c6ba0566f/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
[modify] https://crrev.com/8eed4853f4f5c1be6721ac1116e1451c6ba0566f/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
[modify] https://crrev.com/8eed4853f4f5c1be6721ac1116e1451c6ba0566f/chrome/android/java/src/org/chromium/chrome/browser/customtabs/SeparateTaskCustomTabActivity.java
[modify] https://crrev.com/8eed4853f4f5c1be6721ac1116e1451c6ba0566f/chrome/android/javatests/src/org/chromium/chrome/browser/media/MediaLauncherActivityTest.java

Project Member

Comment 13 by bugdroid1@chromium.org, Sep 6

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

commit bf7b4208139a5c375d7f41e64537057953b6195f
Author: Justin Donnelly <jdonnelly@chromium.org>
Date: Thu Sep 06 19:13:02 2018

Revert "Reland: Remove SeparateTaskCustomTabActivity for Android version > L."

This reverts commit 8eed4853f4f5c1be6721ac1116e1451c6ba0566f.

Reason for revert: Suspected of breaking the following test:
org.chromium.chrome.browser.browseractions.BrowserActionActivityTest.testOpenSingleTabInBackgroundWhenChromeAvailable

On the Android CFI bot:
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Android%20CFI

Original change's description:
> Reland: Remove SeparateTaskCustomTabActivity for Android version > L.
> 
> Cause of revert:
> ===============
> A few MediaLauncherActivityTest don't run on the CQ. They were waiting
> on SeparateTaskCustomTabActivity to finish, but it is no more used.
> 
> Original description:
> =====================
> Remove SeparateTaskcustomTabActivity for Android version > L.
> 
> Make SeparateTaskcustomTabActivity to be used only for Android version
> pre L. The part used for Android version >= L is merged into
> CustomTabActivity.
> 
> This is a prerequisite for skipping the ChromeLauncherActivity and
> directly launch the CustomTabActivity.
> 
> TBR=tedchoc@chromium.org
> R=​lizeb@chromium.org
> 
> Bug: 681559
> Change-Id: I121241a2f43f62c346a24adb153649bec3b80af3
> Reviewed-on: https://chromium-review.googlesource.com/1201845
> Reviewed-by: Benoit L <lizeb@chromium.org>
> Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#588788}

TBR=lizeb@chromium.org,arthursonzogni@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 681559
Change-Id: I002cddd65d1fc326c5a212671d4f7d07355689a6
Reviewed-on: https://chromium-review.googlesource.com/1211242
Reviewed-by: Justin Donnelly <jdonnelly@chromium.org>
Commit-Queue: Justin Donnelly <jdonnelly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589233}
[modify] https://crrev.com/bf7b4208139a5c375d7f41e64537057953b6195f/chrome/android/java/AndroidManifest.xml
[modify] https://crrev.com/bf7b4208139a5c375d7f41e64537057953b6195f/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
[modify] https://crrev.com/bf7b4208139a5c375d7f41e64537057953b6195f/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
[modify] https://crrev.com/bf7b4208139a5c375d7f41e64537057953b6195f/chrome/android/java/src/org/chromium/chrome/browser/customtabs/SeparateTaskCustomTabActivity.java
[modify] https://crrev.com/bf7b4208139a5c375d7f41e64537057953b6195f/chrome/android/javatests/src/org/chromium/chrome/browser/media/MediaLauncherActivityTest.java

Project Member

Comment 14 by bugdroid1@chromium.org, Sep 12

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

commit 33eb0779779e281bac7609f94842463c3f8f2ee0
Author: arthursonzogni <arthursonzogni@chromium.org>
Date: Wed Sep 12 07:21:49 2018

Reland: Remove SeparateTaskCustomTabActivity for Android version > L.

Cause of revert:
===============
BrowserActionActivityTest#testOpenSingleTabInBackgroundWhenChromeAvailable was
failing.

LaunchIntentDispatcher was no more forcing the flag:
FLAG_ACTIVITY_NEW_DOCUMENT.

Original description:
=====================
Remove SeparateTaskcustomTabActivity for Android version > L.

Make SeparateTaskcustomTabActivity to be used only for Android version
pre L. The part used for Android version >= L is merged into
CustomTabActivity.

This is a prerequisite for skipping the ChromeLauncherActivity and
directly launch the CustomTabActivity.

Bug: 681559,  881086 
Change-Id: I0135b0c8f217ebe528e85ddf7e047483fe07a156
Reviewed-on: https://chromium-review.googlesource.com/1213002
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590611}
[modify] https://crrev.com/33eb0779779e281bac7609f94842463c3f8f2ee0/chrome/android/java/AndroidManifest.xml
[modify] https://crrev.com/33eb0779779e281bac7609f94842463c3f8f2ee0/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
[modify] https://crrev.com/33eb0779779e281bac7609f94842463c3f8f2ee0/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
[modify] https://crrev.com/33eb0779779e281bac7609f94842463c3f8f2ee0/chrome/android/java/src/org/chromium/chrome/browser/customtabs/SeparateTaskCustomTabActivity.java
[modify] https://crrev.com/33eb0779779e281bac7609f94842463c3f8f2ee0/chrome/android/javatests/src/org/chromium/chrome/browser/media/MediaLauncherActivityTest.java

Sign in to add a comment