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

Commit 80a31847 authored by Matt Pietal's avatar Matt Pietal Committed by Automerger Merge Worker
Browse files

Merge "Move onDrawn callback earlier" into tm-dev am: 1f89ec50

parents 388571e5 1f89ec50
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -1372,10 +1372,6 @@
    <integer name="config_screenBrightnessDoze">1</integer>
    <item name="config_screenBrightnessDozeFloat" format="float" type="dimen">0.0</item>

    <!-- Delay that allows some content to arrive at the display before switching
         from DOZE to ON. -->
    <integer name="config_wakeUpDelayDoze">0</integer>

    <!-- Whether or not to skip the initial brightness ramps when the display transitions to
         STATE_ON. Setting this to true will skip the brightness ramp to the last stored active
         brightness value and will repeat for the following ramp if autobrightness is enabled. -->
+0 −1
Original line number Diff line number Diff line
@@ -3969,7 +3969,6 @@
  <java-symbol type="string" name="config_misprovisionedBrandValue" />

  <java-symbol type="integer" name="db_wal_truncate_size" />
  <java-symbol type="integer" name="config_wakeUpDelayDoze" />

  <!-- For Bluetooth AbsoluteVolume -->
  <java-symbol type="fraction" name="config_prescaleAbsoluteVolume_index1" />
+0 −20
Original line number Diff line number Diff line
@@ -48,18 +48,6 @@ class ScreenOnCoordinator @Inject constructor(
        SysUIUnfoldComponent::getFoldAodAnimationController).getOrNull()
    private val pendingTasks = PendingTasksContainer()

    private var wakeAndUnlockingTask: Runnable? = null
    var wakeAndUnlocking = false
        set(value) {
            if (!value && field) {
                // When updating the value back to false, mark the task complete in order to
                // callback onDrawn
                wakeAndUnlockingTask?.run()
                wakeAndUnlockingTask = null
            }
            field = value
        }

    init {
        screenLifecycle.addObserver(this)
    }
@@ -76,10 +64,6 @@ class ScreenOnCoordinator @Inject constructor(
        unfoldLightRevealAnimation?.onScreenTurningOn(pendingTasks.registerTask("unfold-reveal"))
        foldAodAnimationController?.onScreenTurningOn(pendingTasks.registerTask("fold-to-aod"))

        if (wakeAndUnlocking) {
            wakeAndUnlockingTask = pendingTasks.registerTask("wake-and-unlocking")
        }

        pendingTasks.onTasksComplete { onDrawn.run() }
        Trace.endSection()
    }
@@ -91,8 +75,4 @@ class ScreenOnCoordinator @Inject constructor(

        pendingTasks.reset()
    }

    override fun onScreenTurnedOff() {
        wakeAndUnlockingTask = null
    }
}
+10 −21
Original line number Diff line number Diff line
@@ -318,6 +318,8 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
    // true if the keyguard is hidden by another window
    private boolean mOccluded = false;

    private boolean mWakeAndUnlocking = false;

    /**
     * Helps remember whether the screen has turned on since the last time
     * it turned off due to timeout. see {@link #onScreenTurnedOff(int)}
@@ -452,7 +454,6 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
    private boolean mLockLater;
    private boolean mShowHomeOverLockscreen;
    private boolean mInGestureNavigationMode;

    private CharSequence mCustomMessage;

    /**
@@ -1248,7 +1249,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
        synchronized (this) {
            mDeviceInteractive = false;
            mGoingToSleep = false;
            mScreenOnCoordinator.setWakeAndUnlocking(false);
            mWakeAndUnlocking = false;
            mAnimatingScreenOff = mDozeParameters.shouldAnimateDozingChange();

            resetKeyguardDonePendingLocked();
@@ -2262,7 +2263,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,

            mHiding = false;
            mKeyguardExitAnimationRunner = null;
            mScreenOnCoordinator.setWakeAndUnlocking(false);
            mWakeAndUnlocking = false;
            mPendingLock = false;
            setShowingLocked(true);
            mKeyguardViewControllerLazy.get().show(options);
@@ -2294,14 +2295,12 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,

            int flags = 0;
            if (mKeyguardViewControllerLazy.get().shouldDisableWindowAnimationsForUnlock()
                    || mScreenOnCoordinator.getWakeAndUnlocking()
                            && !mWallpaperSupportsAmbientMode) {
                    || mWakeAndUnlocking && !mWallpaperSupportsAmbientMode) {
                flags |= WindowManagerPolicyConstants
                        .KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS;
            }
            if (mKeyguardViewControllerLazy.get().isGoingToNotificationShade()
                    || mScreenOnCoordinator.getWakeAndUnlocking()
                            && mWallpaperSupportsAmbientMode) {
                    || mWakeAndUnlocking && mWallpaperSupportsAmbientMode) {
                // When the wallpaper supports ambient mode, the scrim isn't fully opaque during
                // wake and unlock, and we should fade in the app on top of the wallpaper
                flags |= WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_TO_SHADE;
@@ -2414,16 +2413,6 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
            IRemoteAnimationRunner runner = mKeyguardExitAnimationRunner;
            mKeyguardExitAnimationRunner = null;

            if (mScreenOnCoordinator.getWakeAndUnlocking()) {

                // Hack level over 9000: To speed up wake-and-unlock sequence, force it to report
                // the next draw from here, so we don't have to wait for window manager to signal
                // this to our ViewRootImpl.
                mKeyguardViewControllerLazy.get().getViewRootImpl().setReportNextDraw(
                        false /* syncBuffer */);
                mScreenOnCoordinator.setWakeAndUnlocking(false);
            }

            LatencyTracker.getInstance(mContext)
                    .onActionEnd(LatencyTracker.ACTION_LOCKSCREEN_UNLOCK);

