Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbfba7a0 authored by Rubin Xu's avatar Rubin Xu
Browse files

Set face unlock toggle to unchecked when disabled by admin

Bug: 135747161
Test: make RunSettingsRoboTests
    ROBOTEST_FILTER=FaceSettingsLockscreenBypassPreferenceControllerTest
Change-Id: I1e3d105184a14bfece972abb096eac44bd186273
parent a49f4501
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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(),
+1 −0
Original line number Diff line number Diff line
@@ -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;