Always start AuthController

Since device credential is now a first-class citizen, we need to ensure
that SystemUI is always responding to authentication requests. For example,
on devices without biometrics, applications that request authentication
with Authenticators.DEVICE_CREDENTIAL is still a valid request.

Bug: 149795050

Test: Remove /vendor/etc/permissions/android.hardware.fingerprint.xml,
      reboot. Go through CtsVerifier biometric section

Change-Id: I555aa5763deb31011eea46572272327f02470a02
This commit is contained in:
Kevin Chyn
2020-02-20 12:10:21 -08:00
parent 7d07c89235
commit 4e6417d37a
3 changed files with 11 additions and 17 deletions

View File

@@ -28,7 +28,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.hardware.biometrics.BiometricConstants;
import android.hardware.biometrics.BiometricPrompt;
@@ -238,20 +237,15 @@ public class AuthController extends SystemUI implements CommandQueue.Callbacks,
@Override
public void start() {
final PackageManager pm = mContext.getPackageManager();
if (pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)
|| pm.hasSystemFeature(PackageManager.FEATURE_FACE)
|| pm.hasSystemFeature(PackageManager.FEATURE_IRIS)) {
mCommandQueue.addCallback(this);
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
mActivityTaskManager = mInjector.getActivityTaskManager();
mCommandQueue.addCallback(this);
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
mActivityTaskManager = mInjector.getActivityTaskManager();
try {
mTaskStackListener = new BiometricTaskStackListener();
mActivityTaskManager.registerTaskStackListener(mTaskStackListener);
} catch (RemoteException e) {
Log.w(TAG, "Unable to register task stack listener", e);
}
try {
mTaskStackListener = new BiometricTaskStackListener();
mActivityTaskManager.registerTaskStackListener(mTaskStackListener);
} catch (RemoteException e) {
Log.w(TAG, "Unable to register task stack listener", e);
}
}

View File

@@ -131,7 +131,7 @@ public class Utils {
*/
public static boolean isAtLeastStrength(int sensorStrength, int requestedStrength) {
// Clear out any bits that are not reserved for biometric
sensorStrength = sensorStrength & Authenticators.BIOMETRIC_MIN_STRENGTH;
sensorStrength &= Authenticators.BIOMETRIC_MIN_STRENGTH;
// If the authenticator contains bits outside of the requested strength, it is too weak.
if ((sensorStrength & ~requestedStrength) != 0) {
@@ -139,7 +139,7 @@ public class Utils {
}
for (int i = Authenticators.BIOMETRIC_MAX_STRENGTH;
i <= requestedStrength; i = i << 1 | 1) {
i <= requestedStrength; i = (i << 1) | 1) {
if (i == sensorStrength) {
return true;
}

View File

@@ -413,7 +413,7 @@ public class FingerprintService extends BiometricServiceBase {
@Override // Binder call
public long getAuthenticatorId() {
checkPermission(USE_BIOMETRIC_INTERNAL);
return FingerprintService.super.getAuthenticatorId();
return FingerprintService.this.getAuthenticatorId();
}
@Override // Binder call