Merge "Add biometric strength reset and fix CTS tests on multi sensor devices (mostly)" into sc-dev
This commit is contained in:
@@ -23,7 +23,6 @@ import android.annotation.Nullable;
|
|||||||
import android.annotation.RequiresPermission;
|
import android.annotation.RequiresPermission;
|
||||||
import android.annotation.TestApi;
|
import android.annotation.TestApi;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.ArraySet;
|
import android.util.ArraySet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -248,6 +247,12 @@ public class BiometricTestSession implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mUsersCleaningUp.isEmpty()) {
|
||||||
|
// TODO(b/186600837): this seems common on multi sensor devices
|
||||||
|
Log.e(getTag(), "Cleanup not finished before shutdown - pending: "
|
||||||
|
+ mUsersCleaningUp.size());
|
||||||
|
}
|
||||||
|
|
||||||
// Disable the test HAL after the sensor becomes idle.
|
// Disable the test HAL after the sensor becomes idle.
|
||||||
setTestHalEnabled(false);
|
setTestHalEnabled(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -481,14 +481,24 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onBiometricAuthenticated() {
|
public void onBiometricAuthenticated() {
|
||||||
|
if (DEBUG) Log.d(TAG, "onBiometricAuthenticated: ");
|
||||||
|
|
||||||
|
if (mCurrentDialog != null) {
|
||||||
mCurrentDialog.onAuthenticationSucceeded();
|
mCurrentDialog.onAuthenticationSucceeded();
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "onBiometricAuthenticated callback but dialog gone");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBiometricHelp(String message) {
|
public void onBiometricHelp(String message) {
|
||||||
if (DEBUG) Log.d(TAG, "onBiometricHelp: " + message);
|
if (DEBUG) Log.d(TAG, "onBiometricHelp: " + message);
|
||||||
|
|
||||||
|
if (mCurrentDialog != null) {
|
||||||
mCurrentDialog.onHelp(message);
|
mCurrentDialog.onHelp(message);
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "onBiometricHelp callback but dialog gone");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -527,6 +537,7 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
|||||||
final boolean isSoftError = (error == BiometricConstants.BIOMETRIC_PAUSED_REJECTED
|
final boolean isSoftError = (error == BiometricConstants.BIOMETRIC_PAUSED_REJECTED
|
||||||
|| error == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT);
|
|| error == BiometricConstants.BIOMETRIC_ERROR_TIMEOUT);
|
||||||
|
|
||||||
|
if (mCurrentDialog != null) {
|
||||||
if (mCurrentDialog.isAllowDeviceCredentials() && isLockout) {
|
if (mCurrentDialog.isAllowDeviceCredentials() && isLockout) {
|
||||||
if (DEBUG) Log.d(TAG, "onBiometricError, lockout");
|
if (DEBUG) Log.d(TAG, "onBiometricError, lockout");
|
||||||
mCurrentDialog.animateToCredentialUI();
|
mCurrentDialog.animateToCredentialUI();
|
||||||
@@ -541,6 +552,9 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
|
|||||||
if (DEBUG) Log.d(TAG, "onBiometricError, hard error: " + errorMessage);
|
if (DEBUG) Log.d(TAG, "onBiometricError, hard error: " + errorMessage);
|
||||||
mCurrentDialog.onError(errorMessage);
|
mCurrentDialog.onError(errorMessage);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Log.w(TAG, "onBiometricError callback but dialog is gone");
|
||||||
|
}
|
||||||
|
|
||||||
onCancelUdfps();
|
onCancelUdfps();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,17 +48,10 @@ public class BiometricStrengthController {
|
|||||||
*/
|
*/
|
||||||
private static final String KEY_BIOMETRIC_STRENGTHS = "biometric_strengths";
|
private static final String KEY_BIOMETRIC_STRENGTHS = "biometric_strengths";
|
||||||
|
|
||||||
/**
|
|
||||||
* Default (no-op) value of the flag KEY_BIOMETRIC_STRENGTHS
|
|
||||||
*/
|
|
||||||
public static final String DEFAULT_BIOMETRIC_STRENGTHS = null;
|
|
||||||
|
|
||||||
private DeviceConfig.OnPropertiesChangedListener mDeviceConfigListener = properties -> {
|
private DeviceConfig.OnPropertiesChangedListener mDeviceConfigListener = properties -> {
|
||||||
for (String name : properties.getKeyset()) {
|
if (properties.getKeyset().contains(KEY_BIOMETRIC_STRENGTHS)) {
|
||||||
if (KEY_BIOMETRIC_STRENGTHS.equals(name)) {
|
|
||||||
updateStrengths();
|
updateStrengths();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public BiometricStrengthController(@NonNull BiometricService service) {
|
public BiometricStrengthController(@NonNull BiometricService service) {
|
||||||
@@ -75,7 +68,17 @@ public class BiometricStrengthController {
|
|||||||
* has been changed.
|
* has been changed.
|
||||||
*/
|
*/
|
||||||
public void updateStrengths() {
|
public void updateStrengths() {
|
||||||
final Map<Integer, Integer> idToStrength = getIdToStrengthMap();
|
final String newValue = DeviceConfig.getString(DeviceConfig.NAMESPACE_BIOMETRICS,
|
||||||
|
KEY_BIOMETRIC_STRENGTHS, "null");
|
||||||
|
if ("null".equals(newValue) || newValue.isEmpty()) {
|
||||||
|
revertStrengths();
|
||||||
|
} else {
|
||||||
|
updateStrengths(newValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateStrengths(String flags) {
|
||||||
|
final Map<Integer, Integer> idToStrength = getIdToStrengthMap(flags);
|
||||||
if (idToStrength == null) {
|
if (idToStrength == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -91,12 +94,18 @@ public class BiometricStrengthController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void revertStrengths() {
|
||||||
|
for (BiometricSensor sensor : mService.mSensors) {
|
||||||
|
Slog.d(TAG, "updateStrengths: revert sensorId=" + sensor.id + " to oemStrength="
|
||||||
|
+ sensor.oemStrength);
|
||||||
|
sensor.updateStrength(sensor.oemStrength);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a map of <ID, Strength>
|
* @return a map of <ID, Strength>
|
||||||
*/
|
*/
|
||||||
private Map<Integer, Integer> getIdToStrengthMap() {
|
private static Map<Integer, Integer> getIdToStrengthMap(String flags) {
|
||||||
final String flags = DeviceConfig.getString(DeviceConfig.NAMESPACE_BIOMETRICS,
|
|
||||||
KEY_BIOMETRIC_STRENGTHS, DEFAULT_BIOMETRIC_STRENGTHS);
|
|
||||||
if (flags == null || flags.isEmpty()) {
|
if (flags == null || flags.isEmpty()) {
|
||||||
Slog.d(TAG, "Flags are null or empty");
|
Slog.d(TAG, "Flags are null or empty");
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -82,7 +82,20 @@ public abstract class BaseClientMonitor extends LoggableMonitor
|
|||||||
private final int mCookie;
|
private final int mCookie;
|
||||||
boolean mAlreadyDone;
|
boolean mAlreadyDone;
|
||||||
|
|
||||||
@NonNull protected Callback mCallback;
|
// Use an empty callback by default since delayed operations can receive events
|
||||||
|
// before they are started and cause NPE in subclasses that access this field directly.
|
||||||
|
@NonNull protected Callback mCallback = new Callback() {
|
||||||
|
@Override
|
||||||
|
public void onClientStarted(@NonNull BaseClientMonitor clientMonitor) {
|
||||||
|
Slog.e(TAG, "mCallback onClientStarted: called before set (should not happen)");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onClientFinished(@NonNull BaseClientMonitor clientMonitor,
|
||||||
|
boolean success) {
|
||||||
|
Slog.e(TAG, "mCallback onClientFinished: called before set (should not happen)");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return A ClientMonitorEnum constant defined in biometrics.proto
|
* @return A ClientMonitorEnum constant defined in biometrics.proto
|
||||||
|
|||||||
Reference in New Issue
Block a user