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

Commit 2acc537c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Set launch power mode for display change transition"

parents 3973a2e7 38b5af54
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -667,14 +667,14 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({
            POWER_MODE_REASON_START_ACTIVITY,
            POWER_MODE_REASON_FREEZE_DISPLAY,
            POWER_MODE_REASON_CHANGE_DISPLAY,
            POWER_MODE_REASON_UNKNOWN_VISIBILITY,
            POWER_MODE_REASON_ALL,
    })
    @interface PowerModeReason {}

    static final int POWER_MODE_REASON_START_ACTIVITY = 1 << 0;
    static final int POWER_MODE_REASON_FREEZE_DISPLAY = 1 << 1;
    static final int POWER_MODE_REASON_CHANGE_DISPLAY = 1 << 1;
    /** @see UnknownAppVisibilityController */
    static final int POWER_MODE_REASON_UNKNOWN_VISIBILITY = 1 << 2;
    /** This can only be used by {@link #endLaunchPowerMode(int)}.*/
+2 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_C
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_LAYOUT;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.wm.ActivityRecord.State.RESUMED;
import static com.android.server.wm.ActivityTaskManagerService.POWER_MODE_REASON_CHANGE_DISPLAY;
import static com.android.server.wm.DisplayContentProto.APP_TRANSITION;
import static com.android.server.wm.DisplayContentProto.CLOSING_APPS;
import static com.android.server.wm.DisplayContentProto.CURRENT_FOCUS;
@@ -3227,6 +3228,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        }
        final Transition t = controller.requestTransitionIfNeeded(TRANSIT_CHANGE, this);
        if (t != null) {
            mAtmService.startLaunchPowerMode(POWER_MODE_REASON_CHANGE_DISPLAY);
            if (getRotation() != getWindowConfiguration().getRotation()) {
                mWmService.mLatencyTracker.onActionStart(ACTION_ROTATE_SCREEN);
                controller.mTransitionMetricsReporter.associate(t,
+4 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_GOING_AWAY;
import static android.view.WindowManager.TRANSIT_NONE;
import static android.view.WindowManager.TRANSIT_OPEN;

import static com.android.server.wm.ActivityTaskManagerService.POWER_MODE_REASON_CHANGE_DISPLAY;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
@@ -382,6 +384,8 @@ class TransitionController {
    void finishTransition(@NonNull IBinder token) {
        // It is usually a no-op but make sure that the metric consumer is removed.
        mTransitionMetricsReporter.reportAnimationStart(token, 0 /* startTime */);
        // It is a no-op if the transition did not change the display.
        mAtm.endLaunchPowerMode(POWER_MODE_REASON_CHANGE_DISPLAY);
        final Transition record = Transition.fromBinder(token);
        if (record == null || !mPlayingTransitions.contains(record)) {
            Slog.e(TAG, "Trying to finish a non-playing transition " + token);
+3 −3
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ import static com.android.internal.util.LatencyTracker.ACTION_ROTATE_SCREEN;
import static com.android.server.LockGuard.INDEX_WINDOW;
import static com.android.server.LockGuard.installLock;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.wm.ActivityTaskManagerService.POWER_MODE_REASON_FREEZE_DISPLAY;
import static com.android.server.wm.ActivityTaskManagerService.POWER_MODE_REASON_CHANGE_DISPLAY;
import static com.android.server.wm.DisplayContent.IME_TARGET_CONTROL;
import static com.android.server.wm.DisplayContent.IME_TARGET_INPUT;
import static com.android.server.wm.DisplayContent.IME_TARGET_LAYERING;
@@ -5849,7 +5849,7 @@ public class WindowManagerService extends IWindowManager.Stub
        mScreenFrozenLock.acquire();
        // Apply launch power mode to reduce screen frozen time because orientation change may
        // relaunch activity and redraw windows. This may also help speed up user switching.
        mAtmService.startLaunchPowerMode(POWER_MODE_REASON_FREEZE_DISPLAY);
        mAtmService.startLaunchPowerMode(POWER_MODE_REASON_CHANGE_DISPLAY);

        mDisplayFrozen = true;
        mDisplayFreezeTime = SystemClock.elapsedRealtime();
@@ -5993,7 +5993,7 @@ public class WindowManagerService extends IWindowManager.Stub
        if (configChanged) {
            displayContent.sendNewConfiguration();
        }
        mAtmService.endLaunchPowerMode(POWER_MODE_REASON_FREEZE_DISPLAY);
        mAtmService.endLaunchPowerMode(POWER_MODE_REASON_CHANGE_DISPLAY);
        mLatencyTracker.onActionEnd(ACTION_ROTATE_SCREEN);
    }