Merge "Move onDrawn callback earlier" into tm-dev
This commit is contained in:
@@ -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. -->
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user