Merge "Silent notifs appear on lockscreen by default" into qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
f58cd0fb51
@@ -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() {
|
||||||
|
@@ -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() {
|
||||||
|
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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
|
||||||
|
@@ -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(),
|
||||||
|
Reference in New Issue
Block a user