Use channel warning development setting.

Defaults to enabled for debuggable builds.

Bug: 37945054
Bug: 38380608
Test: manual
Change-Id: I1b67f55d507e31349908953abbf04ac764835915
This commit is contained in:
Geoffrey Pitsch
2017-05-11 12:57:22 -04:00
parent c9963a2f2a
commit 507822decb
2 changed files with 9 additions and 2 deletions

View File

@@ -684,6 +684,12 @@
<string name="show_all_anrs_summary">Show App Not Responding dialog
for background apps</string>
<!-- UI debug setting: show all ANRs? [CHAR LIMIT=25] -->
<string name="show_notification_channel_warnings">Show notification channel warnings</string>
<!-- UI debug setting: show all ANRs summary [CHAR LIMIT=50] -->
<string name="show_notification_channel_warnings_summary">Displays on-screen warning when an app posts a notification without a valid channel</string>
<!-- UI debug setting: force allow apps on external storage [CHAR LIMIT=50] -->
<string name="force_allow_on_external">Force allow apps on external</string>
<!-- UI debug setting: force allow on external summary [CHAR LIMIT=150] -->

View File

@@ -3282,9 +3282,10 @@ public class NotificationManagerService extends SystemService {
}
private void doChannelWarningToast(CharSequence toastText) {
final int defaultWarningEnabled = Build.IS_DEBUGGABLE ? 1 : 0;
final boolean warningEnabled = Settings.Global.getInt(getContext().getContentResolver(),
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, 0) != 0;
if (warningEnabled || Build.IS_DEBUGGABLE) {
Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, defaultWarningEnabled) != 0;
if (warningEnabled) {
Toast toast = Toast.makeText(getContext(), mHandler.getLooper(), toastText,
Toast.LENGTH_LONG);
toast.show();