Do not filter out some colors
Colors specified manually using the public WallpaperColors
constructor should not be blacklisted.
Test: runtest -x tests/Internal/src/android/app/WallpaperColorsTest.java
Test: runtest -x tests/Internal/src/com/android/internal/colorextraction/types/TonalTest.java
Change-Id: I96faf413e3629c247220d825bb7c3480ed2f1003
Fixes: 64361146
diff --git a/core/java/android/app/WallpaperColors.java b/core/java/android/app/WallpaperColors.java
index 2a8130f..a2864b9 100644
--- a/core/java/android/app/WallpaperColors.java
+++ b/core/java/android/app/WallpaperColors.java
@@ -49,7 +49,7 @@
* eg. A launcher may set its text color to black if this flag is specified.
* @hide
*/
- public static final int HINT_SUPPORTS_DARK_TEXT = 0x1;
+ public static final int HINT_SUPPORTS_DARK_TEXT = 1 << 0;
/**
* Specifies that dark theme is preferred over the current wallpaper for best presentation.
@@ -57,7 +57,13 @@
* eg. A launcher may set its drawer color to black if this flag is specified.
* @hide
*/
- public static final int HINT_SUPPORTS_DARK_THEME = 0x2;
+ public static final int HINT_SUPPORTS_DARK_THEME = 1 << 1;
+
+ /**
+ * Specifies that this object was generated by extracting colors from a bitmap.
+ * @hide
+ */
+ public static final int HINT_FROM_BITMAP = 1 << 2;
// Maximum size that a bitmap can have to keep our calculations sane
private static final int MAX_BITMAP_SIZE = 112;
@@ -180,13 +186,13 @@
}
}
- int hints = calculateHints(bitmap);
+ int hints = calculateDarkHints(bitmap);
if (shouldRecycle) {
bitmap.recycle();
}
- return new WallpaperColors(primary, secondary, tertiary, hints);
+ return new WallpaperColors(primary, secondary, tertiary, HINT_FROM_BITMAP | hints);
}
/**
@@ -348,7 +354,7 @@
* @param source What to read.
* @return Whether image supports dark text or not.
*/
- private static int calculateHints(Bitmap source) {
+ private static int calculateDarkHints(Bitmap source) {
if (source == null) {
return 0;
}