Loading services/core/java/com/android/server/wm/DisplayContent.java +28 −24 Original line number Original line Diff line number Diff line Loading @@ -283,6 +283,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp */ */ private SurfaceControl mOverlayLayer; private SurfaceControl mOverlayLayer; /** * The direct child layer of the display to put all non-overlay windows. This is also used for * screen rotation animation so that there is a parent layer to put the animation leash. */ private final SurfaceControl mWindowingLayer; // Contains all IME window containers. Note that the z-ordering of the IME windows will depend // Contains all IME window containers. Note that the z-ordering of the IME windows will depend // on the IME target. We mainly have this container grouping so we can keep track of all the IME // on the IME target. We mainly have this container grouping so we can keep track of all the IME // window containers together and move them in-sync if/when needed. We use a subclass of // window containers together and move them in-sync if/when needed. We use a subclass of Loading @@ -294,7 +300,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp final DisplayAreaPolicy mDisplayAreaPolicy; final DisplayAreaPolicy mDisplayAreaPolicy; private WindowState mTmpWindow; private WindowState mTmpWindow; private WindowState mTmpWindow2; private boolean mUpdateImeTarget; private boolean mUpdateImeTarget; private boolean mTmpInitial; private boolean mTmpInitial; private int mMaxUiWidth; private int mMaxUiWidth; Loading Loading @@ -459,10 +464,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp private final ApplySurfaceChangesTransactionState mTmpApplySurfaceChangesTransactionState = private final ApplySurfaceChangesTransactionState mTmpApplySurfaceChangesTransactionState = new ApplySurfaceChangesTransactionState(); new ApplySurfaceChangesTransactionState(); // True if this display is in the process of being removed. Used to determine if the removal of // the display's direct children should be allowed. private boolean mRemovingDisplay = false; // {@code false} if this display is in the processing of being created. // {@code false} if this display is in the processing of being created. private boolean mDisplayReady = false; private boolean mDisplayReady = false; Loading Loading @@ -1023,6 +1024,27 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp .setContainerLayer() .setContainerLayer() .setCallsite("DisplayContent"); .setCallsite("DisplayContent"); mSurfaceControl = b.setName("Root").setContainerLayer().build(); mSurfaceControl = b.setName("Root").setContainerLayer().build(); // Setup the policy and build the display area hierarchy. mDisplayAreaPolicy = mWmService.getDisplayAreaPolicyProvider().instantiate( mWmService, this /* content */, this /* root */, mImeWindowsContainers); final List<DisplayArea<? extends WindowContainer>> areas = mDisplayAreaPolicy.getDisplayAreas(FEATURE_WINDOWED_MAGNIFICATION); final DisplayArea<?> area = areas.size() == 1 ? areas.get(0) : null; if (area != null && area.getParent() == this) { // The windowed magnification area should contain all non-overlay windows, so just use // it as the windowing layer. mWindowingLayer = area.mSurfaceControl; } else { // Need an additional layer for screen level animation, so move the layer containing // the windows to the new root. mWindowingLayer = mSurfaceControl; mSurfaceControl = b.setName("RootWrapper").build(); getPendingTransaction().reparent(mWindowingLayer, mSurfaceControl) .show(mWindowingLayer); } mOverlayLayer = b.setName("Display Overlays").setParent(mSurfaceControl).build(); mOverlayLayer = b.setName("Display Overlays").setParent(mSurfaceControl).build(); getPendingTransaction() getPendingTransaction() Loading @@ -1033,10 +1055,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp .show(mOverlayLayer); .show(mOverlayLayer); getPendingTransaction().apply(); getPendingTransaction().apply(); // Setup the policy and build the display area hierarchy. mDisplayAreaPolicy = mWmService.getDisplayAreaPolicyProvider().instantiate( mWmService, this /* content */, this /* root */, mImeWindowsContainers); // Sets the display content for the children. // Sets the display content for the children. onDisplayChanged(this); onDisplayChanged(this); Loading Loading @@ -2796,7 +2814,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp @Override @Override void removeImmediately() { void removeImmediately() { mRemovingDisplay = true; mDeferredRemoval = false; mDeferredRemoval = false; try { try { if (mParentWindow != null) { if (mParentWindow != null) { Loading @@ -2820,7 +2837,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mWmService.mDisplayNotificationController.dispatchDisplayRemoved(this); mWmService.mDisplayNotificationController.dispatchDisplayRemoved(this); } finally { } finally { mDisplayReady = false; mDisplayReady = false; mRemovingDisplay = false; } } // Apply the pending transaction here since we may not be able to reach the DisplayContent // Apply the pending transaction here since we may not be able to reach the DisplayContent Loading Loading @@ -4190,7 +4206,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Used to indicate that we have processed the dream window and all additional attached // Used to indicate that we have processed the dream window and all additional attached // windows are behind it. // windows are behind it. mTmpWindow2 = mTmpWindow; mTmpWindow = null; mTmpWindow = null; // Now perform layout of attached windows, which usually depend on the position of the // Now perform layout of attached windows, which usually depend on the position of the Loading Loading @@ -4860,19 +4875,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp }, false /* traverseTopToBottom */); }, false /* traverseTopToBottom */); } } private DisplayArea getWindowContainers() { List<DisplayArea<? extends WindowContainer>> windowContainers = mDisplayAreaPolicy.getDisplayAreas(FEATURE_WINDOWED_MAGNIFICATION); if (windowContainers.size() != 1) { throw new IllegalStateException("There should be only one DisplayArea for " + "FEATURE_WINDOWED_MAGNIFICATION"); } return windowContainers.get(0); } @VisibleForTesting SurfaceControl getWindowingLayer() { SurfaceControl getWindowingLayer() { return getWindowContainers().getSurfaceControl(); return mWindowingLayer; } } DisplayArea.Tokens getImeContainer() { DisplayArea.Tokens getImeContainer() { Loading services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION; import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.window.DisplayAreaOrganizer.FEATURE_WINDOWED_MAGNIFICATION; import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean; import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean; Loading Loading @@ -106,6 +107,7 @@ import android.view.IWindowManager; import android.view.InsetsState; import android.view.InsetsState; import android.view.MotionEvent; import android.view.MotionEvent; import android.view.Surface; import android.view.Surface; import android.view.SurfaceControl; import android.view.SurfaceControl.Transaction; import android.view.SurfaceControl.Transaction; import android.view.WindowManager; import android.view.WindowManager; Loading Loading @@ -1533,6 +1535,22 @@ public class DisplayContentTests extends WindowTestsBase { assertNull(taskDisplayArea.getOrCreateRootHomeTask()); assertNull(taskDisplayArea.getOrCreateRootHomeTask()); } } @Test public void testValidWindowingLayer() { final SurfaceControl windowingLayer = mDisplayContent.getWindowingLayer(); assertNotNull(windowingLayer); final List<DisplayArea<?>> windowedMagnificationAreas = mDisplayContent.mDisplayAreaPolicy.getDisplayAreas(FEATURE_WINDOWED_MAGNIFICATION); if (windowedMagnificationAreas != null) { assertEquals("There should be only one DisplayArea for FEATURE_WINDOWED_MAGNIFICATION", 1, windowedMagnificationAreas.size()); assertEquals(windowedMagnificationAreas.get(0).mSurfaceControl, windowingLayer); } else { assertNotEquals(mDisplayContent.mSurfaceControl, windowingLayer); } } @Test @Test public void testFindScrollCaptureTargetWindow_behindWindow() { public void testFindScrollCaptureTargetWindow_behindWindow() { DisplayContent display = createNewDisplay(); DisplayContent display = createNewDisplay(); Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +28 −24 Original line number Original line Diff line number Diff line Loading @@ -283,6 +283,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp */ */ private SurfaceControl mOverlayLayer; private SurfaceControl mOverlayLayer; /** * The direct child layer of the display to put all non-overlay windows. This is also used for * screen rotation animation so that there is a parent layer to put the animation leash. */ private final SurfaceControl mWindowingLayer; // Contains all IME window containers. Note that the z-ordering of the IME windows will depend // Contains all IME window containers. Note that the z-ordering of the IME windows will depend // on the IME target. We mainly have this container grouping so we can keep track of all the IME // on the IME target. We mainly have this container grouping so we can keep track of all the IME // window containers together and move them in-sync if/when needed. We use a subclass of // window containers together and move them in-sync if/when needed. We use a subclass of Loading @@ -294,7 +300,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp final DisplayAreaPolicy mDisplayAreaPolicy; final DisplayAreaPolicy mDisplayAreaPolicy; private WindowState mTmpWindow; private WindowState mTmpWindow; private WindowState mTmpWindow2; private boolean mUpdateImeTarget; private boolean mUpdateImeTarget; private boolean mTmpInitial; private boolean mTmpInitial; private int mMaxUiWidth; private int mMaxUiWidth; Loading Loading @@ -459,10 +464,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp private final ApplySurfaceChangesTransactionState mTmpApplySurfaceChangesTransactionState = private final ApplySurfaceChangesTransactionState mTmpApplySurfaceChangesTransactionState = new ApplySurfaceChangesTransactionState(); new ApplySurfaceChangesTransactionState(); // True if this display is in the process of being removed. Used to determine if the removal of // the display's direct children should be allowed. private boolean mRemovingDisplay = false; // {@code false} if this display is in the processing of being created. // {@code false} if this display is in the processing of being created. private boolean mDisplayReady = false; private boolean mDisplayReady = false; Loading Loading @@ -1023,6 +1024,27 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp .setContainerLayer() .setContainerLayer() .setCallsite("DisplayContent"); .setCallsite("DisplayContent"); mSurfaceControl = b.setName("Root").setContainerLayer().build(); mSurfaceControl = b.setName("Root").setContainerLayer().build(); // Setup the policy and build the display area hierarchy. mDisplayAreaPolicy = mWmService.getDisplayAreaPolicyProvider().instantiate( mWmService, this /* content */, this /* root */, mImeWindowsContainers); final List<DisplayArea<? extends WindowContainer>> areas = mDisplayAreaPolicy.getDisplayAreas(FEATURE_WINDOWED_MAGNIFICATION); final DisplayArea<?> area = areas.size() == 1 ? areas.get(0) : null; if (area != null && area.getParent() == this) { // The windowed magnification area should contain all non-overlay windows, so just use // it as the windowing layer. mWindowingLayer = area.mSurfaceControl; } else { // Need an additional layer for screen level animation, so move the layer containing // the windows to the new root. mWindowingLayer = mSurfaceControl; mSurfaceControl = b.setName("RootWrapper").build(); getPendingTransaction().reparent(mWindowingLayer, mSurfaceControl) .show(mWindowingLayer); } mOverlayLayer = b.setName("Display Overlays").setParent(mSurfaceControl).build(); mOverlayLayer = b.setName("Display Overlays").setParent(mSurfaceControl).build(); getPendingTransaction() getPendingTransaction() Loading @@ -1033,10 +1055,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp .show(mOverlayLayer); .show(mOverlayLayer); getPendingTransaction().apply(); getPendingTransaction().apply(); // Setup the policy and build the display area hierarchy. mDisplayAreaPolicy = mWmService.getDisplayAreaPolicyProvider().instantiate( mWmService, this /* content */, this /* root */, mImeWindowsContainers); // Sets the display content for the children. // Sets the display content for the children. onDisplayChanged(this); onDisplayChanged(this); Loading Loading @@ -2796,7 +2814,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp @Override @Override void removeImmediately() { void removeImmediately() { mRemovingDisplay = true; mDeferredRemoval = false; mDeferredRemoval = false; try { try { if (mParentWindow != null) { if (mParentWindow != null) { Loading @@ -2820,7 +2837,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp mWmService.mDisplayNotificationController.dispatchDisplayRemoved(this); mWmService.mDisplayNotificationController.dispatchDisplayRemoved(this); } finally { } finally { mDisplayReady = false; mDisplayReady = false; mRemovingDisplay = false; } } // Apply the pending transaction here since we may not be able to reach the DisplayContent // Apply the pending transaction here since we may not be able to reach the DisplayContent Loading Loading @@ -4190,7 +4206,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp // Used to indicate that we have processed the dream window and all additional attached // Used to indicate that we have processed the dream window and all additional attached // windows are behind it. // windows are behind it. mTmpWindow2 = mTmpWindow; mTmpWindow = null; mTmpWindow = null; // Now perform layout of attached windows, which usually depend on the position of the // Now perform layout of attached windows, which usually depend on the position of the Loading Loading @@ -4860,19 +4875,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp }, false /* traverseTopToBottom */); }, false /* traverseTopToBottom */); } } private DisplayArea getWindowContainers() { List<DisplayArea<? extends WindowContainer>> windowContainers = mDisplayAreaPolicy.getDisplayAreas(FEATURE_WINDOWED_MAGNIFICATION); if (windowContainers.size() != 1) { throw new IllegalStateException("There should be only one DisplayArea for " + "FEATURE_WINDOWED_MAGNIFICATION"); } return windowContainers.get(0); } @VisibleForTesting SurfaceControl getWindowingLayer() { SurfaceControl getWindowingLayer() { return getWindowContainers().getSurfaceControl(); return mWindowingLayer; } } DisplayArea.Tokens getImeContainer() { DisplayArea.Tokens getImeContainer() { Loading
services/tests/wmtests/src/com/android/server/wm/DisplayContentTests.java +18 −0 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_SCREENSHOT; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR; import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION; import static android.view.WindowManager.LayoutParams.TYPE_VOICE_INTERACTION; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; import static android.window.DisplayAreaOrganizer.FEATURE_WINDOWED_MAGNIFICATION; import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; import static com.android.dx.mockito.inline.extended.ExtendedMockito.any; import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean; import static com.android.dx.mockito.inline.extended.ExtendedMockito.anyBoolean; Loading Loading @@ -106,6 +107,7 @@ import android.view.IWindowManager; import android.view.InsetsState; import android.view.InsetsState; import android.view.MotionEvent; import android.view.MotionEvent; import android.view.Surface; import android.view.Surface; import android.view.SurfaceControl; import android.view.SurfaceControl.Transaction; import android.view.SurfaceControl.Transaction; import android.view.WindowManager; import android.view.WindowManager; Loading Loading @@ -1533,6 +1535,22 @@ public class DisplayContentTests extends WindowTestsBase { assertNull(taskDisplayArea.getOrCreateRootHomeTask()); assertNull(taskDisplayArea.getOrCreateRootHomeTask()); } } @Test public void testValidWindowingLayer() { final SurfaceControl windowingLayer = mDisplayContent.getWindowingLayer(); assertNotNull(windowingLayer); final List<DisplayArea<?>> windowedMagnificationAreas = mDisplayContent.mDisplayAreaPolicy.getDisplayAreas(FEATURE_WINDOWED_MAGNIFICATION); if (windowedMagnificationAreas != null) { assertEquals("There should be only one DisplayArea for FEATURE_WINDOWED_MAGNIFICATION", 1, windowedMagnificationAreas.size()); assertEquals(windowedMagnificationAreas.get(0).mSurfaceControl, windowingLayer); } else { assertNotEquals(mDisplayContent.mSurfaceControl, windowingLayer); } } @Test @Test public void testFindScrollCaptureTargetWindow_behindWindow() { public void testFindScrollCaptureTargetWindow_behindWindow() { DisplayContent display = createNewDisplay(); DisplayContent display = createNewDisplay(); Loading