Merge "Dismiss the keyguard through #notifyKeyguardAuthentiated" into udc-dev
This commit is contained in:
@@ -257,14 +257,14 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
||||
* 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
|
||||
* @param fromPrimaryAuth whether the user has authenticated with primary auth like
|
||||
* pattern, password or PIN but not by trust agents or fingerprint
|
||||
* @param targetUserId a user that needs to be the foreground user at the dismissal
|
||||
* completion.
|
||||
*/
|
||||
@Override
|
||||
public void finish(boolean strongAuth, int targetUserId) {
|
||||
if (!mKeyguardStateController.canDismissLockScreen() && !strongAuth) {
|
||||
public void finish(boolean fromPrimaryAuth, int targetUserId) {
|
||||
if (!mKeyguardStateController.canDismissLockScreen() && !fromPrimaryAuth) {
|
||||
Log.e(TAG,
|
||||
"Tried to dismiss keyguard when lockscreen is not dismissible and user "
|
||||
+ "was not authenticated with a primary security method "
|
||||
@@ -283,9 +283,9 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
||||
}
|
||||
if (mViewMediatorCallback != null) {
|
||||
if (deferKeyguardDone) {
|
||||
mViewMediatorCallback.keyguardDonePending(strongAuth, targetUserId);
|
||||
mViewMediatorCallback.keyguardDonePending(fromPrimaryAuth, targetUserId);
|
||||
} else {
|
||||
mViewMediatorCallback.keyguardDone(strongAuth, targetUserId);
|
||||
mViewMediatorCallback.keyguardDone(fromPrimaryAuth, targetUserId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -603,8 +603,8 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
||||
/**
|
||||
* Dismiss keyguard due to a user unlock event.
|
||||
*/
|
||||
public void finish(boolean strongAuth, int currentUser) {
|
||||
mKeyguardSecurityCallback.finish(strongAuth, currentUser);
|
||||
public void finish(boolean primaryAuth, int currentUser) {
|
||||
mKeyguardSecurityCallback.finish(primaryAuth, currentUser);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -736,7 +736,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
||||
}
|
||||
|
||||
boolean finish = false;
|
||||
boolean strongAuth = false;
|
||||
boolean primaryAuth = false;
|
||||
int eventSubtype = -1;
|
||||
BouncerUiEvent uiEvent = BouncerUiEvent.UNKNOWN;
|
||||
if (mUpdateMonitor.getUserHasTrust(targetUserId)) {
|
||||
@@ -761,7 +761,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
||||
case Pattern:
|
||||
case Password:
|
||||
case PIN:
|
||||
strongAuth = true;
|
||||
primaryAuth = true;
|
||||
finish = true;
|
||||
eventSubtype = BOUNCER_DISMISS_PASSWORD;
|
||||
uiEvent = BouncerUiEvent.BOUNCER_DISMISS_PASSWORD;
|
||||
@@ -805,7 +805,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
|
||||
mUiEventLogger.log(uiEvent, getSessionId());
|
||||
}
|
||||
if (finish) {
|
||||
mKeyguardSecurityCallback.finish(strongAuth, targetUserId);
|
||||
mKeyguardSecurityCallback.finish(primaryAuth, targetUserId);
|
||||
}
|
||||
return finish;
|
||||
}
|
||||
|
||||
@@ -893,7 +893,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected void onFingerprintAuthenticated(int userId, boolean isStrongBiometric) {
|
||||
public void onFingerprintAuthenticated(int userId, boolean isStrongBiometric) {
|
||||
Assert.isMainThread();
|
||||
Trace.beginSection("KeyGuardUpdateMonitor#onFingerPrintAuthenticated");
|
||||
mUserFingerprintAuthenticated.put(userId,
|
||||
@@ -1169,7 +1169,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected void onFaceAuthenticated(int userId, boolean isStrongBiometric) {
|
||||
public void onFaceAuthenticated(int userId, boolean isStrongBiometric) {
|
||||
Trace.beginSection("KeyGuardUpdateMonitor#onFaceAuthenticated");
|
||||
Assert.isMainThread();
|
||||
mUserFaceAuthenticated.put(userId,
|
||||
|
||||
@@ -29,11 +29,11 @@ public interface ViewMediatorCallback {
|
||||
/**
|
||||
* Report that the keyguard is done.
|
||||
*
|
||||
* @param strongAuth whether the user has authenticated with strong authentication like
|
||||
* @param primaryAuth whether the user has authenticated with primary authentication like
|
||||
* pattern, password or PIN but not by trust agents or fingerprint
|
||||
* @param targetUserId a user that needs to be the foreground user at the completion.
|
||||
*/
|
||||
void keyguardDone(boolean strongAuth, int targetUserId);
|
||||
void keyguardDone(boolean primaryAuth, int targetUserId);
|
||||
|
||||
/**
|
||||
* Report that the keyguard is done drawing.
|
||||
@@ -49,11 +49,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
|
||||
* @param primaryAuth whether the user has authenticated with primary authentication like
|
||||
* pattern, password or PIN but not by trust agents or fingerprint
|
||||
* @param targetUserId a user that needs to be the foreground user at the completion.
|
||||
*/
|
||||
void keyguardDonePending(boolean strongAuth, int targetUserId);
|
||||
void keyguardDonePending(boolean primaryAuth, int targetUserId);
|
||||
|
||||
/**
|
||||
* Report when keyguard is actually gone
|
||||
|
||||
@@ -20,7 +20,6 @@ import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.hardware.biometrics.BiometricConstants;
|
||||
import android.hardware.biometrics.BiometricSourceType;
|
||||
import android.os.Build;
|
||||
import android.provider.DeviceConfig;
|
||||
@@ -57,6 +56,7 @@ public class LatencyTester implements CoreStartable {
|
||||
private final BiometricUnlockController mBiometricUnlockController;
|
||||
private final BroadcastDispatcher mBroadcastDispatcher;
|
||||
private final DeviceConfigProxy mDeviceConfigProxy;
|
||||
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||
|
||||
private boolean mEnabled;
|
||||
|
||||
@@ -65,11 +65,13 @@ public class LatencyTester implements CoreStartable {
|
||||
BiometricUnlockController biometricUnlockController,
|
||||
BroadcastDispatcher broadcastDispatcher,
|
||||
DeviceConfigProxy deviceConfigProxy,
|
||||
@Main DelayableExecutor mainExecutor
|
||||
@Main DelayableExecutor mainExecutor,
|
||||
KeyguardUpdateMonitor keyguardUpdateMonitor
|
||||
) {
|
||||
mBiometricUnlockController = biometricUnlockController;
|
||||
mBroadcastDispatcher = broadcastDispatcher;
|
||||
mDeviceConfigProxy = deviceConfigProxy;
|
||||
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
|
||||
|
||||
updateEnabled();
|
||||
mDeviceConfigProxy.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_LATENCY_TRACKER,
|
||||
@@ -85,10 +87,13 @@ public class LatencyTester implements CoreStartable {
|
||||
if (!mEnabled) {
|
||||
return;
|
||||
}
|
||||
mBiometricUnlockController.onBiometricAcquired(type,
|
||||
BiometricConstants.BIOMETRIC_ACQUIRED_GOOD);
|
||||
mBiometricUnlockController.onBiometricAuthenticated(
|
||||
KeyguardUpdateMonitor.getCurrentUser(), type, true /* isStrongBiometric */);
|
||||
if (type == BiometricSourceType.FACE) {
|
||||
mKeyguardUpdateMonitor.onFaceAuthenticated(KeyguardUpdateMonitor.getCurrentUser(),
|
||||
true);
|
||||
} else if (type == BiometricSourceType.FINGERPRINT) {
|
||||
mKeyguardUpdateMonitor.onFingerprintAuthenticated(
|
||||
KeyguardUpdateMonitor.getCurrentUser(), true);
|
||||
}
|
||||
}
|
||||
|
||||
private void registerForBroadcasts(boolean register) {
|
||||
|
||||
@@ -466,7 +466,7 @@ public class UdfpsController implements DozeReceiver, Dumpable {
|
||||
if (!mOnFingerDown) {
|
||||
playStartHaptic();
|
||||
}
|
||||
mKeyguardViewManager.notifyKeyguardAuthenticated(false /* strongAuth */);
|
||||
mKeyguardViewManager.notifyKeyguardAuthenticated(false /* primaryAuth */);
|
||||
mAttemptedToDismissKeyguard = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,6 @@ import android.provider.DeviceConfig;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.EventLog;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseBooleanArray;
|
||||
@@ -744,7 +743,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyguardDone(boolean strongAuth, int targetUserId) {
|
||||
public void keyguardDone(boolean primaryAuth, int targetUserId) {
|
||||
if (targetUserId != KeyguardUpdateMonitor.getCurrentUser()) {
|
||||
return;
|
||||
}
|
||||
@@ -765,7 +764,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyguardDonePending(boolean strongAuth, int targetUserId) {
|
||||
public void keyguardDonePending(boolean primaryAuth, int targetUserId) {
|
||||
Trace.beginSection("KeyguardViewMediator.mViewMediatorCallback#keyguardDonePending");
|
||||
if (DEBUG) Log.d(TAG, "keyguardDonePending");
|
||||
if (targetUserId != KeyguardUpdateMonitor.getCurrentUser()) {
|
||||
@@ -2219,16 +2218,6 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
|
||||
}
|
||||
};
|
||||
|
||||
private void keyguardDone() {
|
||||
Trace.beginSection("KeyguardViewMediator#keyguardDone");
|
||||
if (DEBUG) Log.d(TAG, "keyguardDone()");
|
||||
userActivity();
|
||||
EventLog.writeEvent(70000, 2);
|
||||
Message msg = mHandler.obtainMessage(KEYGUARD_DONE);
|
||||
mHandler.sendMessage(msg);
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
/**
|
||||
* This handler will be associated with the policy thread, which will also
|
||||
* be the UI thread of the keyguard. Since the apis of the policy, and therefore
|
||||
@@ -3124,7 +3113,8 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
|
||||
Trace.beginSection("KeyguardViewMediator#onWakeAndUnlocking");
|
||||
mWakeAndUnlocking = true;
|
||||
|
||||
keyguardDone();
|
||||
mKeyguardViewControllerLazy.get().notifyKeyguardAuthenticated(/* primaryAuth */ false);
|
||||
userActivity();
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
|
||||
@@ -469,13 +469,13 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
case MODE_DISMISS_BOUNCER:
|
||||
Trace.beginSection("MODE_DISMISS_BOUNCER");
|
||||
mKeyguardViewController.notifyKeyguardAuthenticated(
|
||||
false /* strongAuth */);
|
||||
false /* primaryAuth */);
|
||||
Trace.endSection();
|
||||
break;
|
||||
case MODE_UNLOCK_COLLAPSING:
|
||||
Trace.beginSection("MODE_UNLOCK_COLLAPSING");
|
||||
mKeyguardViewController.notifyKeyguardAuthenticated(
|
||||
false /* strongAuth */);
|
||||
false /* primaryAuth */);
|
||||
Trace.endSection();
|
||||
break;
|
||||
case MODE_SHOW_BOUNCER:
|
||||
|
||||
@@ -518,6 +518,12 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
|
||||
assertTrue(mViewMediator.isShowingAndNotOccluded());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWakeAndUnlocking() {
|
||||
mViewMediator.onWakeAndUnlocking();
|
||||
verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(anyBoolean());
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestableLooper.RunWithLooper(setAsMainLooper = true)
|
||||
public void testDoKeyguardWhileInteractive_resets() {
|
||||
|
||||
Reference in New Issue
Block a user