diff options
| author | 2024-10-04 10:37:05 +0000 | |
|---|---|---|
| committer | 2024-10-04 10:52:36 +0000 | |
| commit | 00e6e684eca8ab8b98b003d25c8743ce21d57be3 (patch) | |
| tree | 86d4e5344979b20b2e2891c73786ffc18eb2e436 | |
| parent | 6d79476a566c3d06384f2cdcb01146c0cc276cde (diff) | |
Fix WM dump perfetto slice
Move perfetto slice within WindowManagerService#dumpDebugLocked().
The slice was previously traced within WindowTracing and other entry
points (e.g. WindowManagerService#doDump()) were not triggering it.
Flag: EXEMPT minor fix
Bug: 369592408
Test: presubmit
Change-Id: I9019dc64392f9c4aa3e592ea07bda5b1297f8717
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowManagerService.java | 54 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wm/WindowTracing.java | 7 |
2 files changed, 31 insertions, 30 deletions
diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index b8f47cce6005..67fa5a76729c 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -6810,30 +6810,36 @@ public class WindowManagerService extends IWindowManager.Stub * @param logLevel Determines the amount of data to be written to the Protobuf. */ void dumpDebugLocked(ProtoOutputStream proto, @WindowTracingLogLevel int logLevel) { - mPolicy.dumpDebug(proto, POLICY); - mRoot.dumpDebug(proto, ROOT_WINDOW_CONTAINER, logLevel); - final DisplayContent topFocusedDisplayContent = mRoot.getTopFocusedDisplayContent(); - if (topFocusedDisplayContent.mCurrentFocus != null) { - topFocusedDisplayContent.mCurrentFocus.writeIdentifierToProto(proto, FOCUSED_WINDOW); - } - if (topFocusedDisplayContent.mFocusedApp != null) { - topFocusedDisplayContent.mFocusedApp.writeNameToProto(proto, FOCUSED_APP); - } - final WindowState imeWindow = mRoot.getCurrentInputMethodWindow(); - if (imeWindow != null) { - imeWindow.writeIdentifierToProto(proto, INPUT_METHOD_WINDOW); - } - proto.write(DISPLAY_FROZEN, mDisplayFrozen); - 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); - - // Write the BackNavigationController's state into the protocol buffer - mAtmService.mBackNavigationController.dumpDebug(proto, BACK_NAVIGATION); + Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "dumpDebugLocked"); + try { + mPolicy.dumpDebug(proto, POLICY); + mRoot.dumpDebug(proto, ROOT_WINDOW_CONTAINER, logLevel); + final DisplayContent topFocusedDisplayContent = mRoot.getTopFocusedDisplayContent(); + if (topFocusedDisplayContent.mCurrentFocus != null) { + topFocusedDisplayContent.mCurrentFocus + .writeIdentifierToProto(proto, FOCUSED_WINDOW); + } + if (topFocusedDisplayContent.mFocusedApp != null) { + topFocusedDisplayContent.mFocusedApp.writeNameToProto(proto, FOCUSED_APP); + } + final WindowState imeWindow = mRoot.getCurrentInputMethodWindow(); + if (imeWindow != null) { + imeWindow.writeIdentifierToProto(proto, INPUT_METHOD_WINDOW); + } + proto.write(DISPLAY_FROZEN, mDisplayFrozen); + 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); + + // Write the BackNavigationController's state into the protocol buffer + mAtmService.mBackNavigationController.dumpDebug(proto, BACK_NAVIGATION); + } finally { + Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); + } } private void dumpWindowsLocked(PrintWriter pw, boolean dumpAll, diff --git a/services/core/java/com/android/server/wm/WindowTracing.java b/services/core/java/com/android/server/wm/WindowTracing.java index fe267261b9e6..68834370c191 100644 --- a/services/core/java/com/android/server/wm/WindowTracing.java +++ b/services/core/java/com/android/server/wm/WindowTracing.java @@ -167,12 +167,7 @@ abstract class WindowTracing { long token = os.start(WINDOW_MANAGER_SERVICE); synchronized (mGlobalLock) { - Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "dumpDebugLocked"); - try { - mService.dumpDebugLocked(os, logLevel); - } finally { - Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER); - } + mService.dumpDebugLocked(os, logLevel); } os.end(token); } catch (Exception e) { |