diff --git a/src/com/android/settings/notification/GentleDrawablePreferenceController.java b/src/com/android/settings/notification/GentleDrawablePreferenceController.java index cdadf5acd24..b4e18db27d3 100644 --- a/src/com/android/settings/notification/GentleDrawablePreferenceController.java +++ b/src/com/android/settings/notification/GentleDrawablePreferenceController.java @@ -72,7 +72,7 @@ public class GentleDrawablePreferenceController extends BasePreferenceController private boolean showOnLockscreen() { return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 0) == ON; + Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, ON) == ON; } private boolean showOnStatusBar() { diff --git a/src/com/android/settings/notification/GentleNotificationsPreferenceController.java b/src/com/android/settings/notification/GentleNotificationsPreferenceController.java index 97e4e252d17..ea16e726846 100644 --- a/src/com/android/settings/notification/GentleNotificationsPreferenceController.java +++ b/src/com/android/settings/notification/GentleNotificationsPreferenceController.java @@ -69,7 +69,7 @@ public class GentleNotificationsPreferenceController extends BasePreferenceContr private boolean showOnLockscreen() { return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 0) == ON; + Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, ON) == ON; } private boolean showOnStatusBar() { diff --git a/src/com/android/settings/notification/ImportancePreferenceController.java b/src/com/android/settings/notification/ImportancePreferenceController.java index dc592754c7d..4ef459370d5 100644 --- a/src/com/android/settings/notification/ImportancePreferenceController.java +++ b/src/com/android/settings/notification/ImportancePreferenceController.java @@ -66,7 +66,7 @@ public class ImportancePreferenceController extends NotificationPreferenceContro pref.setImportance(mChannel.getImportance()); pref.setDisplayInStatusBar(mBackend.showSilentInStatusBar(mContext.getPackageName())); pref.setDisplayOnLockscreen(Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 0) == 1); + Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 1) == 1); } } diff --git a/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java b/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java index 5d08ac796d1..df1f4a21eb0 100644 --- a/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java +++ b/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java @@ -150,11 +150,11 @@ public class ShowOnLockScreenNotificationPreferenceController extends AbstractPr private boolean getLockscreenNotificationsEnabled() { return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 0) != 0; + Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS, 1) != 0; } private boolean getLockscreenSilentNotificationsEnabled() { return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 0) != 0; + Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 1) != 0; } } diff --git a/src/com/android/settings/notification/SilentLockscreenPreferenceController.java b/src/com/android/settings/notification/SilentLockscreenPreferenceController.java index 219d312b956..317f7da6e33 100644 --- a/src/com/android/settings/notification/SilentLockscreenPreferenceController.java +++ b/src/com/android/settings/notification/SilentLockscreenPreferenceController.java @@ -38,7 +38,7 @@ public class SilentLockscreenPreferenceController extends TogglePreferenceContro @Override public boolean isChecked() { return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 0) == 1; + Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 1) == 1; } @Override diff --git a/tests/robotests/src/com/android/settings/notification/ShowOnLockscreenNotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/ShowOnLockscreenNotificationPreferenceControllerTest.java index 6907051ea86..a341def3ed5 100644 --- a/tests/robotests/src/com/android/settings/notification/ShowOnLockscreenNotificationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/ShowOnLockscreenNotificationPreferenceControllerTest.java @@ -132,6 +132,18 @@ public class ShowOnLockscreenNotificationPreferenceControllerTest { .isEqualTo(mContext.getString(R.string.lock_screen_notifs_show_all)); } + @Test + public void updateState_allNotifsOnLockscreen_isDefault() { + // settings don't exist + + mController.updateState(mPreference); + + assertThat(mPreference.getValue()).isEqualTo( + String.valueOf(R.string.lock_screen_notifs_show_all)); + assertThat(mPreference.getSummary()) + .isEqualTo(mContext.getString(R.string.lock_screen_notifs_show_all)); + } + @Test public void updateState_dpmSaysNo() { Settings.Secure.putInt(mContext.getContentResolver(),