Merge changes I96ad00cb,I2b1193b9,I2850007f into qt-r1-dev
* changes: Remove recalibrate notification when user enrolls getFaceDaemon on FaceService's own handler Return empty string when invalid error codes are received
This commit is contained in:
@@ -637,7 +637,7 @@ public class FaceManager implements BiometricAuthenticator, BiometricFaceConstan
|
||||
}
|
||||
}
|
||||
Slog.w(TAG, "Invalid error message: " + errMsg + ", " + vendorCode);
|
||||
return null;
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -97,6 +97,9 @@ public class FaceService extends BiometricServiceBase {
|
||||
"com.android.server.biometrics.face.ACTION_LOCKOUT_RESET";
|
||||
private static final int CHALLENGE_TIMEOUT_SEC = 600; // 10 minutes
|
||||
|
||||
private static final String NOTIFICATION_TAG = "FaceService";
|
||||
private static final int NOTIFICATION_ID = 1;
|
||||
|
||||
private final class FaceAuthClient extends AuthenticationClientImpl {
|
||||
private int mLastAcquire;
|
||||
|
||||
@@ -177,13 +180,11 @@ public class FaceService extends BiometricServiceBase {
|
||||
0 /* requestCode */, intent, 0 /* flags */, null /* options */,
|
||||
UserHandle.CURRENT);
|
||||
|
||||
final String id = "FaceService";
|
||||
final String channelName = "FaceEnrollNotificationChannel";
|
||||
|
||||
NotificationManager nm =
|
||||
getContext().getSystemService(NotificationManager.class);
|
||||
NotificationChannel channel = new NotificationChannel(id, name,
|
||||
NotificationChannel channel = new NotificationChannel(channelName, name,
|
||||
NotificationManager.IMPORTANCE_HIGH);
|
||||
Notification notification = new Notification.Builder(getContext(), id)
|
||||
Notification notification = new Notification.Builder(getContext(), channelName)
|
||||
.setSmallIcon(R.drawable.ic_lock)
|
||||
.setContentTitle(title)
|
||||
.setContentText(content)
|
||||
@@ -196,8 +197,9 @@ public class FaceService extends BiometricServiceBase {
|
||||
.setVisibility(Notification.VISIBILITY_SECRET)
|
||||
.build();
|
||||
|
||||
nm.createNotificationChannel(channel);
|
||||
nm.notifyAsUser(null /* tag */, 0 /* id */, notification, UserHandle.CURRENT);
|
||||
mNotificationManager.createNotificationChannel(channel);
|
||||
mNotificationManager.notifyAsUser(NOTIFICATION_TAG, NOTIFICATION_ID, notification,
|
||||
UserHandle.CURRENT);
|
||||
}
|
||||
|
||||
return super.onAcquired(acquireInfo, vendorCode);
|
||||
@@ -231,6 +233,9 @@ public class FaceService extends BiometricServiceBase {
|
||||
final int[] disabledFeatures) {
|
||||
checkPermission(MANAGE_BIOMETRIC);
|
||||
|
||||
mNotificationManager.cancelAsUser(NOTIFICATION_TAG, NOTIFICATION_ID,
|
||||
UserHandle.CURRENT);
|
||||
|
||||
final boolean restricted = isRestricted();
|
||||
final EnrollClientImpl client = new EnrollClientImpl(getContext(), mDaemonWrapper,
|
||||
mHalDeviceId, token, new ServiceListenerImpl(receiver), mCurrentUserId,
|
||||
@@ -688,6 +693,8 @@ public class FaceService extends BiometricServiceBase {
|
||||
// One of the AuthenticationClient constants
|
||||
private int mCurrentUserLockoutMode;
|
||||
|
||||
private NotificationManager mNotificationManager;
|
||||
|
||||
private int[] mBiometricPromptIgnoreList;
|
||||
private int[] mBiometricPromptIgnoreListVendor;
|
||||
private int[] mKeyguardIgnoreList;
|
||||
@@ -893,6 +900,8 @@ public class FaceService extends BiometricServiceBase {
|
||||
public FaceService(Context context) {
|
||||
super(context);
|
||||
|
||||
mNotificationManager = getContext().getSystemService(NotificationManager.class);
|
||||
|
||||
mBiometricPromptIgnoreList = getContext().getResources()
|
||||
.getIntArray(R.array.config_face_acquire_biometricprompt_ignorelist);
|
||||
mBiometricPromptIgnoreListVendor = getContext().getResources()
|
||||
@@ -911,7 +920,10 @@ public class FaceService extends BiometricServiceBase {
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
publishBinderService(Context.FACE_SERVICE, new FaceServiceWrapper());
|
||||
SystemServerInitThreadPool.get().submit(this::getFaceDaemon, TAG + ".onStart");
|
||||
// Get the face daemon on FaceService's on thread so SystemServerInitThreadPool isn't
|
||||
// blocked
|
||||
SystemServerInitThreadPool.get().submit(() -> mHandler.post(this::getFaceDaemon),
|
||||
TAG + ".onStart");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user