diff options
| author | 2022-04-01 12:29:28 +0000 | |
|---|---|---|
| committer | 2022-04-01 12:29:28 +0000 | |
| commit | 1f89ec503ca1421757a1f7ce72a9da73fb336eb6 (patch) | |
| tree | 939c2e9a5c1b95963ed1b9d2d922c2463e3e2e43 | |
| parent | 8142d153d6409149081879f74000bbb65ef62c12 (diff) | |
| parent | 282457293b1f51b4ed80002c259acabd4f646122 (diff) | |
Merge "Move onDrawn callback earlier" into tm-dev
7 files changed, 12 insertions, 80 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 29ca3bffb6aa..e6d4bab78b2f 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -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. --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 8fa5dd2c756b..7f891ea405ae 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -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" /> diff --git a/packages/SystemUI/src/com/android/keyguard/mediator/ScreenOnCoordinator.kt b/packages/SystemUI/src/com/android/keyguard/mediator/ScreenOnCoordinator.kt index 705cf6d5df8e..4b7e9a57ef6a 100644 --- a/packages/SystemUI/src/com/android/keyguard/mediator/ScreenOnCoordinator.kt +++ b/packages/SystemUI/src/com/android/keyguard/mediator/ScreenOnCoordinator.kt @@ -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 - } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 890ddf0d6cac..5f4b372d734b 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -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; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java index aab5ff8d92e6..159d33b5a143 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -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(); - } + mKeyguardViewMediator.onWakeAndUnlocking(); Trace.endSection(); break; case MODE_ONLY_WAKE: diff --git a/packages/SystemUI/tests/src/com/android/keyguard/mediator/ScreenOnCoordinatorTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/mediator/ScreenOnCoordinatorTest.kt index 96e6bd15a3e2..5734c3de70e0 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/mediator/ScreenOnCoordinatorTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/mediator/ScreenOnCoordinatorTest.kt @@ -37,7 +37,6 @@ import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.Mock import org.mockito.Mockito.`when` -import org.mockito.Mockito.never import org.mockito.Mockito.verify import org.mockito.MockitoAnnotations @@ -104,26 +103,6 @@ class ScreenOnCoordinatorTest : SysuiTestCase() { verify(runnable).run() } - @Test - fun testWakeAndUnlockDelaysRunnable() { - // GIVEN wakeAndUnlocking has been set to true - screenOnCoordinator.wakeAndUnlocking = true - - // WHEN the screen turns on and two tasks have completed - screenOnCoordinator.onScreenTurningOn(runnable) - onUnfoldOverlayReady() - onFoldAodReady() - - // THEN the runnable should not have run yet - verify(runnable, never()).run() - - // WHEN the value of wakeAndUnlocking changes - screenOnCoordinator.wakeAndUnlocking = false - - // THEN the runnable should have run, as it is the last task to complete - verify(runnable).run() - } - private fun onUnfoldOverlayReady() { verify(unfoldAnimation).onScreenTurningOn(capture(readyCaptor)) readyCaptor.getValue().run() diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java index 142c2c1ed017..fb8c339e73c8 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java @@ -127,7 +127,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { when(mAuthController.isUdfpsFingerDown()).thenReturn(false); when(mKeyguardBypassController.canPlaySubtleWindowAnimations()).thenReturn(true); mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager); - res.addOverride(com.android.internal.R.integer.config_wakeUpDelayDoze, 0); mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController, mKeyguardViewMediator, mScrimController, mShadeController, mNotificationShadeWindowController, mKeyguardStateController, mHandler, |