Merge changes I93b8ed74,I43decfee

* changes:
  Update callbacks when initializing to initial state
  UI Keyguard fixes
This commit is contained in:
TreeHugger Robot
2016-11-10 08:26:54 +00:00
committed by Android (Google) Code Review
3 changed files with 50 additions and 33 deletions

View File

@@ -285,6 +285,7 @@ public class KeyguardViewMediator extends SystemUI {
private LockPatternUtils mLockPatternUtils;
private boolean mKeyguardDonePending = false;
private boolean mHideAnimationRun = false;
private boolean mHideAnimationRunning = false;
private SoundPool mLockSounds;
private int mLockSoundId;
@@ -515,9 +516,7 @@ public class KeyguardViewMediator extends SystemUI {
return;
}
if (!mKeyguardDonePending) {
KeyguardViewMediator.this.handleKeyguardDone(true /* authenticated */);
}
tryKeyguardDone(true);
if (strongAuth) {
mUpdateMonitor.reportSuccessfulStrongAuthUnlockAttempt();
}
@@ -545,7 +544,8 @@ public class KeyguardViewMediator extends SystemUI {
mKeyguardDonePending = true;
mHideAnimationRun = true;
mStatusBarKeyguardViewManager.startPreHideAnimation(null /* finishRunnable */);
mHideAnimationRunning = true;
mStatusBarKeyguardViewManager.startPreHideAnimation(mHideAnimationFinishedRunnable);
mHandler.sendEmptyMessageDelayed(KEYGUARD_DONE_PENDING_TIMEOUT,
KEYGUARD_DONE_PENDING_TIMEOUT_MS);
if (strongAuth) {
@@ -565,9 +565,11 @@ public class KeyguardViewMediator extends SystemUI {
public void readyForKeyguardDone() {
Trace.beginSection("KeyguardViewMediator.mViewMediatorCallback#readyForKeyguardDone");
if (mKeyguardDonePending) {
mKeyguardDonePending = false;
// Somebody has called keyguardDonePending before, which means that we are
// authenticated
KeyguardViewMediator.this.handleKeyguardDone(true /* authenticated */);
tryKeyguardDone(true);
}
Trace.endSection();
}
@@ -643,9 +645,7 @@ public class KeyguardViewMediator extends SystemUI {
// Assume keyguard is showing (unless it's disabled) until we know for sure...
setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled(
KeyguardUpdateMonitor.getCurrentUser()));
updateInputRestrictedLocked();
mTrustManager.reportKeyguardShowingChanged();
KeyguardUpdateMonitor.getCurrentUser()), true /* forceCallbacks */);
mStatusBarKeyguardViewManager =
SystemUIFactory.getInstance().createStatusBarKeyguardViewManager(mContext,
@@ -1257,7 +1257,7 @@ public class KeyguardViewMediator extends SystemUI {
*/
public void handleDismiss(boolean allowWhileOccluded) {
if (mShowing && (allowWhileOccluded || !mOccluded)) {
mStatusBarKeyguardViewManager.dismiss();
mStatusBarKeyguardViewManager.dismissAndCollapse();
}
}
@@ -1493,6 +1493,16 @@ public class KeyguardViewMediator extends SystemUI {
}
};
private void tryKeyguardDone(boolean authenticated) {
if (!mKeyguardDonePending && mHideAnimationRun && !mHideAnimationRunning) {
handleKeyguardDone(authenticated);
} else if (!mHideAnimationRun) {
mHideAnimationRun = true;
mHideAnimationRunning = true;
mStatusBarKeyguardViewManager.startPreHideAnimation(mHideAnimationFinishedRunnable);
}
}
/**
* @see #keyguardDone
* @see #KEYGUARD_DONE
@@ -1679,6 +1689,11 @@ public class KeyguardViewMediator extends SystemUI {
}
};
private final Runnable mHideAnimationFinishedRunnable = () -> {
mHideAnimationRunning = false;
tryKeyguardDone(true);
};
/**
* Handle message sent by {@link #hideLocked()}
* @see #HIDE
@@ -1697,16 +1712,10 @@ public class KeyguardViewMediator extends SystemUI {
return;
}
mHiding = true;
if (mShowing && !mOccluded) {
if (!mHideAnimationRun) {
mStatusBarKeyguardViewManager.startPreHideAnimation(mKeyguardGoingAwayRunnable);
} else {
mKeyguardGoingAwayRunnable.run();
}
} else {
// Don't try to rely on WindowManager - if Keyguard wasn't showing, window
// manager won't start the exit animation.
if (mShowing && !mOccluded) {
mKeyguardGoingAwayRunnable.run();
} else {
handleStartKeyguardExitAnimation(
SystemClock.uptimeMillis() + mHideAnimation.getStartOffset(),
mHideAnimation.getDuration());
@@ -1806,7 +1815,7 @@ public class KeyguardViewMediator extends SystemUI {
synchronized (KeyguardViewMediator.this) {
if (DEBUG) Log.d(TAG, "handleVerifyUnlock");
setShowingLocked(true);
mStatusBarKeyguardViewManager.verifyUnlock();
mStatusBarKeyguardViewManager.dismissAndCollapse();
}
Trace.endSection();
}
@@ -1969,7 +1978,11 @@ public class KeyguardViewMediator extends SystemUI {
}
private void setShowingLocked(boolean showing) {
if (showing != mShowing) {
setShowingLocked(showing, false /* forceCallbacks */);
}
private void setShowingLocked(boolean showing, boolean forceCallbacks) {
if (showing != mShowing || forceCallbacks) {
mShowing = showing;
int size = mKeyguardStateCallbacks.size();
for (int i = size - 1; i >= 0; i--) {

View File

@@ -3552,8 +3552,14 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
AsyncTask.execute(runnable);
}
if (dismissShade) {
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */,
true /* delayed*/);
if (mExpandedVisible) {
animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_RECENTS_PANEL, true /* force */,
true /* delayed*/);
} else {
// Do it after DismissAction has been processed to conserve the needed ordering.
mHandler.post(this::runPostCollapseRunnables);
}
}
return deferred;
}, cancelAction, afterKeyguardGone);
@@ -3631,12 +3637,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
dismissKeyguardThenExecute(action, null /* cancelRunnable */, afterKeyguardGone);
}
public void dismissKeyguard() {
mStatusBarKeyguardViewManager.dismiss();
}
private void dismissKeyguardThenExecute(OnDismissAction action, Runnable cancelAction,
boolean afterKeyguardGone) {
afterKeyguardGone |= mStatusBarKeyguardViewManager.isShowing()
&& mStatusBarKeyguardViewManager.isOccluded();
if (mStatusBarKeyguardViewManager.isShowing()) {
mStatusBarKeyguardViewManager.dismissWithAction(action, cancelAction,
afterKeyguardGone);
@@ -4249,7 +4253,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
}, delay + StackStateAnimator.ANIMATION_DURATION_GO_TO_FULL_SHADE);
}
} else {
} else if (!mNotificationPanel.isCollapsing()) {
instantCollapseNotificationPanel();
}
updateKeyguardState(staying, false /* fromShadeLocked */);

