Merge "Disable bypass and bouncer delay when no face auth" into qt-r1-dev
am: f41cc30658
Change-Id: I367b3ef7d3a596e15972af1f047fd291f92e56b0
This commit is contained in:
@@ -22,5 +22,5 @@ import android.hardware.biometrics.BiometricSourceType;
|
|||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
oneway interface IBiometricEnabledOnKeyguardCallback {
|
oneway interface IBiometricEnabledOnKeyguardCallback {
|
||||||
void onChanged(in BiometricSourceType type, boolean enabled);
|
void onChanged(in BiometricSourceType type, boolean enabled, int userId);
|
||||||
}
|
}
|
||||||
@@ -377,14 +377,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private boolean mFaceSettingEnabledForUser;
|
private SparseBooleanArray mFaceSettingEnabledForUser = new SparseBooleanArray();
|
||||||
private BiometricManager mBiometricManager;
|
private BiometricManager mBiometricManager;
|
||||||
private IBiometricEnabledOnKeyguardCallback mBiometricEnabledCallback =
|
private IBiometricEnabledOnKeyguardCallback mBiometricEnabledCallback =
|
||||||
new IBiometricEnabledOnKeyguardCallback.Stub() {
|
new IBiometricEnabledOnKeyguardCallback.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void onChanged(BiometricSourceType type, boolean enabled) throws RemoteException {
|
public void onChanged(BiometricSourceType type, boolean enabled, int userId)
|
||||||
|
throws RemoteException {
|
||||||
if (type == BiometricSourceType.FACE) {
|
if (type == BiometricSourceType.FACE) {
|
||||||
mFaceSettingEnabledForUser = enabled;
|
mFaceSettingEnabledForUser.put(userId, enabled);
|
||||||
updateFaceListeningState();
|
updateFaceListeningState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1711,7 +1712,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
|
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
|
||||||
return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant())
|
return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant())
|
||||||
&& !mSwitchingUser && !isFaceDisabled(user) && becauseCannotSkipBouncer
|
&& !mSwitchingUser && !isFaceDisabled(user) && becauseCannotSkipBouncer
|
||||||
&& !mKeyguardGoingAway && mFaceSettingEnabledForUser && !mLockIconPressed
|
&& !mKeyguardGoingAway && mFaceSettingEnabledForUser.get(user) && !mLockIconPressed
|
||||||
&& strongAuthAllowsScanning && mIsPrimaryUser
|
&& strongAuthAllowsScanning && mIsPrimaryUser
|
||||||
&& !mSecureCameraLaunched;
|
&& !mSecureCameraLaunched;
|
||||||
}
|
}
|
||||||
@@ -1783,13 +1784,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If face hardware is available and user has enrolled. Not considering encryption or
|
* If face hardware is available, user has enrolled and enabled auth via setting.
|
||||||
* lockdown state.
|
* Not considering encryption or lock down state.
|
||||||
*/
|
*/
|
||||||
public boolean isUnlockWithFacePossible(int userId) {
|
public boolean isUnlockWithFacePossible(int userId) {
|
||||||
return mFaceManager != null && mFaceManager.isHardwareDetected()
|
return mFaceManager != null && mFaceManager.isHardwareDetected()
|
||||||
&& !isFaceDisabled(userId)
|
&& !isFaceDisabled(userId)
|
||||||
&& mFaceManager.hasEnrolledTemplates(userId);
|
&& mFaceManager.hasEnrolledTemplates(userId)
|
||||||
|
&& mFaceSettingEnabledForUser.get(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopListeningForFingerprint() {
|
private void stopListeningForFingerprint() {
|
||||||
@@ -2657,7 +2659,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
pw.println(" possible=" + isUnlockWithFacePossible(userId));
|
pw.println(" possible=" + isUnlockWithFacePossible(userId));
|
||||||
pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
|
pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
|
||||||
pw.println(" trustManaged=" + getUserTrustIsManaged(userId));
|
pw.println(" trustManaged=" + getUserTrustIsManaged(userId));
|
||||||
pw.println(" enabledByUser=" + mFaceSettingEnabledForUser);
|
pw.println(" enabledByUser=" + mFaceSettingEnabledForUser.get(userId));
|
||||||
pw.println(" mSecureCameraLaunched=" + mSecureCameraLaunched);
|
pw.println(" mSecureCameraLaunched=" + mSecureCameraLaunched);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,9 @@ public class UnlockMethodCache {
|
|||||||
mListeners.remove(listener);
|
mListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If there are faces enrolled and user enabled face auth on keyguard.
|
||||||
|
*/
|
||||||
public boolean isUnlockingWithFacePossible() {
|
public boolean isUnlockingWithFacePossible() {
|
||||||
return mIsUnlockingWithFacePossible;
|
return mIsUnlockingWithFacePossible;
|
||||||
}
|
}
|
||||||
@@ -119,15 +122,16 @@ public class UnlockMethodCache {
|
|||||||
|| (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked);
|
|| (Build.IS_DEBUGGABLE && DEBUG_AUTH_WITH_ADB && mDebugUnlocked);
|
||||||
boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
|
boolean trustManaged = mKeyguardUpdateMonitor.getUserTrustIsManaged(user);
|
||||||
boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user);
|
boolean trusted = mKeyguardUpdateMonitor.getUserHasTrust(user);
|
||||||
boolean hasEnrolledFaces = mKeyguardUpdateMonitor.isUnlockWithFacePossible(user);
|
boolean isUnlockingWithFacePossible = mKeyguardUpdateMonitor.isUnlockWithFacePossible(user);
|
||||||
boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer ||
|
boolean changed = secure != mSecure || canSkipBouncer != mCanSkipBouncer
|
||||||
trustManaged != mTrustManaged || mIsUnlockingWithFacePossible != hasEnrolledFaces;
|
|| trustManaged != mTrustManaged
|
||||||
|
|| mIsUnlockingWithFacePossible != isUnlockingWithFacePossible;
|
||||||
if (changed || updateAlways) {
|
if (changed || updateAlways) {
|
||||||
mSecure = secure;
|
mSecure = secure;
|
||||||
mCanSkipBouncer = canSkipBouncer;
|
mCanSkipBouncer = canSkipBouncer;
|
||||||
mTrusted = trusted;
|
mTrusted = trusted;
|
||||||
mTrustManaged = trustManaged;
|
mTrustManaged = trustManaged;
|
||||||
mIsUnlockingWithFacePossible = hasEnrolledFaces;
|
mIsUnlockingWithFacePossible = isUnlockingWithFacePossible;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
Trace.endSection();
|
Trace.endSection();
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
|
|||||||
when(context.getPackageManager()).thenReturn(mPackageManager);
|
when(context.getPackageManager()).thenReturn(mPackageManager);
|
||||||
doAnswer(invocation -> {
|
doAnswer(invocation -> {
|
||||||
IBiometricEnabledOnKeyguardCallback callback = invocation.getArgument(0);
|
IBiometricEnabledOnKeyguardCallback callback = invocation.getArgument(0);
|
||||||
callback.onChanged(BiometricSourceType.FACE, true /* enabled */);
|
callback.onChanged(BiometricSourceType.FACE, true /* enabled */,
|
||||||
|
KeyguardUpdateMonitor.getCurrentUser());
|
||||||
return null;
|
return null;
|
||||||
}).when(mBiometricManager).registerEnabledOnKeyguardCallback(any());
|
}).when(mBiometricManager).registerEnabledOnKeyguardCallback(any());
|
||||||
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
when(mFaceManager.isHardwareDetected()).thenReturn(true);
|
||||||
|
|||||||
@@ -521,8 +521,8 @@ public class BiometricService extends SystemService {
|
|||||||
List<EnabledOnKeyguardCallback> callbacks = mEnabledOnKeyguardCallbacks;
|
List<EnabledOnKeyguardCallback> callbacks = mEnabledOnKeyguardCallbacks;
|
||||||
for (int i = 0; i < callbacks.size(); i++) {
|
for (int i = 0; i < callbacks.size(); i++) {
|
||||||
callbacks.get(i).notify(BiometricSourceType.FACE,
|
callbacks.get(i).notify(BiometricSourceType.FACE,
|
||||||
mFaceEnabledOnKeyguard.getOrDefault(userId,
|
mFaceEnabledOnKeyguard.getOrDefault(userId, DEFAULT_KEYGUARD_ENABLED),
|
||||||
DEFAULT_KEYGUARD_ENABLED));
|
userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -540,9 +540,9 @@ public class BiometricService extends SystemService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void notify(BiometricSourceType sourceType, boolean enabled) {
|
void notify(BiometricSourceType sourceType, boolean enabled, int userId) {
|
||||||
try {
|
try {
|
||||||
mCallback.onChanged(sourceType, enabled);
|
mCallback.onChanged(sourceType, enabled, userId);
|
||||||
} catch (DeadObjectException e) {
|
} catch (DeadObjectException e) {
|
||||||
Slog.w(TAG, "Death while invoking notify", e);
|
Slog.w(TAG, "Death while invoking notify", e);
|
||||||
mEnabledOnKeyguardCallbacks.remove(this);
|
mEnabledOnKeyguardCallbacks.remove(this);
|
||||||
@@ -796,7 +796,8 @@ public class BiometricService extends SystemService {
|
|||||||
mEnabledOnKeyguardCallbacks.add(new EnabledOnKeyguardCallback(callback));
|
mEnabledOnKeyguardCallbacks.add(new EnabledOnKeyguardCallback(callback));
|
||||||
try {
|
try {
|
||||||
callback.onChanged(BiometricSourceType.FACE,
|
callback.onChanged(BiometricSourceType.FACE,
|
||||||
mSettingObserver.getFaceEnabledOnKeyguard());
|
mSettingObserver.getFaceEnabledOnKeyguard(),
|
||||||
|
UserHandle.getCallingUserId());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG, "Remote exception", e);
|
Slog.w(TAG, "Remote exception", e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user