diff options
| author | 2022-06-09 07:59:00 +0000 | |
|---|---|---|
| committer | 2022-06-09 07:59:00 +0000 | |
| commit | 2c048102db32d62b57d00d41d734b7b1b3ca95ac (patch) | |
| tree | 7d86b652321d6cb78f1cfac8f0b4cb7417078f77 | |
| parent | 2b868683ad1acff45b7bd06407dcdc7555f48c73 (diff) | |
| parent | 95ad5b5372e1e803654a647b66904e00748d0d9d (diff) | |
Merge "Change Rounded corner overlay to be in Overlay layer" into tm-dev
8 files changed, 31 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/input/GestureMonitorSpyWindow.java b/services/core/java/com/android/server/input/GestureMonitorSpyWindow.java index d238dae634ad..e222c644da9e 100644 --- a/services/core/java/com/android/server/input/GestureMonitorSpyWindow.java +++ b/services/core/java/com/android/server/input/GestureMonitorSpyWindow.java @@ -27,6 +27,8 @@ import android.view.InputWindowHandle; import android.view.SurfaceControl; import android.view.WindowManager; +import com.android.server.policy.WindowManagerPolicy; + /** * An internal implementation of an {@link InputMonitor} that uses a spy window. * @@ -67,7 +69,9 @@ class GestureMonitorSpyWindow { final SurfaceControl.Transaction t = new SurfaceControl.Transaction(); t.setInputWindowInfo(mInputSurface, mWindowHandle); - t.setLayer(mInputSurface, Integer.MAX_VALUE); + // Gesture monitor should be above handwriting event surface, hence setting it to + // WindowManagerPolicy.INPUT_DISPLAY_OVERLAY_LAYER + 1 + t.setLayer(mInputSurface, WindowManagerPolicy.INPUT_DISPLAY_OVERLAY_LAYER + 1); t.setPosition(mInputSurface, 0, 0); t.setCrop(mInputSurface, null /* crop to parent surface */); t.show(mInputSurface); diff --git a/services/core/java/com/android/server/inputmethod/HandwritingEventReceiverSurface.java b/services/core/java/com/android/server/inputmethod/HandwritingEventReceiverSurface.java index 8180e66166d9..5438faa8793e 100644 --- a/services/core/java/com/android/server/inputmethod/HandwritingEventReceiverSurface.java +++ b/services/core/java/com/android/server/inputmethod/HandwritingEventReceiverSurface.java @@ -27,6 +27,8 @@ import android.view.InputWindowHandle; import android.view.SurfaceControl; import android.view.WindowManager; +import com.android.server.policy.WindowManagerPolicy; + final class HandwritingEventReceiverSurface { public static final String TAG = HandwritingEventReceiverSurface.class.getSimpleName(); @@ -36,7 +38,8 @@ final class HandwritingEventReceiverSurface { // is above gesture monitors, then edge-back and swipe-up gestures won't work when this surface // is intercepting. // TODO(b/217538817): Specify the ordering in WM by usage. - private static final int HANDWRITING_SURFACE_LAYER = Integer.MAX_VALUE - 1; + private static final int HANDWRITING_SURFACE_LAYER = + WindowManagerPolicy.INPUT_DISPLAY_OVERLAY_LAYER; private final InputWindowHandle mWindowHandle; private final InputChannel mClientChannel; diff --git a/services/core/java/com/android/server/policy/WindowManagerPolicy.java b/services/core/java/com/android/server/policy/WindowManagerPolicy.java index 7ca09ab5154f..89178139ffec 100644 --- a/services/core/java/com/android/server/policy/WindowManagerPolicy.java +++ b/services/core/java/com/android/server/policy/WindowManagerPolicy.java @@ -156,6 +156,10 @@ public interface WindowManagerPolicy extends WindowManagerPolicyConstants { int FINISH_LAYOUT_REDO_ANIM = 0x0008; /** Layer for the screen off animation */ int COLOR_FADE_LAYER = 0x40000001; + /** Layer for Input overlays for capturing inputs for gesture detection, etc. */ + int INPUT_DISPLAY_OVERLAY_LAYER = 0x7f000000; + /** Layer for Screen Decoration: The top most visible layer just below input overlay layers */ + int SCREEN_DECOR_DISPLAY_OVERLAY_LAYER = INPUT_DISPLAY_OVERLAY_LAYER - 1; /** * Register shortcuts for window manager to dispatch. diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index a059ac613dde..98c5d512be0e 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -5392,6 +5392,16 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp return mOverlayLayer; } + SurfaceControl[] findRoundedCornerOverlays() { + List<SurfaceControl> roundedCornerOverlays = new ArrayList<>(); + for (WindowToken token : mTokenMap.values()) { + if (token.mRoundedCornerOverlay) { + roundedCornerOverlays.add(token.mSurfaceControl); + } + } + return roundedCornerOverlays.toArray(new SurfaceControl[0]); + } + /** * Updates the display's system gesture exclusion. * diff --git a/services/core/java/com/android/server/wm/InputManagerCallback.java b/services/core/java/com/android/server/wm/InputManagerCallback.java index 33cdd2e98113..b7ddbd070460 100644 --- a/services/core/java/com/android/server/wm/InputManagerCallback.java +++ b/services/core/java/com/android/server/wm/InputManagerCallback.java @@ -265,7 +265,7 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal .setContainerLayer() .setName(name) .setCallsite("createSurfaceForGestureMonitor") - .setParent(dc.getSurfaceControl()) + .setParent(dc.getOverlayLayer()) .build(); } } diff --git a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java index 518bfd4c90df..2ef19321d958 100644 --- a/services/core/java/com/android/server/wm/ScreenRotationAnimation.java +++ b/services/core/java/com/android/server/wm/ScreenRotationAnimation.java @@ -164,6 +164,10 @@ class ScreenRotationAnimation { .setCaptureSecureLayers(true) .setAllowProtected(true) .setSourceCrop(new Rect(0, 0, width, height)) + // Exclude rounded corner overlay from screenshot buffer. Rounded + // corner overlay windows are un-rotated during rotation animation + // for a seamless transition. + .setExcludeLayers(displayContent.findRoundedCornerOverlays()) .build(); SurfaceControl.ScreenshotHardwareBuffer screenshotBuffer = SurfaceControl.captureLayers(args); diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 902218621cd0..52af39ee64b3 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -8215,7 +8215,7 @@ public class WindowManagerService extends IWindowManager.Stub .setContainerLayer() .setName("IME Handwriting Surface") .setCallsite("getHandwritingSurfaceForDisplay") - .setParent(dc.getSurfaceControl()) + .setParent(dc.getOverlayLayer()) .build(); } } diff --git a/services/core/java/com/android/server/wm/WindowToken.java b/services/core/java/com/android/server/wm/WindowToken.java index d2e56faa0914..18f60b1a9a20 100644 --- a/services/core/java/com/android/server/wm/WindowToken.java +++ b/services/core/java/com/android/server/wm/WindowToken.java @@ -368,7 +368,7 @@ class WindowToken extends WindowContainer<WindowState> { super.assignRelativeLayer(t, mDisplayContent.getDefaultTaskDisplayArea().getSplitScreenDividerAnchor(), 1); } else if (mRoundedCornerOverlay) { - super.assignLayer(t, WindowManagerPolicy.COLOR_FADE_LAYER + 1); + super.assignLayer(t, WindowManagerPolicy.SCREEN_DECOR_DISPLAY_OVERLAY_LAYER); } else { super.assignLayer(t, layer); } @@ -378,7 +378,7 @@ class WindowToken extends WindowContainer<WindowState> { SurfaceControl.Builder makeSurface() { final SurfaceControl.Builder builder = super.makeSurface(); if (mRoundedCornerOverlay) { - builder.setParent(null); + builder.setParent(getDisplayContent().getOverlayLayer()); } return builder; } |