am 2a10ff08: am 60e15dae: Merge "Fixed a bug where a fingerprint animation was not running" into mnc-dev

* commit '2a10ff0893ea642316af983b8a0c39b749020c25':
  Fixed a bug where a fingerprint animation was not running
This commit is contained in:
Selim Cinek
2015-07-17 01:54:21 +00:00
committed by Android Git Automerger
10 changed files with 42 additions and 30 deletions

View File

@@ -308,7 +308,8 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
boolean showNextSecurityScreenOrFinish(boolean authenticated) {
if (DEBUG) Log.d(TAG, "showNextSecurityScreenOrFinish(" + authenticated + ")");
boolean finish = false;
if (mUpdateMonitor.getUserHasTrust(KeyguardUpdateMonitor.getCurrentUser())) {
if (mUpdateMonitor.getUserCanSkipBouncer(
KeyguardUpdateMonitor.getCurrentUser())) {
finish = true;
} else if (SecurityMode.None == mCurrentSecuritySelection) {
SecurityMode securityMode = mSecurityModel.getSecurityMode();

View File

@@ -497,9 +497,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
& DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT) != 0;
}
public boolean getUserCanSkipBouncer(int userId) {
return getUserHasTrust(userId) || mUserFingerprintAuthenticated.get(userId);
}
public boolean getUserHasTrust(int userId) {
return !isTrustDisabled(userId) && mUserHasTrust.get(userId)
|| mUserFingerprintAuthenticated.get(userId);
return !isTrustDisabled(userId) && mUserHasTrust.get(userId);
}
public boolean getUserTrustIsManaged(int userId) {

View File

@@ -92,7 +92,8 @@ public class CastTile extends QSTile<QSTile.BooleanState> {
@Override
protected void handleUpdateState(BooleanState state, Object arg) {
state.visible = !(mKeyguard.isSecure() && mKeyguard.isShowing() && !mKeyguard.isTrusted());
state.visible = !mKeyguard.isSecure() || !mKeyguard.isShowing()
|| mKeyguard.canSkipBouncer();
state.label = mContext.getString(R.string.quick_settings_cast_title);
state.value = false;
state.autoMirrorDrawable = false;

View File

@@ -252,10 +252,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private Intent getCameraIntent() {
KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
boolean currentUserHasTrust = updateMonitor.getUserHasTrust(
boolean canSkipBouncer = updateMonitor.getUserCanSkipBouncer(
KeyguardUpdateMonitor.getCurrentUser());
boolean secure = mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser());
return (secure && !currentUserHasTrust) ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
return (secure && !canSkipBouncer) ? SECURE_CAMERA_INTENT : INSECURE_CAMERA_INTENT;
}
private void updateCameraVisibility() {

View File

@@ -214,7 +214,7 @@ public class LockIcon extends KeyguardAffordanceView {
} else if (oldState == STATE_FINGERPRINT_ERROR && newState == STATE_FINGERPRINT) {
return R.drawable.lockscreen_fingerprint_error_state_to_fp_animation;
} else if (oldState == STATE_FINGERPRINT && newState == STATE_LOCK_OPEN
&& !mUnlockMethodCache.isCurrentlyInsecure()) {
&& !mUnlockMethodCache.isTrusted()) {
return R.drawable.lockscreen_fingerprint_draw_off_animation;
} else if (newState == STATE_FINGERPRINT && !oldScreenOn && screenOn) {
return R.drawable.lockscreen_fingerprint_draw_on_animation;
@@ -226,7 +226,7 @@ public class LockIcon extends KeyguardAffordanceView {
private int getState() {
boolean fingerprintRunning =
KeyguardUpdateMonitor.getInstance(mContext).isFingerprintDetectionRunning();
if (mUnlockMethodCache.isCurrentlyInsecure()) {
if (mUnlockMethodCache.canSkipBouncer()) {
return STATE_LOCK_OPEN;
} else if (mTransientFpError) {
return STATE_FINGERPRINT_ERROR;

View File

@@ -2001,7 +2001,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
}
public boolean isKeyguardCurrentlySecure() {
return !mUnlockMethodCache.isCurrentlyInsecure();
return !mUnlockMethodCache.canSkipBouncer();
}
public void setPanelExpanded(boolean isExpanded) {
@@ -3051,20 +3051,20 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
boolean isOccluded = mStatusBarKeyguardViewManager.isOccluded();
boolean isBouncerShowing = mStatusBarKeyguardViewManager.isBouncerShowing();
boolean isSecure = mUnlockMethodCache.isMethodSecure();
boolean isCurrentlyInsecure = mUnlockMethodCache.isCurrentlyInsecure();
boolean canSkipBouncer = mUnlockMethodCache.canSkipBouncer();
int stateFingerprint = getLoggingFingerprint(mState,
isShowing,
isOccluded,
isBouncerShowing,
isSecure,
isCurrentlyInsecure);
canSkipBouncer);
if (stateFingerprint != mLastLoggedStateFingerprint) {
EventLogTags.writeSysuiStatusBarState(mState,
isShowing ? 1 : 0,
isOccluded ? 1 : 0,
isBouncerShowing ? 1 : 0,
isSecure ? 1 : 0,
isCurrentlyInsecure ? 1 : 0);
canSkipBouncer ? 1 : 0);
mLastLoggedStateFingerprint = stateFingerprint;
}
}
@@ -3668,7 +3668,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
public void onTrackingStopped(boolean expand) {
if (mState == StatusBarState.KEYGUARD || mState == StatusBarState.SHADE_LOCKED) {
if (!expand && !mUnlockMethodCache.isCurrentlyInsecure()) {
if (!expand && !mUnlockMethodCache.canSkipBouncer()) {
showBouncer();
}
}

View File

@@ -105,7 +105,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener,
public void onTrackingStarted() {
mExpanding = true;
mDarkenWhileDragging = !mUnlockMethodCache.isCurrentlyInsecure();
mDarkenWhileDragging = !mUnlockMethodCache.canSkipBouncer();
}
public void onExpandingFinished() {

View File

@@ -39,9 +39,10 @@ public class UnlockMethodCache {
/** Whether the user configured a secure unlock method (PIN, password, etc.) */
private boolean mSecure;
/** Whether the unlock method is currently insecure (insecure method or trusted environment) */
private boolean mCurrentlyInsecure;
private boolean mCanSkipBouncer;
private boolean mTrustManaged;
private boolean mFaceUnlockRunning;
private boolean mTrusted;
private UnlockMethodCache(Context ctx) {
mLockPatternUtils = new LockPatternUtils(ctx);
@@ -64,11 +65,15 @@ public class UnlockMethodCache {
return mSecure;
}
public boolean isTrusted() {
return mTrusted;
}
/**
* @return whether the lockscreen is currently insecure, i. e. the bouncer won't be shown
* @return whether the lockscreen is currently insecure, and the bouncer won't be shown
*/
public boolean isCurrentlyInsecure() {
return mCurrentlyInsecure;
public boolean canSkipBouncer() {
return mCanSkipBouncer;
}
public void addListener(OnUnlockMethodChangedListener listener) {
@@ -82,15 +87,17 @@ public class UnlockMethodCache {
private void update(boolean updateAlways) {
int user = KeyguardUpdateMonitor.getCurrentUser();
boolean secure = mLockPatternUtils.isSecure(user);
boolean currentlyInsecure = !secure || mKeyguardUpdateMonitor.getUserHasTrust(user);
boolean canSkipBouncer = !secure || mKeyguardUpdateMonitor.getUserCanSkipBouncer(user);
boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user);
boolean faceUnlockRunning = mKeyguardUpdateMonitor.isFaceUnlockRunning(user)
&& trustManaged;
boolean changed = secure != mSecure || currentlyInsecure != mCurrentlyInsecure ||
boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer ||
trustManaged != mTrustManaged || faceUnlockRunning != mFaceUnlockRunning;
if (changed || updateAlways) {
mSecure = secure;
mCurrentlyInsecure = currentlyInsecure;
mCanSkipBouncer = canSkipBouncer;
mTrusted = trusted;
mTrustManaged = trustManaged;
mFaceUnlockRunning = faceUnlockRunning;
notifyListeners();

View File

@@ -36,7 +36,7 @@ public final class KeyguardMonitor extends KeyguardUpdateMonitorCallback {
private int mCurrentUser;
private boolean mShowing;
private boolean mSecure;
private boolean mTrusted;
private boolean mCanSkipBouncer;
private boolean mListening;
@@ -47,7 +47,7 @@ public final class KeyguardMonitor extends KeyguardUpdateMonitorCallback {
@Override
public void onUserSwitched(int newUserId) {
mCurrentUser = newUserId;
updateTrustedState();
updateCanSkipBouncerState();
}
};
}
@@ -57,7 +57,7 @@ public final class KeyguardMonitor extends KeyguardUpdateMonitorCallback {
if (mCallbacks.size() != 0 && !mListening) {
mListening = true;
mCurrentUser = ActivityManager.getCurrentUser();
updateTrustedState();
updateCanSkipBouncerState();
mKeyguardUpdateMonitor.registerCallback(this);
mUserTracker.startTracking();
}
@@ -79,8 +79,8 @@ public final class KeyguardMonitor extends KeyguardUpdateMonitorCallback {
return mSecure;
}
public boolean isTrusted() {
return mTrusted;
public boolean canSkipBouncer() {
return mCanSkipBouncer;
}
public void notifyKeyguardState(boolean showing, boolean secure) {
@@ -92,12 +92,12 @@ public final class KeyguardMonitor extends KeyguardUpdateMonitorCallback {
@Override
public void onTrustChanged(int userId) {
updateTrustedState();
updateCanSkipBouncerState();
notifyKeyguardChanged();
}
private void updateTrustedState() {
mTrusted = mKeyguardUpdateMonitor.getUserHasTrust(mCurrentUser);
private void updateCanSkipBouncerState() {
mCanSkipBouncer = mKeyguardUpdateMonitor.getUserCanSkipBouncer(mCurrentUser);
}
private void notifyKeyguardChanged() {

View File

@@ -412,7 +412,7 @@ public class UserSwitcherController {
public int getCount() {
boolean secureKeyguardShowing = mController.mKeyguardMonitor.isShowing()
&& mController.mKeyguardMonitor.isSecure()
&& !mController.mKeyguardMonitor.isTrusted();
&& !mController.mKeyguardMonitor.canSkipBouncer();
if (!secureKeyguardShowing) {
return mController.mUsers.size();
}