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

Commit 87b3974d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Check if pref is disabled by admin" into sc-v2-dev

parents 309426bb 42896d7f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -178,7 +178,8 @@ public class RedactNotificationPreferenceController extends TogglePreferenceCont

    private boolean getAllowPrivateNotifications(int userId) {
        return Settings.Secure.getIntForUser(mContext.getContentResolver(),
                LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1, userId) != 0;
                LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1, userId) != 0
                && getEnforcedAdmin(userId) == null;
    }

    private boolean getLockscreenNotificationsEnabled(int userId) {
+12 −0
Original line number Diff line number Diff line
@@ -292,6 +292,18 @@ public class RedactNotificationPreferenceControllerTest {
        assertThat(mWorkController.isChecked()).isFalse();
    }

    @Test
    public void isChecked_admin() {
        Settings.Secure.putIntForUser(mContext.getContentResolver(),
                LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS,
                1, 0);

        ShadowRestrictedLockUtilsInternal.setKeyguardDisabledFeatures(
                KEYGUARD_DISABLE_SECURE_NOTIFICATIONS);

        assertThat(mController.isChecked()).isFalse();
    }

    @Test
    public void setChecked_false() throws Exception {
        Settings.Secure.putIntForUser(mContext.getContentResolver(),