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

Commit 808c7274 authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Add log of window redraw for orientation and activity relaunch" into sc-dev am: b717397d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13495589

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I0316b3f65573c1576267abd37bb0c81cc5829d32
parents e304bf0f b717397d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1321,6 +1321,12 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/DisplayRotation.java"
    },
    "-567946587": {
      "message": "Requested redraw for orientation change: %s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    "-561092364": {
      "message": "onPointerDownOutsideFocusLocked called on %s",
      "level": "INFO",
+4 −1
Original line number Diff line number Diff line
@@ -235,7 +235,10 @@ class ActivityClientController extends IActivityClientController.Stub {
    public void activityRelaunched(IBinder token) {
        final long origId = Binder.clearCallingIdentity();
        synchronized (mGlobalLock) {
            mTaskSupervisor.activityRelaunchedLocked(token);
            final ActivityRecord r = ActivityRecord.forTokenLocked(token);
            if (r != null) {
                r.finishRelaunching();
            }
        }
        Binder.restoreCallingIdentity(origId);
    }
+14 −0
Original line number Diff line number Diff line
@@ -567,6 +567,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    boolean mVoiceInteraction;

    private int mPendingRelaunchCount;
    long mRelaunchStartTime;

    // True if we are current in the process of removing this app token from the display
    private boolean mRemovingFromDisplay = false;
@@ -3357,7 +3358,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return task.isDragResizing();
    }

    @VisibleForTesting
    void startRelaunching() {
        if (mPendingRelaunchCount == 0) {
            mRelaunchStartTime = SystemClock.elapsedRealtime();
        }
        if (shouldFreezeBounds()) {
            freezeBounds();
        }
@@ -3396,6 +3401,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            // Update keyguard flags upon finishing relaunch.
            checkKeyguardFlagsChanged();
        }

        final Task rootTask = getRootTask();
        if (rootTask != null && rootTask.shouldSleepOrShutDownActivities()) {
            // Activity is always relaunched to either resumed or paused state. If it was
            // relaunched while hidden (by keyguard or smth else), it should be stopped.
            rootTask.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
                    false /* preserveWindows */);
        }
    }

    void clearRelaunching() {
@@ -3404,6 +3417,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }
        unfreezeBounds();
        mPendingRelaunchCount = 0;
        mRelaunchStartTime = 0;
    }

    /**
+0 −13
Original line number Diff line number Diff line
@@ -2204,19 +2204,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
                task.mTaskId, reason, topActivity.info.applicationInfo.packageName);
    }

    void activityRelaunchedLocked(IBinder token) {
        final ActivityRecord r = ActivityRecord.isInRootTaskLocked(token);
        if (r != null) {
            r.finishRelaunching();
            if (r.getRootTask().shouldSleepOrShutDownActivities()) {
                // Activity is always relaunched to either resumed or paused state. If it was
                // relaunched while hidden (by keyguard or smth else), it should be stopped.
                r.getRootTask().ensureActivitiesVisible(null /* starting */, 0 /* configChanges */,
                        false /* preserveWindows */);
            }
        }
    }

    void logRootTaskState() {
        mActivityMetricsLogger.logWindowState();
    }
+23 −7
Original line number Diff line number Diff line
@@ -533,6 +533,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
     */
    private boolean mOrientationChanging;

    /** The time when the window was last requested to redraw for orientation change. */
    private long mOrientationChangeRedrawRequestTime;

    /**
     * Sometimes in addition to the mOrientationChanging
     * flag we report that the orientation is changing
@@ -1441,11 +1444,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            // redrawn; to do that, we need to go through the process of getting informed by the
            // application when it has finished drawing.
            if (getOrientationChanging() || dragResizingChanged) {
                if (getOrientationChanging()) {
                    Slog.v(TAG_WM, "Orientation start waiting for draw"
                            + ", mDrawState=DRAW_PENDING in " + this
                            + ", surfaceController " + winAnimator.mSurfaceController);
                }
                if (dragResizingChanged) {
                    ProtoLog.v(WM_DEBUG_RESIZE,
                            "Resize start waiting for draw, "
@@ -3651,7 +3649,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP

        ProtoLog.v(WM_DEBUG_RESIZE, "Reporting new frame to %s: %s", this,
                mWindowFrames.mCompatFrame);
        if (mWinAnimator.mDrawState == DRAW_PENDING) {
        final boolean drawPending = mWinAnimator.mDrawState == DRAW_PENDING;
        if (drawPending) {
            ProtoLog.i(WM_DEBUG_ORIENTATION, "Resizing %s WITH DRAW PENDING", this);
        }

@@ -3668,7 +3667,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mWindowFrames.clearReportResizeHints();

        final MergedConfiguration mergedConfiguration = mLastReportedConfiguration;
        final boolean reportDraw = mWinAnimator.mDrawState == DRAW_PENDING || useBLASTSync() || !mRedrawForSyncReported;
        final boolean reportDraw = drawPending || useBLASTSync() || !mRedrawForSyncReported;
        final boolean forceRelayout = reportOrientation || isDragResizeChanged() || !mRedrawForSyncReported;
        final int displayId = getDisplayId();
        fillClientWindowFrames(mClientWindowFrames);
@@ -3679,6 +3678,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
            mClient.resized(mClientWindowFrames, reportDraw, mergedConfiguration, forceRelayout,
                    getDisplayContent().getDisplayPolicy().areSystemBarsForcedShownLw(this),
                    displayId);
            if (drawPending && reportOrientation && mOrientationChanging) {
                mOrientationChangeRedrawRequestTime = SystemClock.elapsedRealtime();
                ProtoLog.v(WM_DEBUG_ORIENTATION,
                        "Requested redraw for orientation change: %s", this);
            }

            if (mWmService.mAccessibilityController != null) {
                mWmService.mAccessibilityController.onSomeWindowResizedOrMoved(displayId);
@@ -5732,6 +5736,18 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    }

    boolean finishDrawing(SurfaceControl.Transaction postDrawTransaction) {
        if (mOrientationChangeRedrawRequestTime > 0) {
            final long duration =
                    SystemClock.elapsedRealtime() - mOrientationChangeRedrawRequestTime;
            Slog.i(TAG, "finishDrawing of orientation change: " + this + " " + duration + "ms");
            mOrientationChangeRedrawRequestTime = 0;
        } else if (mActivityRecord != null && mActivityRecord.mRelaunchStartTime != 0
                && mActivityRecord.findMainWindow() == this) {
            final long duration =
                    SystemClock.elapsedRealtime() - mActivityRecord.mRelaunchStartTime;
            Slog.i(TAG, "finishDrawing of relaunch: " + this + " " + duration + "ms");
            mActivityRecord.mRelaunchStartTime = 0;
        }
        if (!onSyncFinishedDrawing()) {
            return mWinAnimator.finishDrawingLocked(postDrawTransaction);
        }