Remove pinned tasks when starting locked task w/ intent

When a task is started w/ flags from an intent, it directly calls into
LockTaskController#startLockTaskMode. This misses the other code called
normally in ActivityTaskManagerService#startLockTaskMode such as closing
any pinned apps.

We fix this by moving this logic down a level to the common code path
shared by both

Bug: 295207389
Test: repro in bug
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6b6d5b9ab3a7623af264852c47136b5ca5fe7cbc)
Merged-In: Id7386eae96cd014bf41ab3c4184ba9f3a79bdf10
Change-Id: Id7386eae96cd014bf41ab3c4184ba9f3a79bdf10
This commit is contained in:
Kevin Han
2023-08-11 22:00:07 +00:00
parent 91e32fa426
commit 96d2e1b74d
2 changed files with 4 additions and 3 deletions

View File

@@ -2596,9 +2596,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
final int callingUid = Binder.getCallingUid();
final long ident = Binder.clearCallingIdentity();
try {
// When a task is locked, dismiss the root pinned task if it exists
mRootWindowContainer.removeRootTasksInWindowingModes(WINDOWING_MODE_PINNED);
getLockTaskController().startLockTaskMode(task, isSystemCaller, callingUid);
} finally {
Binder.restoreCallingIdentity(ident);

View File

@@ -19,6 +19,7 @@ package com.android.server.wm;
import static android.app.ActivityManager.LOCK_TASK_MODE_LOCKED;
import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
import static android.app.ActivityManager.LOCK_TASK_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.Context.DEVICE_POLICY_SERVICE;
import static android.content.Context.STATUS_BAR_SERVICE;
@@ -669,6 +670,9 @@ public class LockTaskController {
}
}
// When a task is locked, dismiss the root pinned task if it exists
mSupervisor.mRootWindowContainer.removeRootTasksInWindowingModes(WINDOWING_MODE_PINNED);
// System can only initiate screen pinning, not full lock task mode
ProtoLog.w(WM_DEBUG_LOCKTASK, "%s", isSystemCaller ? "Locking pinned" : "Locking fully");
setLockTaskMode(task, isSystemCaller ? LOCK_TASK_MODE_PINNED : LOCK_TASK_MODE_LOCKED,