am 8588b331: am f8acd1d8: Merge "Adapted the behavior when unlocking with fingerprint is not allowed" into mnc-dev
* commit '8588b3317c848e93998616c981f8c997197b4222': Adapted the behavior when unlocking with fingerprint is not allowed
This commit is contained in:
@@ -112,7 +112,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
private static final int MSG_DEVICE_PROVISIONED = 308;
|
private static final int MSG_DEVICE_PROVISIONED = 308;
|
||||||
private static final int MSG_DPM_STATE_CHANGED = 309;
|
private static final int MSG_DPM_STATE_CHANGED = 309;
|
||||||
private static final int MSG_USER_SWITCHING = 310;
|
private static final int MSG_USER_SWITCHING = 310;
|
||||||
private static final int MSG_KEYGUARD_VISIBILITY_CHANGED = 312;
|
private static final int MSG_KEYGUARD_VISIBILITY_CHANGED = 311;
|
||||||
|
private static final int MSG_KEYGUARD_RESET = 312;
|
||||||
private static final int MSG_BOOT_COMPLETED = 313;
|
private static final int MSG_BOOT_COMPLETED = 313;
|
||||||
private static final int MSG_USER_SWITCH_COMPLETE = 314;
|
private static final int MSG_USER_SWITCH_COMPLETE = 314;
|
||||||
private static final int MSG_USER_INFO_CHANGED = 317;
|
private static final int MSG_USER_INFO_CHANGED = 317;
|
||||||
@@ -136,6 +137,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
private boolean mKeyguardIsVisible;
|
private boolean mKeyguardIsVisible;
|
||||||
private boolean mBouncer;
|
private boolean mBouncer;
|
||||||
private boolean mBootCompleted;
|
private boolean mBootCompleted;
|
||||||
|
private boolean mUserHasAuthenticatedSinceBoot;
|
||||||
|
|
||||||
// Device provisioning state
|
// Device provisioning state
|
||||||
private boolean mDeviceProvisioned;
|
private boolean mDeviceProvisioned;
|
||||||
@@ -195,6 +197,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
case MSG_KEYGUARD_VISIBILITY_CHANGED:
|
case MSG_KEYGUARD_VISIBILITY_CHANGED:
|
||||||
handleKeyguardVisibilityChanged(msg.arg1);
|
handleKeyguardVisibilityChanged(msg.arg1);
|
||||||
break;
|
break;
|
||||||
|
case MSG_KEYGUARD_RESET:
|
||||||
|
handleKeyguardReset();
|
||||||
|
break;
|
||||||
case MSG_KEYGUARD_BOUNCER_CHANGED:
|
case MSG_KEYGUARD_BOUNCER_CHANGED:
|
||||||
handleKeyguardBouncerChanged(msg.arg1);
|
handleKeyguardBouncerChanged(msg.arg1);
|
||||||
break;
|
break;
|
||||||
@@ -498,7 +503,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean getUserCanSkipBouncer(int userId) {
|
public boolean getUserCanSkipBouncer(int userId) {
|
||||||
return getUserHasTrust(userId) || mUserFingerprintAuthenticated.get(userId);
|
return getUserHasTrust(userId) || (mUserFingerprintAuthenticated.get(userId)
|
||||||
|
&& isUnlockingWithFingerprintAllowed());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getUserHasTrust(int userId) {
|
public boolean getUserHasTrust(int userId) {
|
||||||
@@ -509,6 +515,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
return mUserTrustIsManaged.get(userId) && !isTrustDisabled(userId);
|
return mUserTrustIsManaged.get(userId) && !isTrustDisabled(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isUnlockingWithFingerprintAllowed() {
|
||||||
|
return mUserHasAuthenticatedSinceBoot;
|
||||||
|
}
|
||||||
|
|
||||||
static class DisplayClientState {
|
static class DisplayClientState {
|
||||||
public int clientGeneration;
|
public int clientGeneration;
|
||||||
public boolean clearing;
|
public boolean clearing;
|
||||||
@@ -883,14 +893,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldListenForFingerprint() {
|
private boolean shouldListenForFingerprint() {
|
||||||
return mKeyguardIsVisible && !mSwitchingUser
|
return mKeyguardIsVisible && !mSwitchingUser;
|
||||||
&& mTrustManager.hasUserAuthenticatedSinceBoot(ActivityManager.getCurrentUser());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startListeningForFingerprint() {
|
private void startListeningForFingerprint() {
|
||||||
if (DEBUG) Log.v(TAG, "startListeningForFingerprint()");
|
if (DEBUG) Log.v(TAG, "startListeningForFingerprint()");
|
||||||
int userId = ActivityManager.getCurrentUser();
|
int userId = ActivityManager.getCurrentUser();
|
||||||
if (isUnlockWithFingerPrintPossible(userId)) {
|
if (isUnlockWithFingerPrintPossible(userId)) {
|
||||||
|
mUserHasAuthenticatedSinceBoot = mTrustManager.hasUserAuthenticatedSinceBoot(
|
||||||
|
ActivityManager.getCurrentUser());
|
||||||
if (mFingerprintCancelSignal != null) {
|
if (mFingerprintCancelSignal != null) {
|
||||||
mFingerprintCancelSignal.cancel();
|
mFingerprintCancelSignal.cancel();
|
||||||
}
|
}
|
||||||
@@ -1183,6 +1194,16 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
updateFingerprintListeningState();
|
updateFingerprintListeningState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle {@link #MSG_KEYGUARD_RESET}
|
||||||
|
*/
|
||||||
|
private void handleKeyguardReset() {
|
||||||
|
if (DEBUG) Log.d(TAG, "handleKeyguardReset");
|
||||||
|
if (!isUnlockingWithFingerprintAllowed()) {
|
||||||
|
updateFingerprintListeningState();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle {@link #MSG_KEYGUARD_BOUNCER_CHANGED}
|
* Handle {@link #MSG_KEYGUARD_BOUNCER_CHANGED}
|
||||||
* @see #sendKeyguardBouncerChanged(boolean)
|
* @see #sendKeyguardBouncerChanged(boolean)
|
||||||
@@ -1296,6 +1317,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
message.sendToTarget();
|
message.sendToTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendKeyguardReset() {
|
||||||
|
mHandler.obtainMessage(MSG_KEYGUARD_RESET).sendToTarget();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see #handleKeyguardBouncerChanged(int)
|
* @see #handleKeyguardBouncerChanged(int)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -461,7 +461,9 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
@Override
|
@Override
|
||||||
public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) {
|
public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) {
|
||||||
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
|
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
|
||||||
mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated();
|
if (mUpdateMonitor.isUnlockingWithFingerprintAllowed()) {
|
||||||
|
mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (wakeAndUnlocking) {
|
if (wakeAndUnlocking) {
|
||||||
mWakeAndUnlocking = true;
|
mWakeAndUnlocking = true;
|
||||||
|
|||||||
@@ -659,6 +659,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFingerprintHelp(int msgId, String helpString) {
|
public void onFingerprintHelp(int msgId, String helpString) {
|
||||||
|
if (!KeyguardUpdateMonitor.getInstance(mContext).isUnlockingWithFingerprintAllowed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
mLockIcon.setTransientFpError(true);
|
mLockIcon.setTransientFpError(true);
|
||||||
mIndicationController.showTransientIndication(helpString,
|
mIndicationController.showTransientIndication(helpString,
|
||||||
getResources().getColor(R.color.system_warning_color, null));
|
getResources().getColor(R.color.system_warning_color, null));
|
||||||
@@ -668,6 +671,9 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFingerprintError(int msgId, String errString) {
|
public void onFingerprintError(int msgId, String errString) {
|
||||||
|
if (!KeyguardUpdateMonitor.getInstance(mContext).isUnlockingWithFingerprintAllowed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// TODO: Go to bouncer if this is "too many attempts" (lockout) error.
|
// TODO: Go to bouncer if this is "too many attempts" (lockout) error.
|
||||||
mIndicationController.showTransientIndication(errString,
|
mIndicationController.showTransientIndication(errString,
|
||||||
getResources().getColor(R.color.system_warning_color, null));
|
getResources().getColor(R.color.system_warning_color, null));
|
||||||
|
|||||||
@@ -224,13 +224,14 @@ public class LockIcon extends KeyguardAffordanceView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getState() {
|
private int getState() {
|
||||||
boolean fingerprintRunning =
|
KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
|
||||||
KeyguardUpdateMonitor.getInstance(mContext).isFingerprintDetectionRunning();
|
boolean fingerprintRunning = updateMonitor.isFingerprintDetectionRunning();
|
||||||
|
boolean unlockingAllowed = updateMonitor.isUnlockingWithFingerprintAllowed();
|
||||||
if (mUnlockMethodCache.canSkipBouncer()) {
|
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;
|
||||||
} else if (fingerprintRunning) {
|
} else if (fingerprintRunning && unlockingAllowed) {
|
||||||
return STATE_FINGERPRINT;
|
return STATE_FINGERPRINT;
|
||||||
} else if (mUnlockMethodCache.isFaceUnlockRunning()) {
|
} else if (mUnlockMethodCache.isFaceUnlockRunning()) {
|
||||||
return STATE_FACE_UNLOCK;
|
return STATE_FACE_UNLOCK;
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ public class StatusBarKeyguardViewManager {
|
|||||||
} else {
|
} else {
|
||||||
showBouncerOrKeyguard();
|
showBouncerOrKeyguard();
|
||||||
}
|
}
|
||||||
|
KeyguardUpdateMonitor.getInstance(mContext).sendKeyguardReset();
|
||||||
updateStates();
|
updateStates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,6 +133,9 @@ public class UnlockMethodCache {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) {
|
public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) {
|
||||||
|
if (!mKeyguardUpdateMonitor.isUnlockingWithFingerprintAllowed()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
update(false /* updateAlways */);
|
update(false /* updateAlways */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user