Merge changes from topic "presubmit-am-ea4f4574a23a46d2955c3fdbdc2b1120" into sc-v2-dev-plus-aosp

* changes:
  [automerge] [DO NOT MERGE] Move onDrawn callback earlier 2p: e2608c01b7
  [DO NOT MERGE] Move onDrawn callback earlier
This commit is contained in:
Matt Pietal
2022-03-25 15:12:06 +00:00
committed by Android (Google) Code Review
2 changed files with 3 additions and 45 deletions

View File

@@ -210,7 +210,6 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
private static final int KEYGUARD_DONE_PENDING_TIMEOUT = 13; private static final int KEYGUARD_DONE_PENDING_TIMEOUT = 13;
private static final int NOTIFY_STARTED_WAKING_UP = 14; private static final int NOTIFY_STARTED_WAKING_UP = 14;
private static final int NOTIFY_SCREEN_TURNED_ON = 15; private static final int NOTIFY_SCREEN_TURNED_ON = 15;
private static final int NOTIFY_SCREEN_TURNED_OFF = 16;
private static final int NOTIFY_STARTED_GOING_TO_SLEEP = 17; private static final int NOTIFY_STARTED_GOING_TO_SLEEP = 17;
private static final int SYSTEM_READY = 18; private static final int SYSTEM_READY = 18;
private static final int CANCEL_KEYGUARD_EXIT_ANIM = 19; private static final int CANCEL_KEYGUARD_EXIT_ANIM = 19;
@@ -441,7 +440,6 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
private boolean mInGestureNavigationMode; private boolean mInGestureNavigationMode;
private boolean mWakeAndUnlocking; private boolean mWakeAndUnlocking;
private IKeyguardDrawnCallback mDrawnCallback;
private CharSequence mCustomMessage; private CharSequence mCustomMessage;
/** /**
@@ -1264,7 +1262,6 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
} }
public void onScreenTurnedOff() { public void onScreenTurnedOff() {
notifyScreenTurnedOff();
mUpdateMonitor.dispatchScreenTurnedOff(); mUpdateMonitor.dispatchScreenTurnedOff();
} }
@@ -1658,12 +1655,6 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
mHandler.sendMessage(msg); mHandler.sendMessage(msg);
} }
private void notifyScreenTurnedOff() {
if (DEBUG) Log.d(TAG, "notifyScreenTurnedOff");
Message msg = mHandler.obtainMessage(NOTIFY_SCREEN_TURNED_OFF);
mHandler.sendMessage(msg);
}
/** /**
* Send message to keyguard telling it to show itself * Send message to keyguard telling it to show itself
* @see #handleShow * @see #handleShow
@@ -1848,9 +1839,6 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
handleNotifyScreenTurnedOn(); handleNotifyScreenTurnedOn();
Trace.endSection(); Trace.endSection();
break; break;
case NOTIFY_SCREEN_TURNED_OFF:
handleNotifyScreenTurnedOff();
break;
case NOTIFY_STARTED_WAKING_UP: case NOTIFY_STARTED_WAKING_UP:
Trace.beginSection( Trace.beginSection(
"KeyguardViewMediator#handleMessage NOTIFY_STARTED_WAKING_UP"); "KeyguardViewMediator#handleMessage NOTIFY_STARTED_WAKING_UP");
@@ -2231,16 +2219,6 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
IRemoteAnimationRunner runner = mKeyguardExitAnimationRunner; IRemoteAnimationRunner runner = mKeyguardExitAnimationRunner;
mKeyguardExitAnimationRunner = null; mKeyguardExitAnimationRunner = null;
if (mWakeAndUnlocking && mDrawnCallback != null) {
// 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();
notifyDrawn(mDrawnCallback);
mDrawnCallback = null;
}
LatencyTracker.getInstance(mContext) LatencyTracker.getInstance(mContext)
.onActionEnd(LatencyTracker.ACTION_LOCKSCREEN_UNLOCK); .onActionEnd(LatencyTracker.ACTION_LOCKSCREEN_UNLOCK);
@@ -2596,11 +2574,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
mKeyguardViewControllerLazy.get().onScreenTurningOn(); mKeyguardViewControllerLazy.get().onScreenTurningOn();
if (callback != null) { if (callback != null) {
if (mWakeAndUnlocking) { notifyDrawn(callback);
mDrawnCallback = callback;
} else {
notifyDrawn(callback);
}
} }
} }
Trace.endSection(); Trace.endSection();
@@ -2615,13 +2589,6 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
Trace.endSection(); Trace.endSection();
} }
private void handleNotifyScreenTurnedOff() {
synchronized (this) {
if (DEBUG) Log.d(TAG, "handleNotifyScreenTurnedOff");
mDrawnCallback = null;
}
}
private void notifyDrawn(final IKeyguardDrawnCallback callback) { private void notifyDrawn(final IKeyguardDrawnCallback callback) {
Trace.beginSection("KeyguardViewMediator#notifyDrawn"); Trace.beginSection("KeyguardViewMediator#notifyDrawn");
if (mPendingDrawnTasks.decrementAndGet() == 0) { if (mPendingDrawnTasks.decrementAndGet() == 0) {
@@ -2790,7 +2757,6 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable,
pw.print(" mPendingLock: "); pw.println(mPendingLock); pw.print(" mPendingLock: "); pw.println(mPendingLock);
pw.print(" mPendingDrawnTasks: "); pw.println(mPendingDrawnTasks.get()); pw.print(" mPendingDrawnTasks: "); pw.println(mPendingDrawnTasks.get());
pw.print(" mWakeAndUnlocking: "); pw.println(mWakeAndUnlocking); pw.print(" mWakeAndUnlocking: "); pw.println(mWakeAndUnlocking);
pw.print(" mDrawnCallback: "); pw.println(mDrawnCallback);
} }
/** /**

View File

@@ -405,7 +405,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
// During wake and unlock, we need to draw black before waking up to avoid abrupt // During wake and unlock, we need to draw black before waking up to avoid abrupt
// brightness changes due to display state transitions. // brightness changes due to display state transitions.
boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn(); boolean alwaysOnEnabled = mDozeParameters.getAlwaysOn();
boolean delayWakeUp = mode == MODE_WAKE_AND_UNLOCK && alwaysOnEnabled && mWakeUpDelay > 0;
Runnable wakeUp = ()-> { Runnable wakeUp = ()-> {
if (!wasDeviceInteractive) { if (!wasDeviceInteractive) {
if (DEBUG_BIO_WAKELOCK) { if (DEBUG_BIO_WAKELOCK) {
@@ -414,15 +413,12 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE, mPowerManager.wakeUp(SystemClock.uptimeMillis(), PowerManager.WAKE_REASON_GESTURE,
"android.policy:BIOMETRIC"); "android.policy:BIOMETRIC");
} }
if (delayWakeUp) {
mKeyguardViewMediator.onWakeAndUnlocking();
}
Trace.beginSection("release wake-and-unlock"); Trace.beginSection("release wake-and-unlock");
releaseBiometricWakeLock(); releaseBiometricWakeLock();
Trace.endSection(); Trace.endSection();
}; };
if (!delayWakeUp && mMode != MODE_NONE) { if (mMode != MODE_NONE) {
wakeUp.run(); wakeUp.run();
} }
switch (mMode) { switch (mMode) {
@@ -472,11 +468,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mUpdateMonitor.awakenFromDream(); mUpdateMonitor.awakenFromDream();
} }
mNotificationShadeWindowController.setNotificationShadeFocusable(false); mNotificationShadeWindowController.setNotificationShadeFocusable(false);
if (delayWakeUp) { mKeyguardViewMediator.onWakeAndUnlocking();
mHandler.postDelayed(wakeUp, mWakeUpDelay);
} else {
mKeyguardViewMediator.onWakeAndUnlocking();
}
Trace.endSection(); Trace.endSection();
break; break;
case MODE_ONLY_WAKE: case MODE_ONLY_WAKE: