From 68ac617a4b363fc3a6f3bac5dd677d8e2d799c97 Mon Sep 17 00:00:00 2001 From: Prabir Pradhan Date: Tue, 3 Aug 2021 13:56:11 -0700 Subject: [PATCH] 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 --- .../com/android/server/wm/ActivityClientController.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/wm/ActivityClientController.java b/services/core/java/com/android/server/wm/ActivityClientController.java index 331b8dee48700..675c7eb23f2c2 100644 --- a/services/core/java/com/android/server/wm/ActivityClientController.java +++ b/services/core/java/com/android/server/wm/ActivityClientController.java @@ -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); }