diff --git a/src/java/cyanogenmod/providers/CMSettings.java b/src/java/cyanogenmod/providers/CMSettings.java index 19a2140..d318f6e 100644 --- a/src/java/cyanogenmod/providers/CMSettings.java +++ b/src/java/cyanogenmod/providers/CMSettings.java @@ -1713,6 +1713,19 @@ public final class CMSettings { } }; + /** + * Whether we automatically generate notification LED colors or just + * use the boring default. + * + * @hide + */ + public static final String NOTIFICATION_LIGHT_COLOR_AUTO = + "notification_light_color_auto"; + + /** @hide */ + public static final Validator NOTIFICATION_LIGHT_COLOR_AUTO_VALIDATOR = + sBooleanValidator; + /** * I can haz more bukkits * @hide @@ -1958,6 +1971,8 @@ public final class CMSettings { NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE_VALIDATOR); VALIDATORS.put(NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES, NOTIFICATION_LIGHT_PULSE_CUSTOM_VALUES_VALIDATOR); + VALIDATORS.put(NOTIFICATION_LIGHT_COLOR_AUTO, + NOTIFICATION_LIGHT_COLOR_AUTO_VALIDATOR); VALIDATORS.put(__MAGICAL_TEST_PASSING_ENABLER, __MAGICAL_TEST_PASSING_ENABLER_VALIDATOR); }; diff --git a/src/java/cyanogenmod/util/ColorUtils.java b/src/java/cyanogenmod/util/ColorUtils.java index 0580dd1..1819057 100644 --- a/src/java/cyanogenmod/util/ColorUtils.java +++ b/src/java/cyanogenmod/util/ColorUtils.java @@ -180,7 +180,9 @@ public class ColorUtils { if (bitmap != null) { Palette p = Palette.generate(bitmap); color = findPerceptuallyNearestSolidColor(p.getVibrantColor(0)) & 0xFFFFFF; - bitmap.recycle(); + if (!(drawable instanceof BitmapDrawable)) { + bitmap.recycle(); + } } return color;