Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 148771ef authored by Orhan Uysal's avatar Orhan Uysal
Browse files

Disallow reparenting into a leaf task.

Allowing task to task reparenting ends up reparenting under a leaf task
for certain cts tests.

Bug: 434499068
Test: atest CtsWindowManagerDeviceWindow:MultiWindowTests & observe that
there is no exception thrown
Flag: com.android.window.flags.enable_desktop_windowing_enterprise_bugfix

Change-Id: I0727dacf950ea113480e456c9fb014f77e53e3c3
parent cdbee107
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1338,6 +1338,15 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                    if (isLockTaskModeViolation(wc.getParent(), wc.asTask(), isInLockTaskMode)) {
                        break;
                    }
                }  else if (type == HIERARCHY_OP_TYPE_REPARENT && hop.getNewParent() != null) {
                    final WindowContainer parentWc = WindowContainer.fromBinder(hop.getNewParent());
                    final Task parentTask = parentWc != null ? parentWc.asTask() : null;
                    if (parentTask != null && parentTask.isLeafTask()
                            && parentTask.hasDirectChildActivities()) {
                        Slog.w(TAG, "Skip applying hierarchy operation " + hop
                                + " on a leaf task.");
                        break;
                    }
                }
                if (syncId >= 0) {
                    addToSyncSet(syncId, wc);