Allow moveActivityTaskToBack on aliased activities

When checking if the task root should be moved to the back following a
back button press, we need to ensure the behavior matches when
activities are launched via other activity-aliases for which it is a
target.

This means we need to check if the root activity matches the
realActivity (the resolved target activity of aliases) instead of the
base intent (which could include unresolved aliases).

Bug: 195362544
Test: manual with test app
Change-Id: Idb3ae6aba709c3dcfbe6cae01f46e4bafe7ab94f
This commit is contained in:
Prabir Pradhan
2021-08-03 13:56:11 -07:00
parent 39700979b7
commit 68ac617a4b

View File

@@ -1197,10 +1197,10 @@ class ActivityClientController extends IActivityClientController.Stub {
final Task task = r.getTask();
isLastRunningActivity = task.topRunningActivity() == r;
final Intent baseIntent = task.getBaseIntent();
final boolean activityIsBaseActivity = baseIntent != null
&& r.mActivityComponent.equals(baseIntent.getComponent());
baseActivityIntent = activityIsBaseActivity ? r.intent : null;
final boolean isBaseActivity = r.mActivityComponent.equals(task.realActivity);
baseActivityIntent = isBaseActivity ? r.intent : null;
launchedFromHome = r.isLaunchSourceType(ActivityRecord.LAUNCH_SOURCE_TYPE_HOME);
}