View File

@@ -155,8 +155,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
if (!afterKeyguardGone) {
mBouncer.showWithDismissAction(r, cancelAction);
} else {
mBouncer.show(false /* resetSecuritySelection */);
mAfterKeyguardGoneAction = r;
mBouncer.show(false /* resetSecuritySelection */);
}
}
updateStates();
@@ -235,10 +235,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mDeviceWillWakeUp = !mDeviceInteractive;
}
public void verifyUnlock() {
dismiss();
}
public void setNeedsInput(boolean needsInput) {
mStatusBarWindowManager.setKeyguardNeedsInput(needsInput);
}
@@ -333,6 +329,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
}
});
} else {
executeAfterKeyguardGoneAction();
if (mFingerprintUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING) {
mFingerprintUnlockController.startKeyguardFadingAway();
mPhoneStatusBar.setKeyguardFadingAway(startTime, 0, 240);
@@ -372,7 +369,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mStatusBarWindowManager.setKeyguardShowing(false);
mBouncer.hide(true /* destroyView */);
mViewMediatorCallback.keyguardGone();
executeAfterKeyguardGoneAction();
updateStates();
}
}
@@ -423,6 +419,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
/**
* Dismisses the keyguard by going to the next screen or making it gone.
*/
public void dismissAndCollapse() {
mPhoneStatusBar.executeRunnableDismissingKeyguard(null, null, true, false, true);
}
public void dismiss() {
showBouncer();
}