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

Commit 3eb77fcb authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "KeyguardController: reduce executeTransition calls" into main

parents 0e03926c f78742ab
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -71,6 +71,17 @@ flag {
  bug: "291870756"
}

flag {
  name: "reduce_keyguard_transitions"
  namespace: "windowing_frontend"
  description: "Avoid setting keyguard transitions ready unless there are no other changes"
  bug: "354647472"
  is_fixed_read_only: true
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "transit_ready_tracking"
  namespace: "windowing_frontend"
+29 −17
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG
import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE;
import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER;

import static com.android.window.flags.Flags.reduceKeyguardTransitions;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -417,31 +418,42 @@ class KeyguardController {

        final TransitionController tc = mRootWindowContainer.mTransitionController;
        final KeyguardDisplayState state = getDisplayState(displayId);
        final DisplayContent dc = mRootWindowContainer.getDisplayContent(displayId);

        final boolean occluded = state.mOccluded;
        final boolean performTransition = isKeyguardLocked(displayId);
        final boolean executeTransition = performTransition && !tc.isCollecting();
        final boolean locked = isKeyguardLocked(displayId);
        final boolean executeTransition = !tc.isShellTransitionsEnabled()
                || (locked && !tc.isCollecting() && !reduceKeyguardTransitions());

        mWindowManager.mPolicy.onKeyguardOccludedChangedLw(occluded);
        final int transitType, transitFlags, notFlags;
        if (state.mOccluded) {
            transitType = TRANSIT_KEYGUARD_OCCLUDE;
            transitFlags = TRANSIT_FLAG_KEYGUARD_OCCLUDING;
            notFlags = TRANSIT_FLAG_KEYGUARD_UNOCCLUDING;
        } else {
            transitType = TRANSIT_KEYGUARD_UNOCCLUDE;
            transitFlags = TRANSIT_FLAG_KEYGUARD_UNOCCLUDING;
            notFlags = TRANSIT_FLAG_KEYGUARD_OCCLUDING;
        }

        mWindowManager.mPolicy.onKeyguardOccludedChangedLw(state.mOccluded);
        mService.deferWindowLayout();
        try {
            if (isKeyguardLocked(displayId)) {
                final int type = occluded ? TRANSIT_KEYGUARD_OCCLUDE : TRANSIT_KEYGUARD_UNOCCLUDE;
                final int flag = occluded ? TRANSIT_FLAG_KEYGUARD_OCCLUDING
                        : TRANSIT_FLAG_KEYGUARD_UNOCCLUDING;
            if (locked) {
                if (tc.isShellTransitionsEnabled()) {
                    final Task trigger = (occluded && topActivity != null)
                    final Task trigger = (state.mOccluded && topActivity != null)
                            ? topActivity.getRootTask() : null;
                    Transition transition = tc.requestTransitionIfNeeded(type, flag, trigger,
                            mRootWindowContainer.getDefaultDisplay());
                    if (trigger != null) {
                        if (transition == null) {
                            transition = tc.getCollectingTransition();
                    tc.requestTransitionIfNeeded(transitType, transitFlags, trigger, dc);
                    final Transition transition = tc.getCollectingTransition();
                    if ((transition.getFlags() & notFlags) != 0 && reduceKeyguardTransitions()) {
                        transition.removeFlag(notFlags);
                    } else {
                        transition.addFlag(transitFlags);
                    }
                    if (trigger != null) {
                        transition.collect(trigger);
                    }
                } else {
                    mRootWindowContainer.getDefaultDisplay().prepareAppTransition(type, flag);
                    dc.prepareAppTransition(transitType, transitFlags);
                }
            } else {
                if (tc.inTransition()) {
@@ -451,8 +463,8 @@ class KeyguardController {
                }
            }
            updateKeyguardSleepToken(displayId);
            if (performTransition && executeTransition) {
                mWindowManager.executeAppTransition();
            if (executeTransition) {
                dc.executeAppTransition();
            }
        } finally {
            mService.continueWindowLayout();
+6 −2
Original line number Diff line number Diff line
@@ -358,8 +358,12 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        return mToken;
    }

    void addFlag(int flag) {
        mFlags |= flag;
    void addFlag(@TransitionFlags int flags) {
        mFlags |= flags;
    }

    void removeFlag(@TransitionFlags int flags) {
        mFlags &= ~flags;
    }

    void calcParallelCollectType(WindowContainerTransaction wct) {