Merge "Developer setting to enable notification channel warnings" into oc-dev am: 77bb0aaf96
am: 984dad4ac6
Change-Id: Ica82b112388bd3f3f0a1e2e0281b8c1036d64934
diff --git a/res/xml/development_prefs.xml b/res/xml/development_prefs.xml
index 273b80d..d6f9dcc 100644
--- a/res/xml/development_prefs.xml
+++ b/res/xml/development_prefs.xml
@@ -424,6 +424,11 @@
android:title="@string/show_all_anrs"
android:summary="@string/show_all_anrs_summary"/>
+ <SwitchPreference
+ android:key="show_notification_channel_warnings"
+ android:title="@string/show_notification_channel_warnings"
+ android:summary="@string/show_notification_channel_warnings_summary"/>
+
<Preference
android:key="inactive_apps"
android:title="@string/inactive_apps_title"
diff --git a/src/com/android/settings/development/DevelopmentSettings.java b/src/com/android/settings/development/DevelopmentSettings.java
index b4dda75..6b33a5b 100644
--- a/src/com/android/settings/development/DevelopmentSettings.java
+++ b/src/com/android/settings/development/DevelopmentSettings.java
@@ -226,6 +226,8 @@
private static final String SHOW_ALL_ANRS_KEY = "show_all_anrs";
+ private static final String SHOW_NOTIFICATION_CHANNEL_WARNINGS_KEY = "show_notification_channel_warnings";
+
private static final String TERMINAL_APP_PACKAGE = "com.android.terminal";
private static final String KEY_CONVERT_FBE = "convert_to_file_encryption";
@@ -325,6 +327,8 @@
private SwitchPreference mShowAllANRs;
+ private SwitchPreference mShowNotificationChannelWarnings;
+
private ColorModePreference mColorModePreference;
private SwitchPreference mForceResizable;
@@ -520,6 +524,11 @@
mAllPrefs.add(mShowAllANRs);
mResetSwitchPrefs.add(mShowAllANRs);
+ mShowNotificationChannelWarnings = (SwitchPreference) findPreference(
+ SHOW_NOTIFICATION_CHANNEL_WARNINGS_KEY);
+ mAllPrefs.add(mShowNotificationChannelWarnings);
+ mResetSwitchPrefs.add(mShowNotificationChannelWarnings);
+
Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
if (hdcpChecking != null) {
mAllPrefs.add(hdcpChecking);
@@ -785,6 +794,7 @@
updateImmediatelyDestroyActivitiesOptions();
updateAppProcessLimitOptions();
updateShowAllANRsOptions();
+ updateShowNotificationChannelWarningsOptions();
mVerifyAppsOverUsbController.updatePreference();
updateOtaDisableAutomaticUpdateOptions();
updateBugreportOptions();
@@ -2264,6 +2274,19 @@
getActivity().getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0);
}
+ private void writeShowNotificationChannelWarningsOptions() {
+ Settings.Global.putInt(getActivity().getContentResolver(),
+ Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS,
+ mShowNotificationChannelWarnings.isChecked() ? 1 : 0);
+ }
+
+ private void updateShowNotificationChannelWarningsOptions() {
+ final int defaultWarningEnabled = Build.IS_DEBUGGABLE ? 1 : 0;
+ updateSwitchPreference(mShowNotificationChannelWarnings, Settings.Global.getInt(
+ getActivity().getContentResolver(),
+ Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, defaultWarningEnabled) != 0);
+ }
+
private void confirmEnableOemUnlock() {
DialogInterface.OnClickListener onClickListener = new DialogInterface.OnClickListener() {
@Override
@@ -2450,6 +2473,8 @@
writeImmediatelyDestroyActivitiesOptions();
} else if (preference == mShowAllANRs) {
writeShowAllANRsOptions();
+ } else if (preference == mShowNotificationChannelWarnings) {
+ writeShowNotificationChannelWarningsOptions();
} else if (preference == mForceHardwareUi) {
writeHardwareUiOptions();
} else if (preference == mForceMsaa) {