Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0b7989a authored by Nick Chameyev's avatar Nick Chameyev
Browse files

Ensure that DeferredDisplayUpdater logs are printed to logcat

Use WM_DEBUG_WINDOW_TRANSITIONS_MIN to ensure that the logs
in DeferredDisplayUpdater are also printed to logcat, as
we had several bugreports with missing protologs.

Also adding width and height of the DisplayInfo object which
might help to investigate a problem when the device is stuck with
incorrectly applied DisplayInfo (for a wrong screen).

Test: manually checked that logs printed to logcat
Flag: EXEMPT bugfix
Bug: 362548632
Change-Id: Ic7b5e92eb9bd429e7bf04cd3a99ecff172c282f3
parent 6e7c076d
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.server.wm;

import static android.view.WindowManager.TRANSIT_CHANGE;

import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_WINDOW_TRANSITIONS;
import static com.android.internal.protolog.WmProtoLogGroups.WM_DEBUG_WINDOW_TRANSITIONS_MIN;
import static com.android.server.wm.ActivityTaskManagerService.POWER_MODE_REASON_CHANGE_DISPLAY;
import static com.android.server.wm.utils.DisplayInfoOverrides.WM_OVERRIDE_FIELDS;
import static com.android.server.wm.utils.DisplayInfoOverrides.copyDisplayInfoFields;
@@ -140,8 +140,9 @@ class DeferredDisplayUpdater {
        if (displayInfoDiff == DIFF_EVERYTHING
                || !mDisplayContent.getLastHasContent()
                || !mDisplayContent.mTransitionController.isShellTransitionsEnabled()) {
            ProtoLog.d(WM_DEBUG_WINDOW_TRANSITIONS,
                    "DeferredDisplayUpdater: applying DisplayInfo immediately");
            ProtoLog.d(WM_DEBUG_WINDOW_TRANSITIONS_MIN,
                    "DeferredDisplayUpdater: applying DisplayInfo(%d x %d) immediately",
                    displayInfo.logicalWidth, displayInfo.logicalHeight);

            mLastWmDisplayInfo = displayInfo;
            applyLatestDisplayInfo();
@@ -151,17 +152,23 @@ class DeferredDisplayUpdater {

        // If there are non WM-specific display info changes, apply only these fields immediately
        if ((displayInfoDiff & DIFF_NOT_WM_DEFERRABLE) > 0) {
            ProtoLog.d(WM_DEBUG_WINDOW_TRANSITIONS,
                    "DeferredDisplayUpdater: partially applying DisplayInfo immediately");
            ProtoLog.d(WM_DEBUG_WINDOW_TRANSITIONS_MIN,
                    "DeferredDisplayUpdater: partially applying DisplayInfo(%d x %d) immediately",
                    displayInfo.logicalWidth, displayInfo.logicalHeight);
            applyLatestDisplayInfo();
        }

        // If there are WM-specific display info changes, apply them through a Shell transition
        if ((displayInfoDiff & DIFF_WM_DEFERRABLE) > 0) {
            ProtoLog.d(WM_DEBUG_WINDOW_TRANSITIONS,
                    "DeferredDisplayUpdater: deferring DisplayInfo update");
            ProtoLog.d(WM_DEBUG_WINDOW_TRANSITIONS_MIN,
                    "DeferredDisplayUpdater: deferring DisplayInfo(%d x %d) update",
                    displayInfo.logicalWidth, displayInfo.logicalHeight);

            requestDisplayChangeTransition(physicalDisplayUpdated, () -> {
                ProtoLog.d(WM_DEBUG_WINDOW_TRANSITIONS_MIN,
                        "DeferredDisplayUpdater: applying DisplayInfo(%d x %d) after deferring",
                        displayInfo.logicalWidth, displayInfo.logicalHeight);

                // Apply deferrable fields to DisplayContent only when the transition
                // starts collecting, non-deferrable fields are ignored in mLastWmDisplayInfo
                mLastWmDisplayInfo = displayInfo;
@@ -209,9 +216,6 @@ class DeferredDisplayUpdater {
            try {
                onStartCollect.run();

                ProtoLog.d(WM_DEBUG_WINDOW_TRANSITIONS,
                        "DeferredDisplayUpdater: applied DisplayInfo after deferring");

                if (physicalDisplayUpdated) {
                    onDisplayUpdated(transition, fromRotation, startBounds);
                } else {