Loading services/core/java/com/android/server/wm/AppWindowToken.java +10 −1 Original line number Diff line number Diff line Loading @@ -3132,8 +3132,17 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } /** Gets the inner bounds of letterbox. The bounds will be empty if there is no letterbox. */ void getLetterboxInnerBounds(Rect outBounds) { if (mLetterbox != null) { outBounds.set(mLetterbox.getInnerFrame()); } else { outBounds.setEmpty(); } } /** * @eturn true if there is a letterbox and any part of that letterbox overlaps with * @return {@code true} if there is a letterbox and any part of that letterbox overlaps with * the given {@code rect}. */ boolean isLetterboxOverlappingWith(Rect rect) { Loading services/core/java/com/android/server/wm/Letterbox.java +20 −7 Original line number Diff line number Diff line Loading @@ -92,6 +92,11 @@ public class Letterbox { mBottom.getHeight()); } /** @return The frame that used to place the content. */ Rect getInnerFrame() { return mInner; } /** * Returns true if any part of the letterbox overlaps with the given {@code rect}. */ Loading Loading @@ -162,6 +167,7 @@ public class Letterbox { final InputWindowHandle mWindowHandle; final InputEventReceiver mInputEventReceiver; final WindowManagerService mWmService; final Binder mToken = new Binder(); InputInterceptor(String namePrefix, WindowState win) { mWmService = win.mWmService; Loading @@ -171,13 +177,12 @@ public class Letterbox { mClientChannel = channels[1]; mInputEventReceiver = new SimpleInputReceiver(mClientChannel); final Binder token = new Binder(); mWmService.mInputManager.registerInputChannel(mServerChannel, token); mWmService.mInputManager.registerInputChannel(mServerChannel, mToken); mWindowHandle = new InputWindowHandle(null /* inputApplicationHandle */, null /* clientWindow */, win.getDisplayId()); mWindowHandle.name = name; mWindowHandle.token = token; mWindowHandle.token = mToken; mWindowHandle.layoutParamsFlags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH Loading @@ -192,6 +197,14 @@ public class Letterbox { } void updateTouchableRegion(Rect frame) { if (frame.isEmpty()) { // Use null token to indicate the surface doesn't need to receive input event (see // the usage of Layer.hasInput in SurfaceFlinger), so InputDispatcher won't keep the // unnecessary records. mWindowHandle.token = null; return; } mWindowHandle.token = mToken; mWindowHandle.touchableRegion.set(frame); mWindowHandle.touchableRegion.translate(-frame.left, -frame.top); } Loading Loading @@ -289,14 +302,14 @@ public class Letterbox { t.setPosition(mSurface, mSurfaceFrameRelative.left, mSurfaceFrameRelative.top); t.setWindowCrop(mSurface, mSurfaceFrameRelative.width(), mSurfaceFrameRelative.height()); if (mInputInterceptor != null) { mInputInterceptor.updateTouchableRegion(mSurfaceFrameRelative); t.setInputWindowInfo(mSurface, mInputInterceptor.mWindowHandle); } t.show(mSurface); } else if (mSurface != null) { t.hide(mSurface); } if (mSurface != null && mInputInterceptor != null) { mInputInterceptor.updateTouchableRegion(mSurfaceFrameRelative); t.setInputWindowInfo(mSurface, mInputInterceptor.mWindowHandle); } } public boolean needsApplySurfaceChanges() { Loading services/core/java/com/android/server/wm/WindowState.java +16 −10 Original line number Diff line number Diff line Loading @@ -2209,17 +2209,23 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (modal && mAppToken != null) { // Limit the outer touch to the activity stack region. flags |= FLAG_NOT_TOUCH_MODAL; // If the inner bounds of letterbox is available, then it will be used as the touchable // region so it won't cover the touchable letterbox and the touch events can slip to // activity from letterbox. mAppToken.getLetterboxInnerBounds(mTmpRect); if (mTmpRect.isEmpty()) { // If this is a modal window we need to dismiss it if it's not full screen and the // touch happens outside of the frame that displays the content. This means we // need to intercept touches outside of that window. The dim layer user // associated with the window (task or stack) will give us the good bounds, as // they would be used to display the dim layer. // touch happens outside of the frame that displays the content. This means we need // to intercept touches outside of that window. The dim layer user associated with // the window (task or stack) will give us the good bounds, as they would be used to // display the dim layer. final Task task = getTask(); if (task != null) { task.getDimBounds(mTmpRect); } else { getStack().getDimBounds(mTmpRect); } } if (inFreeformWindowingMode()) { // For freeform windows we the touch region to include the whole surface for the // shadows. Loading Loading
services/core/java/com/android/server/wm/AppWindowToken.java +10 −1 Original line number Diff line number Diff line Loading @@ -3132,8 +3132,17 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } } /** Gets the inner bounds of letterbox. The bounds will be empty if there is no letterbox. */ void getLetterboxInnerBounds(Rect outBounds) { if (mLetterbox != null) { outBounds.set(mLetterbox.getInnerFrame()); } else { outBounds.setEmpty(); } } /** * @eturn true if there is a letterbox and any part of that letterbox overlaps with * @return {@code true} if there is a letterbox and any part of that letterbox overlaps with * the given {@code rect}. */ boolean isLetterboxOverlappingWith(Rect rect) { Loading
services/core/java/com/android/server/wm/Letterbox.java +20 −7 Original line number Diff line number Diff line Loading @@ -92,6 +92,11 @@ public class Letterbox { mBottom.getHeight()); } /** @return The frame that used to place the content. */ Rect getInnerFrame() { return mInner; } /** * Returns true if any part of the letterbox overlaps with the given {@code rect}. */ Loading Loading @@ -162,6 +167,7 @@ public class Letterbox { final InputWindowHandle mWindowHandle; final InputEventReceiver mInputEventReceiver; final WindowManagerService mWmService; final Binder mToken = new Binder(); InputInterceptor(String namePrefix, WindowState win) { mWmService = win.mWmService; Loading @@ -171,13 +177,12 @@ public class Letterbox { mClientChannel = channels[1]; mInputEventReceiver = new SimpleInputReceiver(mClientChannel); final Binder token = new Binder(); mWmService.mInputManager.registerInputChannel(mServerChannel, token); mWmService.mInputManager.registerInputChannel(mServerChannel, mToken); mWindowHandle = new InputWindowHandle(null /* inputApplicationHandle */, null /* clientWindow */, win.getDisplayId()); mWindowHandle.name = name; mWindowHandle.token = token; mWindowHandle.token = mToken; mWindowHandle.layoutParamsFlags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH Loading @@ -192,6 +197,14 @@ public class Letterbox { } void updateTouchableRegion(Rect frame) { if (frame.isEmpty()) { // Use null token to indicate the surface doesn't need to receive input event (see // the usage of Layer.hasInput in SurfaceFlinger), so InputDispatcher won't keep the // unnecessary records. mWindowHandle.token = null; return; } mWindowHandle.token = mToken; mWindowHandle.touchableRegion.set(frame); mWindowHandle.touchableRegion.translate(-frame.left, -frame.top); } Loading Loading @@ -289,14 +302,14 @@ public class Letterbox { t.setPosition(mSurface, mSurfaceFrameRelative.left, mSurfaceFrameRelative.top); t.setWindowCrop(mSurface, mSurfaceFrameRelative.width(), mSurfaceFrameRelative.height()); if (mInputInterceptor != null) { mInputInterceptor.updateTouchableRegion(mSurfaceFrameRelative); t.setInputWindowInfo(mSurface, mInputInterceptor.mWindowHandle); } t.show(mSurface); } else if (mSurface != null) { t.hide(mSurface); } if (mSurface != null && mInputInterceptor != null) { mInputInterceptor.updateTouchableRegion(mSurfaceFrameRelative); t.setInputWindowInfo(mSurface, mInputInterceptor.mWindowHandle); } } public boolean needsApplySurfaceChanges() { Loading
services/core/java/com/android/server/wm/WindowState.java +16 −10 Original line number Diff line number Diff line Loading @@ -2209,17 +2209,23 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (modal && mAppToken != null) { // Limit the outer touch to the activity stack region. flags |= FLAG_NOT_TOUCH_MODAL; // If the inner bounds of letterbox is available, then it will be used as the touchable // region so it won't cover the touchable letterbox and the touch events can slip to // activity from letterbox. mAppToken.getLetterboxInnerBounds(mTmpRect); if (mTmpRect.isEmpty()) { // If this is a modal window we need to dismiss it if it's not full screen and the // touch happens outside of the frame that displays the content. This means we // need to intercept touches outside of that window. The dim layer user // associated with the window (task or stack) will give us the good bounds, as // they would be used to display the dim layer. // touch happens outside of the frame that displays the content. This means we need // to intercept touches outside of that window. The dim layer user associated with // the window (task or stack) will give us the good bounds, as they would be used to // display the dim layer. final Task task = getTask(); if (task != null) { task.getDimBounds(mTmpRect); } else { getStack().getDimBounds(mTmpRect); } } if (inFreeformWindowingMode()) { // For freeform windows we the touch region to include the whole surface for the // shadows. Loading