Merge "Silent notifs appear on lockscreen by default" into qt-dev am: f58cd0fb51

am: 520a48070f

Change-Id: I66b0830dc86ee78e97541be0e4ab412eeb2457e5
This commit is contained in:
Julia Reynolds
2019-06-06 12:03:55 -07:00
committed by android-build-merger
6 changed files with 18 additions and 6 deletions

View File

@@ -72,7 +72,7 @@ public class GentleDrawablePreferenceController extends BasePreferenceController
private boolean showOnLockscreen() { private boolean showOnLockscreen() {
return Settings.Secure.getInt(mContext.getContentResolver(), 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() { private boolean showOnStatusBar() {

View File

@@ -69,7 +69,7 @@ public class GentleNotificationsPreferenceController extends BasePreferenceContr
private boolean showOnLockscreen() { private boolean showOnLockscreen() {
return Settings.Secure.getInt(mContext.getContentResolver(), 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() { private boolean showOnStatusBar() {

View File

@@ -66,7 +66,7 @@ public class ImportancePreferenceController extends NotificationPreferenceContro
pref.setImportance(mChannel.getImportance()); pref.setImportance(mChannel.getImportance());
pref.setDisplayInStatusBar(mBackend.showSilentInStatusBar(mContext.getPackageName())); pref.setDisplayInStatusBar(mBackend.showSilentInStatusBar(mContext.getPackageName()));
pref.setDisplayOnLockscreen(Settings.Secure.getInt(mContext.getContentResolver(), 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);
} }
} }

View File

@@ -150,11 +150,11 @@ public class ShowOnLockScreenNotificationPreferenceController extends AbstractPr
private boolean getLockscreenNotificationsEnabled() { private boolean getLockscreenNotificationsEnabled() {
return Settings.Secure.getInt(mContext.getContentResolver(), 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() { private boolean getLockscreenSilentNotificationsEnabled() {
return Settings.Secure.getInt(mContext.getContentResolver(), return Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 0) != 0; Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 1) != 0;
} }
} }

View File

@@ -38,7 +38,7 @@ public class SilentLockscreenPreferenceController extends TogglePreferenceContro
@Override @Override
public boolean isChecked() { public boolean isChecked() {
return Settings.Secure.getInt(mContext.getContentResolver(), 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 @Override

View File

@@ -132,6 +132,18 @@ public class ShowOnLockscreenNotificationPreferenceControllerTest {
.isEqualTo(mContext.getString(R.string.lock_screen_notifs_show_all)); .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 @Test
public void updateState_dpmSaysNo() { public void updateState_dpmSaysNo() {
Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.putInt(mContext.getContentResolver(),