diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2017-05-23 16:25:54 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2017-05-23 16:26:22 -0700 |
commit | 9d1aa13a9738eaa47c419ec58ce793bf6d867bb3 (patch) | |
tree | ac9785d2f4d5ad0390ea3a568a35974e80e8d584 /src | |
parent | 8c26cec587cf811ebce69d2600ccc83f13755166 (diff) | |
download | android_packages_apps_Trebuchet-9d1aa13a9738eaa47c419ec58ce793bf6d867bb3.tar.gz android_packages_apps_Trebuchet-9d1aa13a9738eaa47c419ec58ce793bf6d867bb3.tar.bz2 android_packages_apps_Trebuchet-9d1aa13a9738eaa47c419ec58ce793bf6d867bb3.zip |
Some fixes in the compat implementation of wallpaper manager
Change-Id: I781fd520e812aaeaab42b8b765d7e7f2e64a96a1
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/compat/WallpaperManagerCompatVL.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/com/android/launcher3/compat/WallpaperManagerCompatVL.java b/src/com/android/launcher3/compat/WallpaperManagerCompatVL.java index b175f2113..34316644a 100644 --- a/src/com/android/launcher3/compat/WallpaperManagerCompatVL.java +++ b/src/com/android/launcher3/compat/WallpaperManagerCompatVL.java @@ -132,14 +132,15 @@ public class WallpaperManagerCompatVL extends WallpaperManagerCompat { String[] parts = value.split(","); Integer wallpaperId = Integer.parseInt(parts[1]); if (parts.length == 2) { + // There is no wallpaper color info present, eg when live wallpaper has no preview. return Pair.create(wallpaperId, null); } - SparseIntArray colors = new SparseIntArray((parts.length - 2) / 2); + SparseIntArray colorsToOccurrences = new SparseIntArray((parts.length - 2) / 2); for (int i = 2; i < parts.length; i += 2) { - colors.put(Integer.parseInt(parts[i]), Integer.parseInt(parts[i + 1])); + colorsToOccurrences.put(Integer.parseInt(parts[i]), Integer.parseInt(parts[i + 1])); } - return Pair.create(wallpaperId, new WallpaperColorsCompat(colors, false)); + return Pair.create(wallpaperId, new WallpaperColorsCompat(colorsToOccurrences, false)); } /** @@ -178,7 +179,7 @@ public class WallpaperManagerCompatVL extends WallpaperManagerCompat { if (requestedArea > MAX_WALLPAPER_EXTRACTION_AREA) { double areaRatio = - MAX_WALLPAPER_EXTRACTION_AREA / (double) requestedArea; + (double) requestedArea / MAX_WALLPAPER_EXTRACTION_AREA; double nearestPowOf2 = Math.floor(Math.log(areaRatio) / (2 * Math.log(2))); options.inSampleSize = (int) Math.pow(2, nearestPowOf2); |