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

Commit 64097cbb authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "Fix default for CONTROLS_ENABLED" into rvc-dev

parents 19319b85 69ee49c8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ public class PowerMenuPrivacyPreferenceController extends TogglePreferenceContro
        final ContentResolver resolver = mContext.getContentResolver();
        boolean cardsAvailable = Settings.Secure.getInt(resolver, CARDS_AVAILABLE_KEY, 0) != 0;
        boolean cardsEnabled = Settings.Secure.getInt(resolver, CARDS_ENABLED_KEY, 0) != 0;
        boolean controlsEnabled = Settings.Secure.getInt(resolver, CONTROLS_ENABLED_KEY, 0) != 0;
        boolean controlsEnabled = Settings.Secure.getInt(resolver, CONTROLS_ENABLED_KEY, 1) != 0;
        return (cardsAvailable && cardsEnabled) || controlsEnabled;
    }

+10 −0
Original line number Diff line number Diff line
@@ -202,4 +202,14 @@ public class PowerMenuPrivacyPreferenceControllerTest {
        assertThat(mController.getAvailabilityStatus()).isEqualTo(
                BasePreferenceController.DISABLED_DEPENDENT_SETTING);
    }

    @Test
    public void getAvailabilityStatus_controlsDeletedSecure_retursAvailable() {
        when(mLockPatternUtils.isSecure(anyInt())).thenReturn(true);

        Settings.Secure.putString(mContentResolver, CONTROLS_ENABLED_KEY, null);

        assertThat(mController.getAvailabilityStatus()).isEqualTo(
                BasePreferenceController.AVAILABLE);
    }
}