diff options
author | Sam Mortimer <sam@mortimer.me.uk> | 2014-11-26 23:26:08 -0800 |
---|---|---|
committer | Adnan Begovic <adnan@cyngn.com> | 2015-10-29 17:36:31 -0700 |
commit | 306c2881c045ccf0e1afc4494fe9e50781f88818 (patch) | |
tree | 2290127aed1b87920dd09e640274aeca5f78ccf3 | |
parent | e5f5e3acabc4c3816764f8f1456633f2f472a0b0 (diff) | |
download | packages_apps_Settings-306c2881c045ccf0e1afc4494fe9e50781f88818.zip packages_apps_Settings-306c2881c045ccf0e1afc4494fe9e50781f88818.tar.gz packages_apps_Settings-306c2881c045ccf0e1afc4494fe9e50781f88818.tar.bz2 |
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
-rw-r--r-- | src/com/android/settings/notification/NotificationSettings.java | 29 |
1 files changed, 10 insertions, 19 deletions
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)); } } |