From 2f7f7c8dbd02ea360d4fdc96d8840abd8aa0eaa6 Mon Sep 17 00:00:00 2001 From: rokuda Date: Thu, 26 Aug 2021 02:39:38 +0000 Subject: [PATCH] Create all Insets logs for Winscope This change is adding all kinds of Insets logs to existing WindowManager-related logs. These logs are usually created by Winscope and shown on it. Insets logs are just added and nothing is deleted. Also, they are collected both when "dump" and "tracing" are chosen on Winscope, and this behaivior follows the existing one. Bug: 199224772 Test: manual by follow steps 1) Start tracing by choosing "Window Manager" and clicking "START TRACE" on Winscope. 2) End tracing by clicking "END TRACE". 3) See if the insets logs are available. Change-Id: I5ed1a8a48aaf6db0aece325c4ca32e7fa0747ecf --- .../android/server/windowmanagerservice.proto | 2 ++ .../java/com/android/server/wm/DisplayContent.java | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/proto/android/server/windowmanagerservice.proto b/core/proto/android/server/windowmanagerservice.proto index 4af9d75682bbd..8e33561cc91f5 100644 --- a/core/proto/android/server/windowmanagerservice.proto +++ b/core/proto/android/server/windowmanagerservice.proto @@ -211,6 +211,8 @@ message DisplayContentProto { optional DisplayRotationProto display_rotation = 33; optional int32 ime_policy = 34; + + repeated InsetsSourceProviderProto insets_source_providers = 35; } /* represents DisplayArea object */ diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index e934cb8c926a1..5f67b93146387 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -111,6 +111,7 @@ import static com.android.server.wm.DisplayContentProto.IME_POLICY; import static com.android.server.wm.DisplayContentProto.INPUT_METHOD_CONTROL_TARGET; import static com.android.server.wm.DisplayContentProto.INPUT_METHOD_INPUT_TARGET; import static com.android.server.wm.DisplayContentProto.INPUT_METHOD_TARGET; +import static com.android.server.wm.DisplayContentProto.INSETS_SOURCE_PROVIDERS; import static com.android.server.wm.DisplayContentProto.OPENING_APPS; import static com.android.server.wm.DisplayContentProto.RESUMED_ACTIVITY; import static com.android.server.wm.DisplayContentProto.ROOT_DISPLAY_AREA; @@ -3225,10 +3226,15 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp if (mCurrentFocus != null) { mCurrentFocus.dumpDebug(proto, CURRENT_FOCUS, logLevel); } - if (mInsetsStateController != null - && mInsetsStateController.getImeSourceProvider() != null) { - mInsetsStateController.getImeSourceProvider().dumpDebug(proto, - IME_INSETS_SOURCE_PROVIDER, logLevel); + if (mInsetsStateController != null) { + for (@InternalInsetsType int type = 0; type < InsetsState.SIZE; type++) { + final InsetsSourceProvider provider = mInsetsStateController.peekSourceProvider( + type); + if (provider != null) { + provider.dumpDebug(proto, type == ITYPE_IME ? IME_INSETS_SOURCE_PROVIDER : + INSETS_SOURCE_PROVIDERS, logLevel); + } + } } proto.write(IME_POLICY, getImePolicy()); proto.end(token);