Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 821856ba authored by AdrianDC's avatar AdrianDC Committed by Michael Bestas
Browse files

Multiple LEDs [2/3]: Illumination Bars support



Implement the support of a multiple LEDs settings.

The setting is deactivated by default
and will be ignored by the unimplemented phones.
Current LibLights will simply not use the new variable.

Changes includes :
  frameworks/base
  hardware/libhardware
  packages/Apps/Settings

Change-Id: I5531093cd0543d7730a8c3f83c0aebb3678436d5
Signed-off-by: default avatarAdrianDC <radian.dc@gmail.com>
parent bb6c9e43
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -477,6 +477,7 @@
    <string name="notification_light_voicemail_title">Voicemail</string>
    <string name="notification_light_brightness" translatable="false">@string/brightness</string>
    <string name="notification_light_screen_on">Lights with screen on</string>
    <string name="notification_light_use_multiple_leds">Multiple LEDs</string>
    <string name="keywords_lights_brightness_level">dim leds brightness</string>

    <!-- Sound & notification > Sound section: Title for the option defining the default notification ringtone. [CHAR LIMIT=30] -->
+5 −0
Original line number Diff line number Diff line
@@ -45,6 +45,11 @@
            <intent android:action="android.intent.action.SHOW_NOTIFICATION_BRIGHTNESS_DIALOG" />
        </PreferenceScreen>

        <com.android.settings.cyanogenmod.SystemSettingSwitchPreference
            android:key="notification_light_multiple_leds_enable"
            android:title="@string/notification_light_use_multiple_leds"
            android:dependency="notification_light_pulse" />

        <com.android.settings.cyanogenmod.SystemSettingSwitchPreference
            android:key="notification_light_screen_on_enable"
            android:title="@string/notification_light_screen_on"
+10 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
    private PreferenceScreen mNotificationLedBrightnessPref;
    private SystemSettingSwitchPreference mEnabledPref;
    private SystemSettingSwitchPreference mCustomEnabledPref;
    private SystemSettingSwitchPreference mMultipleLedsEnabledPref;
    private SystemSettingSwitchPreference mScreenOnLightsPref;
    private ApplicationLightPreference mDefaultPref;
    private ApplicationLightPreference mCallPref;
@@ -118,6 +119,8 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
        // Advanced light settings
        mNotificationLedBrightnessPref = (PreferenceScreen)
                findPreference(Settings.System.NOTIFICATION_LIGHT_BRIGHTNESS_LEVEL);
        mMultipleLedsEnabledPref = (SystemSettingSwitchPreference)
                findPreference(Settings.System.NOTIFICATION_LIGHT_MULTIPLE_LEDS_ENABLE);
        mScreenOnLightsPref = (SystemSettingSwitchPreference)
                findPreference(Settings.System.NOTIFICATION_LIGHT_SCREEN_ON);
        mScreenOnLightsPref.setOnPreferenceChangeListener(this);
@@ -130,6 +133,12 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
        } else {
            mNotificationLedBrightnessPref.setOnPreferenceChangeListener(this);
        }
        if (!resources.getBoolean(
                com.android.internal.R.bool.config_multipleNotificationLeds)) {
            mAdvancedPrefs.removePreference(mMultipleLedsEnabledPref);
        } else {
            mMultipleLedsEnabledPref.setOnPreferenceChangeListener(this);
        }

        // Missed call and Voicemail preferences should only show on devices with a voice capabilities
        TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
@@ -400,6 +409,7 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem

    public boolean onPreferenceChange(Preference preference, Object objValue) {
        if (preference == mEnabledPref || preference == mCustomEnabledPref ||
                preference == mMultipleLedsEnabledPref ||
                preference == mNotificationLedBrightnessPref ||
                preference == mScreenOnLightsPref) {
            getActivity().invalidateOptionsMenu();