From 1848b559059e021d1a923513ca2a936c6212a7ac Mon Sep 17 00:00:00 2001 From: Hani Kazmi Date: Tue, 23 May 2023 17:28:56 +0000 Subject: [PATCH] Update Pip launches to not enter pinned task if in background. Addresses a BAL bypass where Pip could be started without the launcher being visible. Bug: 271576718 Test: atest CtsWindowManagerDeviceTestCases:PinnedStackTests Test: atest android.server.wm.BackgroundActivityLaunchTest#testPipCannotStartFromBackground Change-Id: Ibadc9c21f1d23f9904fc11009a9c2a40535db5e0 Merged-In: Icfe0a17d7f6f127acaae8400a97e8bdc53fcc9ad --- services/core/java/com/android/server/wm/ActivityStarter.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index ec9babf09ef32..4633e34f78f60 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -1946,7 +1946,8 @@ class ActivityStarter { // If Activity's launching into PiP, move the mStartActivity immediately to pinned mode. // Note that mStartActivity and source should be in the same Task at this point. if (mOptions != null && mOptions.isLaunchIntoPip() - && sourceRecord != null && sourceRecord.getTask() == mStartActivity.getTask()) { + && sourceRecord != null && sourceRecord.getTask() == mStartActivity.getTask() + && !mRestrictedBgActivity) { mRootWindowContainer.moveActivityToPinnedRootTask(mStartActivity, sourceRecord, "launch-into-pip"); }