Re-route to default display if the home activity doesn't support multi-display

If a user operates on secondary display to change the default home,
system will launch the home activity on secondary display even if the
home activity is not support multi-display.

Add more conditions to re-route to default display if the home activity
doesn't support multi-display when deciding the prefer task display
area.

Bug: 179329207
Test: atest ActivityStarterTests
Change-Id: I32e3f369f03f60c6e8891f2876272c5e6b375eb5
This commit is contained in:
Chilun
2021-04-14 12:33:38 +08:00
parent f18be5595d
commit 37fc6b90ca

View File

@@ -439,6 +439,13 @@ class TaskLaunchParamsModifier implements LaunchParamsModifier {
taskDisplayArea = mSupervisor.mRootWindowContainer.getDefaultTaskDisplayArea();
}
// Re-route to default display if the home activity doesn't support multi-display
if (taskDisplayArea != null && activityRecord.isActivityTypeHome()
&& !mSupervisor.mRootWindowContainer.canStartHomeOnDisplayArea(activityRecord.info,
taskDisplayArea, false /* allowInstrumenting */)) {
taskDisplayArea = mSupervisor.mRootWindowContainer.getDefaultTaskDisplayArea();
}
return (taskDisplayArea != null)
? taskDisplayArea
: getFallbackDisplayAreaForActivity(activityRecord, request);