Commit 4d869376 authored by Brandon Wylie's avatar Brandon Wylie Committed by Commit Bot

Fix ChromeTabbedActivity clobbering when recreating in multi-window

The current implementation is looking for a currently running tabbed
activity to handle the incoming intent. This is the correct thing to do
when handling outside intends, such as an open request from a messaging
app.  When reparenting tabs in multi-window mode, this clobbers a
ChromeTabbedActivity instance which is being recreated as a result of a
theme change.

Bug: 1055228
Change-Id: I722365c43ec97ab12120e9139eb43a781de8090a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2117062Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Brandon Wylie <wylieb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754780}
parent 3680421c
......@@ -468,7 +468,16 @@ public class ChromeTabbedActivity
}
@Override
protected @LaunchIntentDispatcher.Action int maybeDispatchLaunchIntent(Intent intent) {
protected @LaunchIntentDispatcher.Action int maybeDispatchLaunchIntent(
Intent intent, Bundle savedInstanceState) {
// Detect if incoming intent is a result of Chrome recreating itself. For now, restrict this
// path to reparenting to ensure the launching logic isn't disrupted.
// TODO(crbug.com/1065491): Unlock this codepath for all incoming intents once it's
// confirmed working and stable.
if (savedInstanceState != null && AsyncTabParamsManager.hasParamsWithTabToReparent()) {
return LaunchIntentDispatcher.Action.CONTINUE;
}
if (getClass().equals(ChromeTabbedActivity.class)
&& Intent.ACTION_MAIN.equals(intent.getAction())) {
......@@ -484,7 +493,7 @@ public class ChromeTabbedActivity
if (action != LaunchIntentDispatcher.Action.CONTINUE) {
return action;
}
return super.maybeDispatchLaunchIntent(intent);
return super.maybeDispatchLaunchIntent(intent, savedInstanceState);
}
// We know of at least one app that explicitly specifies .Main activity in custom tab
......
......@@ -272,7 +272,8 @@ public abstract class AsyncInitializationActivity extends ChromeBaseAppCompatAct
* @param intent intent to dispatch
* @return {@link LaunchIntentDispatcher.Action} to take
*/
protected @LaunchIntentDispatcher.Action int maybeDispatchLaunchIntent(Intent intent) {
protected @LaunchIntentDispatcher.Action int maybeDispatchLaunchIntent(
Intent intent, Bundle savedInstanceState) {
return LaunchIntentDispatcher.Action.CONTINUE;
}
......@@ -281,7 +282,7 @@ public abstract class AsyncInitializationActivity extends ChromeBaseAppCompatAct
setIntent(validateIntent(getIntent()));
@LaunchIntentDispatcher.Action
int dispatchAction = maybeDispatchLaunchIntent(getIntent());
int dispatchAction = maybeDispatchLaunchIntent(getIntent(), savedInstanceState);
if (dispatchAction != LaunchIntentDispatcher.Action.CONTINUE) {
abortLaunch(dispatchAction);
return;
......
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