am 69082a29: Merge "Require strong authentication after a timeout" into mnc-dr-dev
* commit '69082a298f50680128ada89a8bef777f0fadf829': Require strong authentication after a timeout
This commit is contained in:
@@ -316,6 +316,15 @@
|
||||
<!-- An explanation text that the password needs to be entered since the device has just been restarted. [CHAR LIMIT=80] -->
|
||||
<string name="kg_prompt_reason_restart_password">Password required when you restart device.</string>
|
||||
|
||||
<!-- An explanation text that the pattern needs to be solved since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
|
||||
<string name="kg_prompt_reason_timeout_pattern">Pattern required for additional security.</string>
|
||||
|
||||
<!-- An explanation text that the pin needs to be entered since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
|
||||
<string name="kg_prompt_reason_timeout_pin">PIN required for additional security.</string>
|
||||
|
||||
<!-- An explanation text that the password needs to be entered since the user hasn't used strong authentication since quite some time. [CHAR LIMIT=80] -->
|
||||
<string name="kg_prompt_reason_timeout_password">Password required for additional security.</string>
|
||||
|
||||
<!-- An explanation text that the pattern needs to be solved since profiles have just been switched. [CHAR LIMIT=80] -->
|
||||
<string name="kg_prompt_reason_switch_profiles_pattern">Pattern required when you switch profiles.</string>
|
||||
|
||||
|
||||
@@ -163,8 +163,9 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
|
||||
* Show a string explaining why the security view needs to be solved.
|
||||
*
|
||||
* @param reason a flag indicating which string should be shown, see
|
||||
* {@link KeyguardSecurityView#PROMPT_REASON_NONE}
|
||||
* and {@link KeyguardSecurityView#PROMPT_REASON_RESTART}
|
||||
* {@link KeyguardSecurityView#PROMPT_REASON_NONE},
|
||||
* {@link KeyguardSecurityView#PROMPT_REASON_RESTART} and
|
||||
* {@link KeyguardSecurityView#PROMPT_REASON_TIMEOUT}.
|
||||
*/
|
||||
public void showPromptReason(int reason) {
|
||||
mSecurityContainer.showPromptReason(reason);
|
||||
@@ -213,9 +214,12 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
|
||||
/**
|
||||
* Authentication has happened and it's time to dismiss keyguard. This function
|
||||
* should clean up and inform KeyguardViewMediator.
|
||||
*
|
||||
* @param strongAuth whether the user has authenticated with strong authentication like
|
||||
* pattern, password or PIN but not by trust agents or fingerprint
|
||||
*/
|
||||
@Override
|
||||
public void finish() {
|
||||
public void finish(boolean strongAuth) {
|
||||
// If there's a pending runnable because the user interacted with a widget
|
||||
// and we're leaving keyguard, then run it.
|
||||
boolean deferKeyguardDone = false;
|
||||
@@ -226,9 +230,9 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
|
||||
}
|
||||
if (mViewMediatorCallback != null) {
|
||||
if (deferKeyguardDone) {
|
||||
mViewMediatorCallback.keyguardDonePending();
|
||||
mViewMediatorCallback.keyguardDonePending(strongAuth);
|
||||
} else {
|
||||
mViewMediatorCallback.keyguardDone(true);
|
||||
mViewMediatorCallback.keyguardDone(strongAuth);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,32 +288,6 @@ public class KeyguardHostView extends FrameLayout implements SecurityCallback {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify that the user can get past the keyguard securely. This is called,
|
||||
* for example, when the phone disables the keyguard but then wants to launch
|
||||
* something else that requires secure access.
|
||||
*
|
||||
* The result will be propogated back via {@link KeyguardViewCallback#keyguardDone(boolean)}
|
||||
*/
|
||||
public void verifyUnlock() {
|
||||
SecurityMode securityMode = mSecurityContainer.getSecurityMode();
|
||||
if (securityMode == KeyguardSecurityModel.SecurityMode.None) {
|
||||
if (mViewMediatorCallback != null) {
|
||||
mViewMediatorCallback.keyguardDone(true);
|
||||
}
|
||||
} else if (securityMode != KeyguardSecurityModel.SecurityMode.Pattern
|
||||
&& securityMode != KeyguardSecurityModel.SecurityMode.PIN
|
||||
&& securityMode != KeyguardSecurityModel.SecurityMode.Password) {
|
||||
// can only verify unlock when in pattern/password mode
|
||||
if (mViewMediatorCallback != null) {
|
||||
mViewMediatorCallback.keyguardDone(false);
|
||||
}
|
||||
} else {
|
||||
// otherwise, go to the unlock screen, see if they can verify it
|
||||
mSecurityContainer.verifyUnlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called before this view is being removed.
|
||||
*/
|
||||
|
||||
@@ -115,6 +115,8 @@ public class KeyguardPasswordView extends KeyguardAbsKeyInputView
|
||||
switch (reason) {
|
||||
case PROMPT_REASON_RESTART:
|
||||
return R.string.kg_prompt_reason_restart_password;
|
||||
case PROMPT_REASON_TIMEOUT:
|
||||
return R.string.kg_prompt_reason_timeout_password;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -332,7 +332,12 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
|
||||
mSecurityMessageDisplay.setMessage(R.string.kg_prompt_reason_restart_pattern,
|
||||
true /* important */);
|
||||
break;
|
||||
case PROMPT_REASON_TIMEOUT:
|
||||
mSecurityMessageDisplay.setMessage(R.string.kg_prompt_reason_timeout_pattern,
|
||||
true /* important */);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,6 +98,8 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
|
||||
switch (reason) {
|
||||
case PROMPT_REASON_RESTART:
|
||||
return R.string.kg_prompt_reason_restart_pin;
|
||||
case PROMPT_REASON_TIMEOUT:
|
||||
return R.string.kg_prompt_reason_timeout_pin;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,12 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
public boolean dismiss(boolean authenticated);
|
||||
public void userActivity();
|
||||
public void onSecurityModeChanged(SecurityMode securityMode, boolean needsInput);
|
||||
public void finish();
|
||||
|
||||
/**
|
||||
* @param strongAuth wheher the user has authenticated with strong authentication like
|
||||
* pattern, password or PIN but not by trust agents or fingerprint
|
||||
*/
|
||||
public void finish(boolean strongAuth);
|
||||
public void reset();
|
||||
}
|
||||
|
||||
@@ -282,7 +287,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
showWipeDialog(failedAttempts, userType);
|
||||
}
|
||||
}
|
||||
monitor.reportFailedUnlockAttempt();
|
||||
monitor.reportFailedStrongAuthUnlockAttempt();
|
||||
mLockPatternUtils.reportFailedPasswordAttempt(KeyguardUpdateMonitor.getCurrentUser());
|
||||
if (timeoutMs > 0) {
|
||||
showTimeoutDialog(timeoutMs);
|
||||
@@ -308,6 +313,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
boolean showNextSecurityScreenOrFinish(boolean authenticated) {
|
||||
if (DEBUG) Log.d(TAG, "showNextSecurityScreenOrFinish(" + authenticated + ")");
|
||||
boolean finish = false;
|
||||
boolean strongAuth = false;
|
||||
if (mUpdateMonitor.getUserCanSkipBouncer(
|
||||
KeyguardUpdateMonitor.getCurrentUser())) {
|
||||
finish = true;
|
||||
@@ -323,6 +329,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
case Pattern:
|
||||
case Password:
|
||||
case PIN:
|
||||
strongAuth = true;
|
||||
finish = true;
|
||||
break;
|
||||
|
||||
@@ -346,7 +353,7 @@ public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSe
|
||||
}
|
||||
}
|
||||
if (finish) {
|
||||
mSecurityCallback.finish();
|
||||
mSecurityCallback.finish(strongAuth);
|
||||
}
|
||||
return finish;
|
||||
}
|
||||
|
||||
@@ -22,8 +22,17 @@ public interface KeyguardSecurityView {
|
||||
static public final int VIEW_REVEALED = 2;
|
||||
|
||||
int PROMPT_REASON_NONE = 0;
|
||||
|
||||
/**
|
||||
* Strong auth is required because the device has just booted.
|
||||
*/
|
||||
int PROMPT_REASON_RESTART = 1;
|
||||
|
||||
/**
|
||||
* Strong auth is required because the user hasn't used strong auth since a while.
|
||||
*/
|
||||
int PROMPT_REASON_TIMEOUT = 2;
|
||||
|
||||
/**
|
||||
* Interface back to keyguard to tell it when security
|
||||
* @param callback
|
||||
|
||||
@@ -64,6 +64,7 @@ import android.telephony.SubscriptionInfo;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.util.SparseIntArray;
|
||||
@@ -103,6 +104,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
= "com.android.facelock.FACE_UNLOCK_STOPPED";
|
||||
private static final String FINGERPRINT_WAKE_LOCK_NAME = "wake-and-unlock wakelock";
|
||||
|
||||
private static final String ACTION_STRONG_AUTH_TIMEOUT =
|
||||
"com.android.systemui.ACTION_STRONG_AUTH_TIMEOUT";
|
||||
private static final String USER_ID = "com.android.systemui.USER_ID";
|
||||
|
||||
private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF";
|
||||
|
||||
/**
|
||||
* Mode in which we don't need to wake up the device when we get a fingerprint.
|
||||
*/
|
||||
@@ -126,6 +133,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
* */
|
||||
private static final int FP_ONLY_WAKE = 3;
|
||||
|
||||
/**
|
||||
* Milliseconds after unlocking with fingerprint times out, i.e. the user has to use a
|
||||
* strong auth method like password, PIN or pattern.
|
||||
*/
|
||||
private static final long FINGERPRINT_UNLOCK_TIMEOUT_MS = 72 * 60 * 60 * 1000;
|
||||
|
||||
// Callback messages
|
||||
private static final int MSG_TIME_UPDATE = 301;
|
||||
private static final int MSG_BATTERY_UPDATE = 302;
|
||||
@@ -173,7 +186,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
// Password attempts
|
||||
private SparseIntArray mFailedAttempts = new SparseIntArray();
|
||||
|
||||
private boolean mClockVisible;
|
||||
/** Tracks whether strong authentication hasn't been used since quite some time per user. */
|
||||
private ArraySet<Integer> mStrongAuthTimedOut = new ArraySet<>();
|
||||
|
||||
private final ArrayList<WeakReference<KeyguardUpdateMonitorCallback>>
|
||||
mCallbacks = Lists.newArrayList();
|
||||
@@ -184,6 +198,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
private boolean mDeviceInteractive;
|
||||
private boolean mScreenOn;
|
||||
private SubscriptionManager mSubscriptionManager;
|
||||
private AlarmManager mAlarmManager;
|
||||
private List<SubscriptionInfo> mSubscriptionInfo;
|
||||
private boolean mFingerprintDetectionRunning;
|
||||
private TrustManager mTrustManager;
|
||||
@@ -549,7 +564,39 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
}
|
||||
|
||||
public boolean isUnlockingWithFingerprintAllowed() {
|
||||
return mUserHasAuthenticatedSinceBoot;
|
||||
return mUserHasAuthenticatedSinceBoot && !hasFingerprintUnlockTimedOut(sCurrentUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if the user hasn't use strong authentication (pattern, PIN, password) since a
|
||||
* while and thus can't unlock with fingerprint, false otherwise
|
||||
*/
|
||||
public boolean hasFingerprintUnlockTimedOut(int userId) {
|
||||
return mStrongAuthTimedOut.contains(userId);
|
||||
}
|
||||
|
||||
public void reportSuccessfulStrongAuthUnlockAttempt() {
|
||||
mStrongAuthTimedOut.remove(sCurrentUser);
|
||||
scheduleStrongAuthTimeout();
|
||||
}
|
||||
|
||||
private void scheduleStrongAuthTimeout() {
|
||||
long when = SystemClock.elapsedRealtime() + FINGERPRINT_UNLOCK_TIMEOUT_MS;
|
||||
Intent intent = new Intent(ACTION_STRONG_AUTH_TIMEOUT);
|
||||
intent.putExtra(USER_ID, sCurrentUser);
|
||||
PendingIntent sender = PendingIntent.getBroadcast(mContext,
|
||||
sCurrentUser, intent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME, when, sender);
|
||||
notifyStrongAuthTimedOutChanged(sCurrentUser);
|
||||
}
|
||||
|
||||
private void notifyStrongAuthTimedOutChanged(int userId) {
|
||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||
if (cb != null) {
|
||||
cb.onStrongAuthTimeoutExpiredChanged(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DisplayClientState {
|
||||
@@ -639,6 +686,17 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
}
|
||||
};
|
||||
|
||||
private final BroadcastReceiver mStrongAuthTimeoutReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (ACTION_STRONG_AUTH_TIMEOUT.equals(intent.getAction())) {
|
||||
int userId = intent.getIntExtra(USER_ID, -1);
|
||||
mStrongAuthTimedOut.add(userId);
|
||||
notifyStrongAuthTimedOutChanged(userId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private FingerprintManager.AuthenticationCallback mAuthenticationCallback
|
||||
= new AuthenticationCallback() {
|
||||
|
||||
@@ -871,7 +929,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
mContext = context;
|
||||
mSubscriptionManager = SubscriptionManager.from(context);
|
||||
mPowerManager = context.getSystemService(PowerManager.class);
|
||||
mAlarmManager = context.getSystemService(AlarmManager.class);
|
||||
mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
|
||||
|
||||
// Since device can't be un-provisioned, we only need to register a content observer
|
||||
// to update mDeviceProvisioned when we are...
|
||||
if (!mDeviceProvisioned) {
|
||||
@@ -932,6 +992,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
IntentFilter strongAuthTimeoutFilter = new IntentFilter();
|
||||
strongAuthTimeoutFilter.addAction(ACTION_STRONG_AUTH_TIMEOUT);
|
||||
context.registerReceiver(mStrongAuthTimeoutReceiver, strongAuthTimeoutFilter,
|
||||
PERMISSION_SELF, null /* handler */);
|
||||
mTrustManager = (TrustManager) context.getSystemService(Context.TRUST_SERVICE);
|
||||
mTrustManager.registerTrustListener(this);
|
||||
|
||||
@@ -955,7 +1019,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
private void startListeningForFingerprint() {
|
||||
if (DEBUG) Log.v(TAG, "startListeningForFingerprint()");
|
||||
int userId = ActivityManager.getCurrentUser();
|
||||
if (isUnlockWithFingerPrintPossible(userId)) {
|
||||
if (isUnlockWithFingerprintPossible(userId)) {
|
||||
mUserHasAuthenticatedSinceBoot = mTrustManager.hasUserAuthenticatedSinceBoot(
|
||||
ActivityManager.getCurrentUser());
|
||||
if (mFingerprintCancelSignal != null) {
|
||||
@@ -967,7 +1031,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isUnlockWithFingerPrintPossible(int userId) {
|
||||
public boolean isUnlockWithFingerprintPossible(int userId) {
|
||||
return mFpm != null && mFpm.isHardwareDetected() && !isFingerprintDisabled(userId)
|
||||
&& mFpm.getEnrolledFingerprints(userId).size() > 0;
|
||||
}
|
||||
@@ -1433,7 +1497,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
return mFailedAttempts.get(sCurrentUser, 0);
|
||||
}
|
||||
|
||||
public void reportFailedUnlockAttempt() {
|
||||
public void reportFailedStrongAuthUnlockAttempt() {
|
||||
mFailedAttempts.put(sCurrentUser, getFailedUnlockAttempts() + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,4 +217,10 @@ public class KeyguardUpdateMonitorCallback {
|
||||
* Called when the fingerprint running state changed.
|
||||
*/
|
||||
public void onFingerprintRunningStateChanged(boolean running) { }
|
||||
|
||||
/**
|
||||
* Called when the state that the user hasn't used strong authentication since quite some time
|
||||
* has changed.
|
||||
*/
|
||||
public void onStrongAuthTimeoutExpiredChanged(int userId) { }
|
||||
}
|
||||
|
||||
@@ -28,12 +28,11 @@ public interface ViewMediatorCallback {
|
||||
|
||||
/**
|
||||
* Report that the keyguard is done.
|
||||
* @param authenticated Whether the user securely got past the keyguard.
|
||||
* the only reason for this to be false is if the keyguard was instructed
|
||||
* to appear temporarily to verify the user is supposed to get past the
|
||||
* keyguard, and the user fails to do so.
|
||||
*
|
||||
* @param strongAuth whether the user has authenticated with strong authentication like
|
||||
* pattern, password or PIN but not by trust agents or fingerprint
|
||||
*/
|
||||
void keyguardDone(boolean authenticated);
|
||||
void keyguardDone(boolean strongAuth);
|
||||
|
||||
/**
|
||||
* Report that the keyguard is done drawing.
|
||||
@@ -48,8 +47,11 @@ public interface ViewMediatorCallback {
|
||||
|
||||
/**
|
||||
* Report that the keyguard is dismissable, pending the next keyguardDone call.
|
||||
*
|
||||
* @param strongAuth whether the user has authenticated with strong authentication like
|
||||
* pattern, password or PIN but not by trust agents or fingerprint
|
||||
*/
|
||||
void keyguardDonePending();
|
||||
void keyguardDonePending(boolean strongAuth);
|
||||
|
||||
/**
|
||||
* Report when keyguard is actually gone
|
||||
@@ -85,8 +87,9 @@ public interface ViewMediatorCallback {
|
||||
/**
|
||||
* @return one of the reasons why the bouncer needs to be shown right now and the user can't use
|
||||
* his normal unlock method like fingerprint or trust agents. See
|
||||
* {@link KeyguardSecurityView#PROMPT_REASON_NONE}
|
||||
* and {@link KeyguardSecurityView#PROMPT_REASON_RESTART}.
|
||||
* {@link KeyguardSecurityView#PROMPT_REASON_NONE},
|
||||
* {@link KeyguardSecurityView#PROMPT_REASON_RESTART} and
|
||||
* {@link KeyguardSecurityView#PROMPT_REASON_TIMEOUT}.
|
||||
*/
|
||||
int getBouncerPromptReason();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ public class KeyguardService extends Service {
|
||||
@Override // Binder interface
|
||||
public void keyguardDone(boolean authenticated, boolean wakeup) {
|
||||
checkPermission();
|
||||
mKeyguardViewMediator.keyguardDone(authenticated, wakeup);
|
||||
// TODO: Remove wakeup
|
||||
mKeyguardViewMediator.keyguardDone(authenticated);
|
||||
}
|
||||
|
||||
@Override // Binder interface
|
||||
|
||||
@@ -465,13 +465,14 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
mUpdateMonitor.isUnlockingWithFingerprintAllowed();
|
||||
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
|
||||
if (unlockingWithFingerprintAllowed) {
|
||||
mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated();
|
||||
mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated(
|
||||
false /* strongAuth */);
|
||||
}
|
||||
} else {
|
||||
if (wakeAndUnlocking && mShowing && unlockingWithFingerprintAllowed) {
|
||||
mWakeAndUnlocking = true;
|
||||
mStatusBarKeyguardViewManager.setWakeAndUnlocking();
|
||||
keyguardDone(true, true);
|
||||
keyguardDone(true);
|
||||
} else if (mShowing && mDeviceInteractive) {
|
||||
if (wakeAndUnlocking) {
|
||||
mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested();
|
||||
@@ -490,9 +491,12 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
KeyguardViewMediator.this.userActivity();
|
||||
}
|
||||
|
||||
public void keyguardDone(boolean authenticated) {
|
||||
public void keyguardDone(boolean strongAuth) {
|
||||
if (!mKeyguardDonePending) {
|
||||
KeyguardViewMediator.this.keyguardDone(authenticated, true);
|
||||
KeyguardViewMediator.this.keyguardDone(true /* authenticated */);
|
||||
}
|
||||
if (strongAuth) {
|
||||
mUpdateMonitor.reportSuccessfulStrongAuthUnlockAttempt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -506,12 +510,15 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyguardDonePending() {
|
||||
public void keyguardDonePending(boolean strongAuth) {
|
||||
mKeyguardDonePending = true;
|
||||
mHideAnimationRun = true;
|
||||
mStatusBarKeyguardViewManager.startPreHideAnimation(null /* finishRunnable */);
|
||||
mHandler.sendEmptyMessageDelayed(KEYGUARD_DONE_PENDING_TIMEOUT,
|
||||
KEYGUARD_DONE_PENDING_TIMEOUT_MS);
|
||||
if (strongAuth) {
|
||||
mUpdateMonitor.reportSuccessfulStrongAuthUnlockAttempt();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -524,7 +531,7 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
if (mKeyguardDonePending) {
|
||||
// Somebody has called keyguardDonePending before, which means that we are
|
||||
// authenticated
|
||||
KeyguardViewMediator.this.keyguardDone(true /* authenticated */, true /* wakeUp */);
|
||||
KeyguardViewMediator.this.keyguardDone(true /* authenticated */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,9 +559,12 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
public int getBouncerPromptReason() {
|
||||
int currentUser = ActivityManager.getCurrentUser();
|
||||
if ((mUpdateMonitor.getUserTrustIsManaged(currentUser)
|
||||
|| mUpdateMonitor.isUnlockWithFingerPrintPossible(currentUser))
|
||||
|| mUpdateMonitor.isUnlockWithFingerprintPossible(currentUser))
|
||||
&& !mTrustManager.hasUserAuthenticatedSinceBoot(currentUser)) {
|
||||
return KeyguardSecurityView.PROMPT_REASON_RESTART;
|
||||
} else if (mUpdateMonitor.isUnlockWithFingerprintPossible(currentUser)
|
||||
&& mUpdateMonitor.hasFingerprintUnlockTimedOut(currentUser)) {
|
||||
return KeyguardSecurityView.PROMPT_REASON_TIMEOUT;
|
||||
}
|
||||
return KeyguardSecurityView.PROMPT_REASON_NONE;
|
||||
}
|
||||
@@ -1189,10 +1199,10 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
}
|
||||
};
|
||||
|
||||
public void keyguardDone(boolean authenticated, boolean wakeup) {
|
||||
if (DEBUG) Log.d(TAG, "keyguardDone(" + authenticated + ")");
|
||||
public void keyguardDone(boolean authenticated) {
|
||||
if (DEBUG) Log.d(TAG, "keyguardDone(" + authenticated +")");
|
||||
EventLog.writeEvent(70000, 2);
|
||||
Message msg = mHandler.obtainMessage(KEYGUARD_DONE, authenticated ? 1 : 0, wakeup ? 1 : 0);
|
||||
Message msg = mHandler.obtainMessage(KEYGUARD_DONE, authenticated ? 1 : 0);
|
||||
mHandler.sendMessage(msg);
|
||||
}
|
||||
|
||||
@@ -1235,14 +1245,11 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
handleNotifyStartedWakingUp();
|
||||
break;
|
||||
case KEYGUARD_DONE:
|
||||
handleKeyguardDone(msg.arg1 != 0, msg.arg2 != 0);
|
||||
handleKeyguardDone(msg.arg1 != 0);
|
||||
break;
|
||||
case KEYGUARD_DONE_DRAWING:
|
||||
handleKeyguardDoneDrawing();
|
||||
break;
|
||||
case KEYGUARD_DONE_AUTHENTICATING:
|
||||
keyguardDone(true, true);
|
||||
break;
|
||||
case SET_OCCLUDED:
|
||||
handleSetOccluded(msg.arg1 != 0);
|
||||
break;
|
||||
@@ -1272,7 +1279,7 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
* @see #keyguardDone
|
||||
* @see #KEYGUARD_DONE
|
||||
*/
|
||||
private void handleKeyguardDone(boolean authenticated, boolean wakeup) {
|
||||
private void handleKeyguardDone(boolean authenticated) {
|
||||
if (DEBUG) Log.d(TAG, "handleKeyguardDone");
|
||||
synchronized (this) {
|
||||
resetKeyguardDonePendingLocked();
|
||||
@@ -1585,6 +1592,7 @@ public class KeyguardViewMediator extends SystemUI {
|
||||
synchronized (this) {
|
||||
if (DEBUG) Log.d(TAG, "handleNotifyScreenTurnedOff");
|
||||
mStatusBarKeyguardViewManager.onScreenTurnedOff();
|
||||
mWakeAndUnlocking = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import com.android.systemui.Prefs;
|
||||
import com.android.systemui.R;
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.ITaskStackListener;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
|
||||
@@ -33,7 +33,6 @@ import android.view.View;
|
||||
import android.view.ViewStub;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.internal.logging.MetricsConstants;
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.systemui.Prefs;
|
||||
import com.android.systemui.R;
|
||||
|
||||
@@ -20,10 +20,8 @@ import android.app.ActivityManager;
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.AppGlobals;
|
||||
import android.app.IActivityContainer;
|
||||
import android.app.IActivityManager;
|
||||
import android.app.ITaskStackListener;
|
||||
import android.app.SearchManager;
|
||||
import android.appwidget.AppWidgetHost;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.appwidget.AppWidgetProviderInfo;
|
||||
@@ -54,15 +52,12 @@ import android.os.ParcelFileDescriptor;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.util.MutableBoolean;
|
||||
import android.util.Pair;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Display;
|
||||
import android.view.DisplayInfo;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.WindowManager;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
@@ -71,7 +66,6 @@ import com.android.systemui.Prefs;
|
||||
import com.android.systemui.R;
|
||||
import com.android.systemui.recents.Constants;
|
||||
import com.android.systemui.recents.Recents;
|
||||
import com.android.systemui.recents.RecentsAppWidgetHost;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -647,6 +647,11 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
||||
public void onFingerprintRunningStateChanged(boolean running) {
|
||||
mLockIcon.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStrongAuthTimeoutExpiredChanged(int userId) {
|
||||
mLockIcon.update();
|
||||
}
|
||||
};
|
||||
|
||||
public void setKeyguardIndicationController(
|
||||
|
||||
@@ -26,6 +26,8 @@ import android.view.accessibility.AccessibilityEvent;
|
||||
import com.android.internal.widget.LockPatternUtils;
|
||||
import com.android.keyguard.KeyguardHostView;
|
||||
import com.android.keyguard.KeyguardSecurityView;
|
||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||
import com.android.keyguard.KeyguardUpdateMonitorCallback;
|
||||
import com.android.keyguard.R;
|
||||
import com.android.keyguard.ViewMediatorCallback;
|
||||
import com.android.systemui.DejankUtils;
|
||||
@@ -47,6 +49,13 @@ public class KeyguardBouncer {
|
||||
private ViewGroup mRoot;
|
||||
private boolean mShowingSoon;
|
||||
private int mBouncerPromptReason;
|
||||
private KeyguardUpdateMonitorCallback mUpdateMonitorCallback =
|
||||
new KeyguardUpdateMonitorCallback() {
|
||||
@Override
|
||||
public void onStrongAuthTimeoutExpiredChanged(int userId) {
|
||||
mBouncerPromptReason = mCallback.getBouncerPromptReason();
|
||||
}
|
||||
};
|
||||
|
||||
public KeyguardBouncer(Context context, ViewMediatorCallback callback,
|
||||
LockPatternUtils lockPatternUtils, StatusBarWindowManager windowManager,
|
||||
@@ -56,6 +65,7 @@ public class KeyguardBouncer {
|
||||
mLockPatternUtils = lockPatternUtils;
|
||||
mContainer = container;
|
||||
mWindowManager = windowManager;
|
||||
KeyguardUpdateMonitor.getInstance(mContext).registerCallback(mUpdateMonitorCallback);
|
||||
}
|
||||
|
||||
public void show(boolean resetSecuritySelection) {
|
||||
@@ -247,8 +257,8 @@ public class KeyguardBouncer {
|
||||
return mKeyguardView.interceptMediaKey(event);
|
||||
}
|
||||
|
||||
public void notifyKeyguardAuthenticated() {
|
||||
public void notifyKeyguardAuthenticated(boolean strongAuth) {
|
||||
ensureView();
|
||||
mKeyguardView.finish();
|
||||
mKeyguardView.finish(strongAuth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -480,8 +480,8 @@ public class StatusBarKeyguardViewManager {
|
||||
* Notifies that the user has authenticated by other means than using the bouncer, for example,
|
||||
* fingerprint.
|
||||
*/
|
||||
public void notifyKeyguardAuthenticated() {
|
||||
mBouncer.notifyKeyguardAuthenticated();
|
||||
public void notifyKeyguardAuthenticated(boolean strongAuth) {
|
||||
mBouncer.notifyKeyguardAuthenticated(strongAuth);
|
||||
}
|
||||
|
||||
public void setWakeAndUnlocking() {
|
||||
|
||||
@@ -143,6 +143,11 @@ public class UnlockMethodCache {
|
||||
public void onFaceUnlockStateChanged(boolean running, int userId) {
|
||||
update(false /* updateAlways */);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStrongAuthTimeoutExpiredChanged(int userId) {
|
||||
update(false /* updateAlways */);
|
||||
}
|
||||
};
|
||||
|
||||
public boolean isTrustManaged() {
|
||||
|
||||
Reference in New Issue
Block a user