Add ability to hide DisplayAreas through WindowOrganizer

We add a separate code path to handle DisplayAreas specific transactions
and ability to hide DisplayAreas by applying hidden flag to all tasks
of specific DisplayAreas.

Test: atest WmTests:WindowOrganizerTests#testDisplayAreaHiddenTransaction
Bug: 152116327
Change-Id: Iec4315da27f6f7ffe56d8fee5141dc9d8dfb3560
(cherry picked from commit 0be8abd855295af6ec67b51c3e74dbc12811b06f)
This commit is contained in:
yunho.shin
2020-05-19 19:02:51 +09:00
committed by chaviw
parent 93fc52709e
commit 3cef609e65
2 changed files with 42 additions and 1 deletions

View File

@@ -290,6 +290,22 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
return effects;
}
private int applyDisplayAreaChanges(WindowContainer container,
WindowContainerTransaction.Change c) {
final int[] effects = new int[1];
container.forAllTasks(task -> {
Task tr = (Task) task;
if ((c.getChangeMask() & WindowContainerTransaction.Change.CHANGE_HIDDEN) != 0) {
if (tr.setForceHidden(FLAG_FORCE_HIDDEN_FOR_TASK_ORG, c.getHidden())) {
effects[0] |= TRANSACT_EFFECTS_LIFECYCLE;
}
}
});
return effects[0];
}
private int sanitizeAndApplyHierarchyOp(WindowContainer container,
WindowContainerTransaction.HierarchyOp hop) {
final Task task = container.asTask();
@@ -366,7 +382,9 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
int effects = applyChanges(wc, c);
if (wc instanceof Task) {
if (wc instanceof DisplayArea) {
effects |= applyDisplayAreaChanges(wc, c);
} else if (wc instanceof Task) {
effects |= applyTaskChanges(wc.asTask(), c);
}

View File

@@ -1013,4 +1013,27 @@ public class WindowOrganizerTests extends WindowTestsBase {
assertFalse(w1.useBLASTSync());
assertFalse(w2.useBLASTSync());
}
@Test
public void testDisplayAreaHiddenTransaction() {
removeGlobalMinSizeRestriction();
WindowContainerTransaction trx = new WindowContainerTransaction();
TaskDisplayArea taskDisplayArea = mDisplayContent.getDefaultTaskDisplayArea();
trx.setHidden(taskDisplayArea.mRemoteToken.toWindowContainerToken(), true);
mWm.mAtmService.mWindowOrganizerController.applyTransaction(trx);
taskDisplayArea.forAllTasks(daTask -> {
assertTrue(daTask.isForceHidden());
});
trx.setHidden(taskDisplayArea.mRemoteToken.toWindowContainerToken(), false);
mWm.mAtmService.mWindowOrganizerController.applyTransaction(trx);
taskDisplayArea.forAllTasks(daTask -> {
assertFalse(daTask.isForceHidden());
});
}
}