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

Commit 3e469aec authored by Issei Suzuki's avatar Issei Suzuki
Browse files

Add display sleep token information to winscope dump.

Change-Id: Ia25854feed3bb6b037d4510a6b5000d906d27313
Merged-In: Ia25854feed3bb6b037d4510a6b5000d906d27313
Bug: 198593156
Test: manual. capture winscope dump and see it.
parent 0826811a
Loading
Loading
Loading
Loading
+2 −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;
@@ -212,6 +211,8 @@ message DisplayContentProto {

    optional DisplayRotationProto display_rotation = 33;
    optional int32 ime_policy = 34;
    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
@@ -115,10 +115,12 @@ 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.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_APP_TRANSITION;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_RECENTS;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
@@ -3293,6 +3295,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
@@ -2700,6 +2700,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);
        }
@@ -2718,6 +2719,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();
@@ -3729,6 +3732,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 {