From 1153c8f352fc2fb2997583146f6be0486e98ce5c Mon Sep 17 00:00:00 2001 From: Tiger Huang Date: Fri, 4 Mar 2022 19:46:34 +0800 Subject: Add window_frames_valid to proto This is a step to move the window layout to the client side. Once the window layout is moved to the client side, when something (such as configuration) is changed, the server will send MSG_RESIZED to the client. Before the client reports the new frame to the server, the frame at the server side might not be up-to-date. This gives WindowManagerState a signal to decide if it should retry. Bug: 161810301 Test: presubmit Change-Id: Idece0f559e7013ff389cbb7aa74d63734c95f64c --- core/proto/android/server/windowmanagerservice.proto | 1 + services/core/java/com/android/server/wm/WindowManagerService.java | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto index 3929027a4e94..0ade0934f2a6 100644 --- a/core/proto/android/server/windowmanagerservice.proto +++ b/core/proto/android/server/windowmanagerservice.proto @@ -53,6 +53,7 @@ message WindowManagerServiceDumpProto { optional int32 last_orientation = 8 [(.android.typedef) = "android.content.pm.ActivityInfo.ScreenOrientation", deprecated=true]; optional int32 focused_display_id = 9; optional bool hard_keyboard_available = 10; + optional bool window_frames_valid = 11; } /* represents RootWindowContainer object */ diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 555128bc1374..2cff03089234 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -141,6 +141,7 @@ import static com.android.server.wm.WindowManagerServiceDumpProto.HARD_KEYBOARD_ import static com.android.server.wm.WindowManagerServiceDumpProto.INPUT_METHOD_WINDOW; import static com.android.server.wm.WindowManagerServiceDumpProto.POLICY; import static com.android.server.wm.WindowManagerServiceDumpProto.ROOT_WINDOW_CONTAINER; +import static com.android.server.wm.WindowManagerServiceDumpProto.WINDOW_FRAMES_VALID; import android.Manifest; import android.Manifest.permission; @@ -6437,9 +6438,13 @@ public class WindowManagerService extends IWindowManager.Stub imeWindow.writeIdentifierToProto(proto, INPUT_METHOD_WINDOW); } proto.write(DISPLAY_FROZEN, mDisplayFrozen); - final DisplayContent defaultDisplayContent = getDefaultDisplayContentLocked(); proto.write(FOCUSED_DISPLAY_ID, topFocusedDisplayContent.getDisplayId()); proto.write(HARD_KEYBOARD_AVAILABLE, mHardKeyboardAvailable); + + // This is always true for now since we still update the window frames at the server side. + // Once we move the window layout to the client side, this can be false when we are waiting + // for the frames. + proto.write(WINDOW_FRAMES_VALID, true); } private void dumpWindowsLocked(PrintWriter pw, boolean dumpAll, -- cgit v1.2.3-59-g8ed1b