Snap for 5719479 from 0839185647 to qt-c2f2-release

Change-Id: I4a3c58cc05aecd644f80a6ef46e3506d476b0613
This commit is contained in:
android-build-team Robot
2019-07-11 03:05:54 +00:00
2 changed files with 21 additions and 1 deletions

View File

@@ -31,6 +31,13 @@ public class FaceProfileStatusPreferenceController extends FaceStatusPreferenceC
super(context, KEY_FACE_SETTINGS);
}
@Override
public int getAvailabilityStatus() {
// Make the profile unsearchable so the user preference controller gets highlighted
// when searched for.
return AVAILABLE_UNSEARCHABLE;
}
@Override
protected boolean isUserSupported() {
return mProfileChallengeUserId != UserHandle.USER_NULL

View File

@@ -78,6 +78,19 @@ public class FaceSettingsAppPreferenceController extends FaceSettingsPreferenceC
@Override
public int getAvailabilityStatus() {
if(mFaceManager == null){
return AVAILABLE_UNSEARCHABLE;
}
// By only allowing this preference controller to be searchable when the feature is turned
// off, it will give preference to the face setup controller.
final boolean hasEnrolledUser = mFaceManager.hasEnrolledTemplates(getUserId());
final boolean appUnlockEnabled = Settings.Secure.getIntForUser(
mContext.getContentResolver(), FACE_UNLOCK_APP_ENABLED, OFF, getUserId()) == ON;
if (hasEnrolledUser && !appUnlockEnabled) {
return AVAILABLE;
} else {
return AVAILABLE_UNSEARCHABLE;
}
}
}