From 306c2881c045ccf0e1afc4494fe9e50781f88818 Mon Sep 17 00:00:00 2001 From: Sam Mortimer Date: Wed, 26 Nov 2014 23:26:08 -0800 Subject: Remove lights settings unless intrusive LED bools are true com.android.internal.R.bool.config_intrusiveNotificationLed com.android.internal.R.bool.config_intrusiveBatteryLed Change-Id: I8883d68bc7e82d295a1d47b3ca3777525350d854 --- .../notification/NotificationSettings.java | 29 ++++++++-------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/com/android/settings/notification/NotificationSettings.java b/src/com/android/settings/notification/NotificationSettings.java index f513378..34e60e8 100644 --- a/src/com/android/settings/notification/NotificationSettings.java +++ b/src/com/android/settings/notification/NotificationSettings.java @@ -82,6 +82,8 @@ public class NotificationSettings extends SettingsPreferenceFragment implements private static final String KEY_LOCK_SCREEN_NOTIFICATIONS = "lock_screen_notifications"; private static final String KEY_NOTIFICATION_ACCESS = "manage_notification_access"; private static final String KEY_INCREASING_RING_VOLUME = "increasing_ring_volume"; + private static final String KEY_NOTIFICATION_LIGHT = "notification_light"; + private static final String KEY_BATTERY_LIGHT = "battery_light"; private static final String KEY_ZEN_ACCESS = "manage_zen_access"; private static final String KEY_ZEN_MODE = "zen_mode"; @@ -443,25 +445,14 @@ public class NotificationSettings extends SettingsPreferenceFragment implements // === Pulse notification light === private void initPulse(PreferenceCategory parent) { - mNotificationPulse = (TwoStatePreference) parent.findPreference(KEY_NOTIFICATION_PULSE); - if (mNotificationPulse == null) { - Log.i(TAG, "Preference not found: " + KEY_NOTIFICATION_PULSE); - return; - } - if (!getResources() - .getBoolean(com.android.internal.R.bool.config_intrusiveNotificationLed)) { - parent.removePreference(mNotificationPulse); - } else { - updatePulse(); - mNotificationPulse.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - final boolean val = (Boolean)newValue; - return Settings.System.putInt(getContentResolver(), - Settings.System.NOTIFICATION_LIGHT_PULSE, - val ? 1 : 0); - } - }); + if (!getResources().getBoolean( + com.android.internal.R.bool.config_intrusiveNotificationLed)) { + parent.removePreference(parent.findPreference(KEY_NOTIFICATION_LIGHT)); + } + if (!getResources().getBoolean( + com.android.internal.R.bool.config_intrusiveBatteryLed) + || UserHandle.myUserId() != UserHandle.USER_OWNER) { + parent.removePreference(parent.findPreference(KEY_BATTERY_LIGHT)); } } -- cgit v1.1