@@ -1227,8 +1227,7 @@ void onPolicyChanged() {
12271227 mDefaultNotificationLedOff = resources .getInteger (
12281228 R .integer .config_defaultNotificationLedOff );
12291229
1230- mMultiColorNotificationLed = resources .getBoolean (
1231- R .bool .config_multiColorNotificationLed );
1230+ mMultiColorNotificationLed = deviceLightsCan (NotificationManager .LIGHTS_RGB_NOTIFICATION );
12321231
12331232 mNotificationPulseCustomLedValues = new HashMap <String , NotificationLedValues >();
12341233
@@ -1250,10 +1249,10 @@ void onPolicyChanged() {
12501249 VIBRATE_PATTERN_MAXLEN ,
12511250 DEFAULT_VIBRATE_PATTERN );
12521251
1253- mAdjustableNotificationLedBrightness = resources . getBoolean (
1254- org . cyanogenmod . platform . internal . R . bool . config_adjustableNotificationLedBrightness );
1255- mMultipleNotificationLeds = resources . getBoolean (
1256- org . cyanogenmod . platform . internal . R . bool . config_multipleNotificationLeds );
1252+ mAdjustableNotificationLedBrightness = deviceLightsCan (
1253+ NotificationManager . LIGHTS_ADJUSTABLE_NOTIFICATION_BRIGHTNESS );
1254+ mMultipleNotificationLeds = deviceLightsCan (
1255+ NotificationManager . LIGHTS_MULTIPLE_LED );
12571256
12581257 mUseAttentionLight = resources .getBoolean (R .bool .config_useAttentionLight );
12591258
@@ -1396,6 +1395,47 @@ private void updateInterruptionFilterLocked() {
13961395 scheduleInterruptionFilterChanged (interruptionFilter );
13971396 }
13981397
1398+ private int deviceLightsCapabilities () {
1399+ Resources resources = getContext ().getResources ();
1400+ int capabilities = SystemProperties .getInt ("sys.lights.capabilities" , 0 );
1401+
1402+ if (capabilities == 0 ) {
1403+ int [] deviceCaps = resources .getIntArray (
1404+ com .android .internal .R .array .config_deviceLightCapabilities );
1405+ for (int cap : deviceCaps ) {
1406+ capabilities |= 1 <<cap ;
1407+ }
1408+ }
1409+
1410+ /* Legacy format */
1411+ if (capabilities == 0 ) {
1412+ if (resources .getBoolean (com .android .internal .R .bool .config_multiColorNotificationLed )) {
1413+ capabilities |= 1 <<NotificationManager .LIGHTS_RGB_NOTIFICATION ;
1414+ }
1415+ if (resources .getBoolean (com .android .internal .R .bool .config_multiColorBatteryLed )) {
1416+ capabilities |= 1 <<NotificationManager .LIGHTS_RGB_BATTERY ;
1417+ }
1418+ if (resources .getBoolean (com .android .internal .R .bool .config_ledCanPulse )) {
1419+ capabilities |= 1 <<NotificationManager .LIGHTS_LED_PULSE ;
1420+ }
1421+ if (resources .getBoolean (org .cyanogenmod .platform .internal .R .bool .config_multipleNotificationLeds )) {
1422+ capabilities |= 1 <<NotificationManager .LIGHTS_MULTIPLE_LED ;
1423+ }
1424+ if (resources .getBoolean (org .cyanogenmod .platform .internal .R .bool .config_useSegmentedBatteryLed )) {
1425+ capabilities |= 1 <<NotificationManager .LIGHTS_SEGMENTED_BATTERY_LIGHTS ;
1426+ }
1427+ if (resources .getBoolean (org .cyanogenmod .platform .internal .R .bool .config_adjustableNotificationLedBrightness )) {
1428+ capabilities |= 1 <<NotificationManager .LIGHTS_ADJUSTABLE_NOTIFICATION_BRIGHTNESS ;
1429+ }
1430+ }
1431+ return capabilities ;
1432+ }
1433+
1434+ /** @hide */
1435+ public boolean deviceLightsCan (int lightCapability ) {
1436+ return ( (deviceLightsCapabilities () & 1 <<lightCapability ) != 0 );
1437+ }
1438+
13991439 private final IBinder mService = new INotificationManager .Stub () {
14001440 // Toasts
14011441 // ============================================================================
@@ -2161,6 +2201,10 @@ public void setNotificationPolicy(String pkg, Policy policy) {
21612201 Binder .restoreCallingIdentity (identity );
21622202 }
21632203 }
2204+
2205+ public boolean deviceLightsCan (int lightCapability ) {
2206+ return ( (deviceLightsCapabilities () & 1 <<lightCapability ) != 0 );
2207+ }
21642208 };
21652209
21662210 private String disableNotificationEffects (NotificationRecord record ) {
0 commit comments