Commit 9b8776ec authored by Dmitry Skiba's avatar Dmitry Skiba Committed by Commit Bot

Handle MAIN intents in ChromeTabbedActivity.

This is a follow-up to crrev.com/c/667936 which moved MAIN/LAUNCHER
handling into separate .LauncherMain activity alias.

That CL caused existing Chrome app shortcuts to disappear on update.
Turned out that Android launcher creates {MAIN/LAUNCHER, <component>}
intents for app shortcuts (i.e. it bakes in the component), and then
checks that after each update MAIN/LAUNCHER intent for the app resolves
to the shortcut's component. If that check fails, launcher removes the
shortcut.

This means that MAIN/LAUNCHER intents must continue to be handled by
.Main activity alias.

This CL does two renamings:

1. Renames .Main activity alias to .IntentDispatcher alias
2. Renames .LauncherMain alias to .Main

I.e. MAIN/LAUNCHER intents are now handled by .Main alias, making sure
shortcuts won't be removed.

Additionally this CL moves more MAIN categories from .IntentDispatcher
into .Main alias, so that almost all MAIN intents are handled by .Main
(one exception is NOTIFICATION_PREFERENCES, as it needs dispatching).

Bug: 761606
Change-Id: I6cb926c4677758190f743260e11a85129c8863bb
Reviewed-on: https://chromium-review.googlesource.com/700803
Commit-Queue: Dmitry Skiba <dskiba@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506825}
parent c3b2de66
......@@ -172,17 +172,12 @@ by a child template that "extends" this file.
android:excludeFromRecents="true"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|mcc|mnc|screenLayout|smallestScreenSize">
</activity>
<activity-alias android:name="com.google.android.apps.chrome.Main"
<activity-alias android:name="com.google.android.apps.chrome.IntentDispatcher"
android:targetActivity="org.chromium.chrome.browser.document.ChromeLauncherActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.APP_BROWSER" />
<category android:name="android.intent.category.NOTIFICATION_PREFERENCES" />
{% if channel in ['dev', 'canary', 'default'] %}
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
{% endif %}
</intent-filter>
<!-- Matches the common case of intents with no MIME type.
Make sure to keep in sync with the next filter. -->
......@@ -403,13 +398,18 @@ by a child template that "extends" this file.
</intent-filter>
{% endblock %}
</activity>
<activity-alias android:name="com.google.android.apps.chrome.LauncherMain"
<activity-alias android:name="com.google.android.apps.chrome.Main"
android:targetActivity="org.chromium.chrome.browser.ChromeTabbedActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.APP_BROWSER" />
{% if channel in ['dev', 'canary', 'default'] %}
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER" />
{% endif %}
</intent-filter>
</activity-alias>
<activity android:name="org.chromium.chrome.browser.ChromeTabbedActivity2"
......
......@@ -217,9 +217,8 @@ public class ChromeTabbedActivity
*/
private static final long TIME_SINCE_BACKGROUNDED_TO_SHOW_BOTTOM_SHEET_HALF_MS = 10800000L;
// Name of the ChromeTabbedActivity alias that handles MAIN + DEFAULT/LAUNCHER intents.
private static final String MAIN_LAUNCHER_ACTIVITY_NAME =
"com.google.android.apps.chrome.LauncherMain";
// Name of the ChromeTabbedActivity alias that handles MAIN intents.
private static final String MAIN_LAUNCHER_ACTIVITY_NAME = "com.google.android.apps.chrome.Main";
private final ActivityStopMetrics mActivityStopMetrics;
private final MainIntentBehaviorMetrics mMainIntentMetrics;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment