From 3072d027ec6d146edd1640b7ca5e084a9b3185fb Mon Sep 17 00:00:00 2001 From: Tiger Huang Date: Tue, 15 Mar 2022 18:48:07 +0800 Subject: [PATCH] Remove RELAYOUT_RES_IN_TOUCH_MODE When WindowManagerService.mInTouchMode is changed, we will set the new mode to InputManagerService, and clients will be notified via ViewRootImpl.WindowInputEventReceiver#onTouchModeChanged. We don't need the flag to bring the information to the client. This is also a step to make relayout an oneway binder call. Bug: 161810301 Test: Invoke View#requestFocusFromTouch on one window and see if another window can receive OnTouchModeChangeListener#onTouchModeChanged. Change-Id: Ic149c95bee89b2be83a85eb4858131224b63a7c8 --- core/java/android/view/ViewRootImpl.java | 7 ++----- .../android/view/WindowManagerGlobal.java | 20 +++++++------------ .../android/view/WindowlessWindowManager.java | 3 +-- .../server/wm/WindowManagerService.java | 2 -- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index bde761e59620b..d5093a7b743c5 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -3137,11 +3137,8 @@ public final class ViewRootImpl implements ViewParent, // possible that checking the most recent value is actually more // correct here. if (!mStopped || wasReportNextDraw) { - boolean focusChangedDueToTouchMode = ensureTouchModeLocally( - (relayoutResult&WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE) != 0); - if (focusChangedDueToTouchMode || mWidth != host.getMeasuredWidth() - || mHeight != host.getMeasuredHeight() || dispatchApplyInsets || - updatedConfiguration) { + if (mWidth != host.getMeasuredWidth() || mHeight != host.getMeasuredHeight() + || dispatchApplyInsets || updatedConfiguration) { int childWidthMeasureSpec = getRootMeasureSpec(mWidth, lp.width, lp.privateFlags); int childHeightMeasureSpec = getRootMeasureSpec(mHeight, lp.height, diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java index 2dc5fbd5439f3..b0da877bfddd9 100644 --- a/core/java/android/view/WindowManagerGlobal.java +++ b/core/java/android/view/WindowManagerGlobal.java @@ -59,48 +59,42 @@ public final class WindowManagerGlobal { private static boolean sUseBLASTAdapter = false; - /** - * The user is navigating with keys (not the touch screen), so - * navigational focus should be shown. - */ - public static final int RELAYOUT_RES_IN_TOUCH_MODE = 0x1; - /** * This is the first time the window is being drawn, * so the client must call drawingFinished() when done */ - public static final int RELAYOUT_RES_FIRST_TIME = 0x2; + public static final int RELAYOUT_RES_FIRST_TIME = 1; /** * The window manager has changed the surface from the last call. */ - public static final int RELAYOUT_RES_SURFACE_CHANGED = 0x4; + public static final int RELAYOUT_RES_SURFACE_CHANGED = 1 << 1; /** * The window is being resized by dragging on the docked divider. The client should render * at (0, 0) and extend its background to the background frame passed into * {@link IWindow#resized}. */ - public static final int RELAYOUT_RES_DRAG_RESIZING_DOCKED = 0x8; + public static final int RELAYOUT_RES_DRAG_RESIZING_DOCKED = 1 << 2; /** * The window is being resized by dragging one of the window corners, * in this case the surface would be fullscreen-sized. The client should * render to the actual frame location (instead of (0,curScrollY)). */ - public static final int RELAYOUT_RES_DRAG_RESIZING_FREEFORM = 0x10; + public static final int RELAYOUT_RES_DRAG_RESIZING_FREEFORM = 1 << 3; /** * The window manager has changed the size of the surface from the last call. */ - public static final int RELAYOUT_RES_SURFACE_RESIZED = 0x20; + public static final int RELAYOUT_RES_SURFACE_RESIZED = 1 << 4; /** * In multi-window we force show the system bars. Because we don't want that the surface size * changes in this mode, we instead have a flag whether the system bar sizes should always be * consumed, so the app is treated like there is no virtual system bars at all. */ - public static final int RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS = 0x40; + public static final int RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS = 1 << 5; /** * This flag indicates the client should not directly submit it's next frame, @@ -108,7 +102,7 @@ public final class WindowManagerGlobal { * {@link WindowManagerService#finishDrawing}. This is used by the WM * BLASTSyncEngine to synchronize rendering of multiple windows. */ - public static final int RELAYOUT_RES_BLAST_SYNC = 0x80; + public static final int RELAYOUT_RES_BLAST_SYNC = 1 << 6; /** * Flag for relayout: the client will be later giving diff --git a/core/java/android/view/WindowlessWindowManager.java b/core/java/android/view/WindowlessWindowManager.java index a270c9283ddc9..e2b494d7de24f 100644 --- a/core/java/android/view/WindowlessWindowManager.java +++ b/core/java/android/view/WindowlessWindowManager.java @@ -327,8 +327,7 @@ public class WindowlessWindowManager implements IWindowSession { outInsetsState.set(mInsetsState); } - // Include whether the window is in touch mode. - return isInTouchMode() ? WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE : 0; + return 0; } @Override diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 49d9b65dde686..927a4b6976224 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -2483,8 +2483,6 @@ public class WindowManagerService extends IWindowManager.Stub ProtoLog.v(WM_DEBUG_FOCUS, "Relayout of %s: focusMayChange=%b", win, focusMayChange); - result |= mInTouchMode ? WindowManagerGlobal.RELAYOUT_RES_IN_TOUCH_MODE : 0; - if (DEBUG_LAYOUT) { Slog.v(TAG_WM, "Relayout complete " + win + ": outFrames=" + outFrames); }