Merge "Set face unlock toggle to unchecked when disabled by admin" into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-03-30 21:07:15 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 0 deletions

View File

@@ -47,6 +47,11 @@ public class FaceSettingsLockscreenBypassPreferenceController
@Override
public boolean isChecked() {
if (!FaceSettings.isAvailable(mContext)) {
return false;
} else if (getRestrictingAdmin() != null) {
return false;
}
int defaultValue = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_faceAuthDismissesKeyguard) ? 1 : 0;
return Settings.Secure.getIntForUser(mContext.getContentResolver(),

View File

@@ -93,6 +93,7 @@ public class FaceSettingsLockscreenBypassPreferenceControllerTest {
boolean state = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD, defaultValue ? 1 : 0) != 0;
assertThat(mController.isChecked()).isFalse();
assertThat(mController.onPreferenceChange(mPreference, !state)).isTrue();
boolean newState = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD, 0) != 0;