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: Icfe0a17d7f6f127acaae8400a97e8bdc53fcc9ad
This commit is contained in:
Hani Kazmi
2023-05-22 15:19:10 +00:00
parent 25aa2d3c87
commit 7492cc2730

View File

@@ -1821,7 +1821,8 @@ class ActivityStarter {
// If Activity's launching into PiP, move the mStartActivity immediately to pinned mode. // 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. // Note that mStartActivity and source should be in the same Task at this point.
if (mOptions != null && mOptions.isLaunchIntoPip() if (mOptions != null && mOptions.isLaunchIntoPip()
&& sourceRecord != null && sourceRecord.getTask() == mStartActivity.getTask()) { && sourceRecord != null && sourceRecord.getTask() == mStartActivity.getTask()
&& balCode != BAL_BLOCK) {
mRootWindowContainer.moveActivityToPinnedRootTask(mStartActivity, mRootWindowContainer.moveActivityToPinnedRootTask(mStartActivity,
sourceRecord, "launch-into-pip"); sourceRecord, "launch-into-pip");
} }