Merge "Fixed a bug where a fingerprint animation was not running" into mnc-dev

This commit is contained in:
Selim Cinek
2015-07-17 01:29:26 +00:00
committed by Android (Google) Code Review
10 changed files with 42 additions and 33 deletions

View File

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

View File

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

View File

@@ -92,7 +92,8 @@ public class CastTile extends QSTile<QSTile.BooleanState> {
@Override @Override
protected void handleUpdateState(BooleanState state, Object arg) { 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.label = mContext.getString(R.string.quick_settings_cast_title);
state.value = false; state.value = false;
state.autoMirrorDrawable = false; state.autoMirrorDrawable = false;

View File

@@ -18,7 +18,6 @@ package com.android.systemui.statusbar.phone;
import android.app.ActivityManager; import android.app.ActivityManager;
import android.app.ActivityManagerNative; import android.app.ActivityManagerNative;
import android.app.Application;
import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver; import android.content.BroadcastReceiver;
import android.content.ComponentName; import android.content.ComponentName;
@@ -30,8 +29,6 @@ import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.IBinder; import android.os.IBinder;
@@ -255,10 +252,10 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
private Intent getCameraIntent() { private Intent getCameraIntent() {
KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext); KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
boolean currentUserHasTrust = updateMonitor.getUserHasTrust( boolean canSkipBouncer = updateMonitor.getUserCanSkipBouncer(
KeyguardUpdateMonitor.getCurrentUser()); KeyguardUpdateMonitor.getCurrentUser());
boolean secure = mLockPatternUtils.isSecure(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() { private void updateCameraVisibility() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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