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

Commit eeef647f authored by AdrianDC's avatar AdrianDC Committed by Adnan Begovic
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 e0eac298
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -311,6 +311,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>

    <!-- Lights settings, LED notification -->
+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.CMSystemSettingSwitchPreference
            android:key="notification_light_multiple_leds_enable"
            android:title="@string/notification_light_use_multiple_leds"
            android:dependency="notification_light_pulse" />

        <com.android.settings.cyanogenmod.CMSystemSettingSwitchPreference
            android:key="notification_light_screen_on_enable"
            android:title="@string/notification_light_screen_on"
+10 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
    private PreferenceScreen mNotificationLedBrightnessPref;
    private SystemSettingSwitchPreference mEnabledPref;
    private CMSystemSettingSwitchPreference mCustomEnabledPref;
    private CMSystemSettingSwitchPreference mMultipleLedsEnabledPref;
    private CMSystemSettingSwitchPreference mScreenOnLightsPref;
    private ApplicationLightPreference mDefaultPref;
    private ApplicationLightPreference mCallPref;
@@ -125,6 +126,8 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
        // Advanced light settings
        mNotificationLedBrightnessPref = (PreferenceScreen)
                findPreference(CMSettings.System.NOTIFICATION_LIGHT_BRIGHTNESS_LEVEL);
        mMultipleLedsEnabledPref = (CMSystemSettingSwitchPreference)
                findPreference(CMSettings.System.NOTIFICATION_LIGHT_MULTIPLE_LEDS_ENABLE);
        mScreenOnLightsPref = (CMSystemSettingSwitchPreference)
                findPreference(CMSettings.System.NOTIFICATION_LIGHT_SCREEN_ON);
        mScreenOnLightsPref.setOnPreferenceChangeListener(this);
@@ -136,6 +139,12 @@ public class NotificationLightSettings extends SettingsPreferenceFragment implem
        } else {
            mNotificationLedBrightnessPref.setOnPreferenceChangeListener(this);
        }
        if (!resources.getBoolean(
                org.cyanogenmod.platform.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);
@@ -424,6 +433,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();