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

Commit 97f9372e authored by Issei Suzuki's avatar Issei Suzuki
Browse files

Add display sleep token information to winscope dump.

Change-Id: Ia25854feed3bb6b037d4510a6b5000d906d27313
Bug: 198593156
Test: manual. capture winscope dump and see it.
parent a7e52432
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -202,7 +202,6 @@ message DisplayContentProto {
    optional .com.android.server.wm.IdentifierProto resumed_activity = 24;
    repeated TaskProto tasks = 25 [deprecated=true];
    optional bool display_ready = 26;

    optional WindowStateProto input_method_target = 27;
    optional WindowStateProto input_method_input_target = 28;
    optional WindowStateProto input_method_control_target = 29;
@@ -214,6 +213,9 @@ message DisplayContentProto {
    optional int32 ime_policy = 34;

    repeated InsetsSourceProviderProto insets_source_providers = 35;
    optional bool is_sleeping = 36;
    repeated string sleep_tokens = 37;

}

/* represents DisplayArea object */
+12 −0
Original line number Diff line number Diff line
@@ -1561,6 +1561,12 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/DisplayRotation.java"
    },
    "-436553282": {
      "message": "Remove sleep token: tag=%s, displayId=%d",
      "level": "DEBUG",
      "group": "WM_DEBUG_STATES",
      "at": "com\/android\/server\/wm\/RootWindowContainer.java"
    },
    "-415865166": {
      "message": "findFocusedWindow: Found new focus @ %s",
      "level": "VERBOSE",
@@ -1669,6 +1675,12 @@
      "group": "WM_DEBUG_ADD_REMOVE",
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    "-317761482": {
      "message": "Create sleep token: tag=%s, displayId=%d",
      "level": "DEBUG",
      "group": "WM_DEBUG_STATES",
      "at": "com\/android\/server\/wm\/RootWindowContainer.java"
    },
    "-317194205": {
      "message": "clearLockedTasks: %s",
      "level": "INFO",
+7 −0
Original line number Diff line number Diff line
@@ -114,10 +114,12 @@ import static com.android.server.wm.DisplayContentProto.INPUT_METHOD_CONTROL_TAR
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.IS_SLEEPING;
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;
import static com.android.server.wm.DisplayContentProto.SCREEN_ROTATION_ANIMATION;
import static com.android.server.wm.DisplayContentProto.SLEEP_TOKENS;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_RECENTS;
@@ -3261,6 +3263,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
            proto.write(FOCUSED_ROOT_TASK_ID, INVALID_TASK_ID);
        }
        proto.write(DISPLAY_READY, isReady());
        proto.write(IS_SLEEPING, isSleeping());
        for (int i = 0; i < mAllSleepTokens.size(); ++i) {
            mAllSleepTokens.get(i).writeTagToProto(proto, SLEEP_TOKENS);
        }

        if (mImeLayeringTarget != null) {
            mImeLayeringTarget.dumpDebug(proto, INPUT_METHOD_TARGET, logLevel);
        }
+7 −0
Original line number Diff line number Diff line
@@ -2639,6 +2639,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            token = new SleepToken(tag, displayId);
            mSleepTokens.put(tokenKey, token);
            display.mAllSleepTokens.add(token);
            ProtoLog.d(WM_DEBUG_STATES, "Create sleep token: tag=%s, displayId=%d", tag, displayId);
        } else {
            throw new RuntimeException("Create the same sleep token twice: " + token);
        }
@@ -2657,6 +2658,8 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            return;
        }

        ProtoLog.d(WM_DEBUG_STATES, "Remove sleep token: tag=%s, displayId=%d", token.mTag,
                token.mDisplayId);
        display.mAllSleepTokens.remove(token);
        if (display.mAllSleepTokens.isEmpty()) {
            mService.updateSleepIfNeededLocked();
@@ -3664,6 +3667,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
            return "{\"" + mTag + "\", display " + mDisplayId
                    + ", acquire at " + TimeUtils.formatUptime(mAcquireTime) + "}";
        }

        void writeTagToProto(ProtoOutputStream proto, long fieldId) {
            proto.write(fieldId, mTag);
        }
    }

    private class RankTaskLayersRunnable implements Runnable {