Merge "According to the enrolled status to show/hide face unlock results" into rvc-dev
This commit is contained in:
@@ -323,16 +323,18 @@ public class FaceSettings extends DashboardFragment {
|
||||
|
||||
@Override
|
||||
protected boolean isPageSearchEnabled(Context context) {
|
||||
return isAvailable(context);
|
||||
if (isAvailable(context)) {
|
||||
return hasEnrolledBiometrics(context);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNonIndexableKeys(Context context) {
|
||||
final List<String> keys = super.getNonIndexableKeys(context);
|
||||
if (isAvailable(context)) {
|
||||
final FaceManager faceManager = context.getSystemService(FaceManager.class);
|
||||
final boolean hasEnrolled = faceManager.hasEnrolledTemplates(
|
||||
UserHandle.myUserId());
|
||||
final boolean hasEnrolled = hasEnrolledBiometrics(context);
|
||||
keys.add(hasEnrolled ? PREF_KEY_ENROLL_FACE_UNLOCK
|
||||
: PREF_KEY_DELETE_FACE_DATA);
|
||||
}
|
||||
@@ -353,5 +355,13 @@ public class FaceSettings extends DashboardFragment {
|
||||
}
|
||||
return isAttentionSupported;
|
||||
}
|
||||
|
||||
private boolean hasEnrolledBiometrics(Context context) {
|
||||
final FaceManager faceManager = Utils.getFaceManagerOrNull(context);
|
||||
if (faceManager != null) {
|
||||
return faceManager.hasEnrolledTemplates(UserHandle.myUserId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user