Merge "Handle the case where launch root is not attached" into udc-dev am: a7afe1ab46

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23317855

Change-Id: I7154119d69213607fa76581726fdf52351f6e1f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-05-18 20:04:39 +00:00
committed by Automerger Merge Worker

View File

@@ -845,11 +845,14 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
case HIERARCHY_OP_TYPE_SET_LAUNCH_ROOT: {
final WindowContainer wc = WindowContainer.fromBinder(hop.getContainer());
final Task task = wc != null ? wc.asTask() : null;
if (task != null) {
if (task == null) {
throw new IllegalArgumentException("Cannot set non-task as launch root: " + wc);
} else if (task.getTaskDisplayArea() == null) {
throw new IllegalArgumentException("Cannot set a task without display area as "
+ "launch root: " + wc);
} else {
task.getDisplayArea().setLaunchRootTask(task,
hop.getWindowingModes(), hop.getActivityTypes());
} else {
throw new IllegalArgumentException("Cannot set non-task as launch root: " + wc);
}
break;
}