@@ -2546,7 +2535,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
        }

        setShowingLocked(false);
        mScreenOnCoordinator.setWakeAndUnlocking(false);
        mWakeAndUnlocking = false;
        mDismissCallbackRegistry.notifyDismissSucceeded();
        resetKeyguardDonePendingLocked();
        mHideAnimationRun = false;
@@ -2790,7 +2779,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,

    public void onWakeAndUnlocking() {
        Trace.beginSection("KeyguardViewMediator#onWakeAndUnlocking");
        mScreenOnCoordinator.setWakeAndUnlocking(true);
        mWakeAndUnlocking = true;
        keyguardDone();
        Trace.endSection();
    }
@@ -2926,7 +2915,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
        pw.print("  mHideAnimationRun: "); pw.println(mHideAnimationRun);
        pw.print("  mPendingReset: "); pw.println(mPendingReset);
        pw.print("  mPendingLock: "); pw.println(mPendingLock);
        pw.print("  wakeAndUnlocking: "); pw.println(mScreenOnCoordinator.getWakeAndUnlocking());
        pw.print("  wakeAndUnlocking: "); pw.println(mWakeAndUnlocking);
    }

    /**
@@ -3000,7 +2989,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
    }

    private void setShowingLocked(boolean showing, boolean forceCallbacks) {
        final boolean aodShowing = mDozing && !mScreenOnCoordinator.getWakeAndUnlocking();
        final boolean aodShowing = mDozing && !mWakeAndUnlocking;
        final boolean notifyDefaultDisplayCallbacks = showing != mShowing || forceCallbacks;
        final boolean updateActivityLockScreenState = showing != mShowing
                || aodShowing != mAodShowing || forceCallbacks;
+2 −12
Original line number Diff line number Diff line
@@ -166,7 +166,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
    private final NotificationShadeWindowController mNotificationShadeWindowController;
    private final SessionTracker mSessionTracker;
    private final int mConsecutiveFpFailureThreshold;
    private final int mWakeUpDelay;
    private int mMode;
    private BiometricSourceType mBiometricType;
    private KeyguardViewController mKeyguardViewController;
@@ -302,7 +301,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
        mScrimController = scrimController;
        mKeyguardStateController = keyguardStateController;
        mHandler = handler;
        mWakeUpDelay = resources.getInteger(com.android.internal.R.integer.config_wakeUpDelayDoze);
        mConsecutiveFpFailureThreshold = resources.getInteger(
                R.integer.fp_consecutive_failure_time_ms);
        mKeyguardBypassController = keyguardBypassController;
@@ -433,7 +431,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
        // During wake and unlock, we need to draw black before waking up to avoid abrupt
        // brightness changes due to display state transitions.
        boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn();
        boolean delayWakeUp = mode == MODE_WAKE_AND_UNLOCK && alwaysOnEnabled && mWakeUpDelay > 0;
        Runnable wakeUp = ()-> {
            if (!wasDeviceInteractive) {
                if (DEBUG_BIO_WAKELOCK) {
@@ -442,15 +439,12 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
                mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
                        "android.policy:BIOMETRIC");
            }
            if (delayWakeUp) {
                mKeyguardViewMediator.onWakeAndUnlocking();
            }
            Trace.beginSection("release wake-and-unlock");
            releaseBiometricWakeLock();
            Trace.endSection();
        };

        if (!delayWakeUp && mMode != MODE_NONE) {
        if (mMode != MODE_NONE) {
            wakeUp.run();
        }
        switch (mMode) {
@@ -504,11 +498,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
                    mUpdateMonitor.awakenFromDream();
                }
                mNotificationShadeWindowController.setNotificationShadeFocusable(false);
                if (delayWakeUp) {
                    mHandler.postDelayed(wakeUp, mWakeUpDelay);
                } else {
                mKeyguardViewMediator.onWakeAndUnlocking();
                }
                Trace.endSection();
                break;
            case MODE_ONLY_WAKE:
Loading