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
|
@Override
|
||||||
protected boolean isPageSearchEnabled(Context context) {
|
protected boolean isPageSearchEnabled(Context context) {
|
||||||
return isAvailable(context);
|
if (isAvailable(context)) {
|
||||||
|
return hasEnrolledBiometrics(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getNonIndexableKeys(Context context) {
|
public List<String> getNonIndexableKeys(Context context) {
|
||||||
final List<String> keys = super.getNonIndexableKeys(context);
|
final List<String> keys = super.getNonIndexableKeys(context);
|
||||||
if (isAvailable(context)) {
|
if (isAvailable(context)) {
|
||||||
final FaceManager faceManager = context.getSystemService(FaceManager.class);
|
final boolean hasEnrolled = hasEnrolledBiometrics(context);
|
||||||
final boolean hasEnrolled = faceManager.hasEnrolledTemplates(
|
|
||||||
UserHandle.myUserId());
|
|
||||||
keys.add(hasEnrolled ? PREF_KEY_ENROLL_FACE_UNLOCK
|
keys.add(hasEnrolled ? PREF_KEY_ENROLL_FACE_UNLOCK
|
||||||
: PREF_KEY_DELETE_FACE_DATA);
|
: PREF_KEY_DELETE_FACE_DATA);
|
||||||
}
|
}
|
||||||
@@ -353,5 +355,13 @@ public class FaceSettings extends DashboardFragment {
|
|||||||
}
|
}
|
||||||
return isAttentionSupported;
|
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