Merge "Check if pref is disabled by admin" into sc-v2-dev am: 87b3974dfd
am: cd467e99d8
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16199770 Change-Id: Ib57d1de7591e1429440f746839078594fd97dfef
This commit is contained in:
@@ -178,7 +178,8 @@ public class RedactNotificationPreferenceController extends TogglePreferenceCont
|
|||||||
|
|
||||||
private boolean getAllowPrivateNotifications(int userId) {
|
private boolean getAllowPrivateNotifications(int userId) {
|
||||||
return Settings.Secure.getIntForUser(mContext.getContentResolver(),
|
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) {
|
private boolean getLockscreenNotificationsEnabled(int userId) {
|
||||||
|
@@ -292,6 +292,18 @@ public class RedactNotificationPreferenceControllerTest {
|
|||||||
assertThat(mWorkController.isChecked()).isFalse();
|
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
|
@Test
|
||||||
public void setChecked_false() throws Exception {
|
public void setChecked_false() throws Exception {
|
||||||
Settings.Secure.putIntForUser(mContext.getContentResolver(),
|
Settings.Secure.putIntForUser(mContext.getContentResolver(),
|
||||||
|
Reference in New Issue
Block a user