From e9108aecd8362a3a1e2f382dec4c0c95ea84dac6 Mon Sep 17 00:00:00 2001 From: Julia Tuttle Date: Thu, 13 Oct 2022 21:42:52 -0400 Subject: [PATCH] Default to hiding silent notifications on lockscreen in Settings Also, fix an errorprone issue. Bug: 252815574 Test: atest ShowOnLockscreenNotificationPreferenceControllerTest Change-Id: I46e6d0f15c69abe60ef8505d300e5205b3c71e53 --- ...LockScreenNotificationPreferenceController.java | 2 +- ...screenNotificationPreferenceControllerTest.java | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java b/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java index 5614e5d6e7c..1addd8220db 100644 --- a/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java +++ b/src/com/android/settings/notification/ShowOnLockScreenNotificationPreferenceController.java @@ -157,6 +157,6 @@ public class ShowOnLockScreenNotificationPreferenceController extends AbstractPr private boolean getLockscreenSilentNotificationsEnabled() { return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 1) != 0; + Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 0) != 0; } } diff --git a/tests/robotests/src/com/android/settings/notification/ShowOnLockscreenNotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/ShowOnLockscreenNotificationPreferenceControllerTest.java index c7dfb15f9f2..567c7ff9bc4 100644 --- a/tests/robotests/src/com/android/settings/notification/ShowOnLockscreenNotificationPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/ShowOnLockscreenNotificationPreferenceControllerTest.java @@ -93,7 +93,7 @@ public class ShowOnLockscreenNotificationPreferenceControllerTest { assertThat(mPreference.getValue()).isEqualTo( String.valueOf(R.string.lock_screen_notifs_show_none)); - assertThat(mPreference.getSummary()) + assertThat(mPreference.getSummary().toString()) .isEqualTo(mContext.getString(R.string.lock_screen_notifs_show_none)); } @@ -110,7 +110,7 @@ public class ShowOnLockscreenNotificationPreferenceControllerTest { assertThat(mPreference.getValue()).isEqualTo( String.valueOf(R.string.lock_screen_notifs_show_alerting)); - assertThat(mPreference.getSummary()) + assertThat(mPreference.getSummary().toString()) .isEqualTo(mContext.getString(R.string.lock_screen_notifs_show_alerting)); } @@ -127,20 +127,20 @@ public class ShowOnLockscreenNotificationPreferenceControllerTest { assertThat(mPreference.getValue()).isEqualTo( String.valueOf(R.string.lock_screen_notifs_show_all)); - assertThat(mPreference.getSummary()) + assertThat(mPreference.getSummary().toString()) .isEqualTo(mContext.getString(R.string.lock_screen_notifs_show_all)); } @Test - public void updateState_allNotifsOnLockscreen_isDefault() { + public void updateState_alertingNotifsOnLockscreen_isDefault() { // settings don't exist mController.displayPreference(mScreen); 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)); + String.valueOf(R.string.lock_screen_notifs_show_alerting)); + assertThat(mPreference.getSummary().toString()) + .isEqualTo(mContext.getString(R.string.lock_screen_notifs_show_alerting)); } @Test