summaryrefslogtreecommitdiffstats
path: root/src_ui_overrides
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2019-01-25 15:10:18 -0800
committerSunny Goyal <sunnygoyal@google.com>2019-01-29 11:29:52 -0800
commit8c48d8bea64b95916b18bd41a4fdb58d4d7477be (patch)
tree1a3538863bdb43b87eef0b1238d17ac908f045c5 /src_ui_overrides
parent9752705e92593adfb60568ac4d059cc776cfceaa (diff)
downloadandroid_packages_apps_Trebuchet-8c48d8bea64b95916b18bd41a4fdb58d4d7477be.tar.gz
android_packages_apps_Trebuchet-8c48d8bea64b95916b18bd41a4fdb58d4d7477be.tar.bz2
android_packages_apps_Trebuchet-8c48d8bea64b95916b18bd41a4fdb58d4d7477be.zip
Changing min sdk to 25
Change-Id: I0d28069967854357ca755bf25dec19d4979bdecf
Diffstat (limited to 'src_ui_overrides')
-rw-r--r--src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/WallpaperManagerCompatVL.java46
1 files changed, 21 insertions, 25 deletions
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/WallpaperManagerCompatVL.java b/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/WallpaperManagerCompatVL.java
index 680885943..500fdc360 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/WallpaperManagerCompatVL.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/dynamicui/WallpaperManagerCompatVL.java
@@ -44,7 +44,6 @@ import android.os.ParcelFileDescriptor;
import android.util.Log;
import android.util.Pair;
-import com.android.launcher3.Utilities;
import com.android.launcher3.icons.ColorExtractor;
import java.io.IOException;
@@ -61,6 +60,8 @@ public class WallpaperManagerCompatVL extends WallpaperManagerCompat {
private static final String ACTION_EXTRACTION_COMPLETE =
"com.android.launcher3.uioverrides.dynamicui.WallpaperManagerCompatVL.EXTRACTION_COMPLETE";
+ public static final int WALLPAPER_COMPAT_JOB_ID = 1;
+
private final ArrayList<OnColorsChangedListenerCompat> mListeners = new ArrayList<>();
private final Context mContext;
@@ -122,7 +123,7 @@ public class WallpaperManagerCompatVL extends WallpaperManagerCompat {
}
private void reloadColors() {
- JobInfo job = new JobInfo.Builder(Utilities.WALLPAPER_COMPAT_JOB_ID,
+ JobInfo job = new JobInfo.Builder(WALLPAPER_COMPAT_JOB_ID,
new ComponentName(mContext, ColorExtractionService.class))
.setMinimumLatency(0).build();
((JobScheduler) mContext.getSystemService(Context.JOB_SCHEDULER_SERVICE)).schedule(job);
@@ -137,9 +138,6 @@ public class WallpaperManagerCompatVL extends WallpaperManagerCompat {
}
private static final int getWallpaperId(Context context) {
- if (!Utilities.ATLEAST_NOUGAT) {
- return -1;
- }
return context.getSystemService(WallpaperManager.class).getWallpaperId(FLAG_SYSTEM);
}
@@ -215,27 +213,25 @@ public class WallpaperManagerCompatVL extends WallpaperManagerCompat {
// For live wallpaper, extract colors from thumbnail
drawable = info.loadThumbnail(getPackageManager());
} else {
- if (Utilities.ATLEAST_NOUGAT) {
- try (ParcelFileDescriptor fd = wm.getWallpaperFile(FLAG_SYSTEM)) {
- BitmapRegionDecoder decoder = BitmapRegionDecoder
- .newInstance(fd.getFileDescriptor(), false);
-
- int requestedArea = decoder.getWidth() * decoder.getHeight();
- BitmapFactory.Options options = new BitmapFactory.Options();
-
- if (requestedArea > MAX_WALLPAPER_EXTRACTION_AREA) {
- double areaRatio =
- (double) requestedArea / MAX_WALLPAPER_EXTRACTION_AREA;
- double nearestPowOf2 =
- Math.floor(Math.log(areaRatio) / (2 * Math.log(2)));
- options.inSampleSize = (int) Math.pow(2, nearestPowOf2);
- }
- Rect region = new Rect(0, 0, decoder.getWidth(), decoder.getHeight());
- bitmap = decoder.decodeRegion(region, options);
- decoder.recycle();
- } catch (IOException | NullPointerException e) {
- Log.e(TAG, "Fetching partial bitmap failed, trying old method", e);
+ try (ParcelFileDescriptor fd = wm.getWallpaperFile(FLAG_SYSTEM)) {
+ BitmapRegionDecoder decoder = BitmapRegionDecoder
+ .newInstance(fd.getFileDescriptor(), false);
+
+ int requestedArea = decoder.getWidth() * decoder.getHeight();
+ BitmapFactory.Options options = new BitmapFactory.Options();
+
+ if (requestedArea > MAX_WALLPAPER_EXTRACTION_AREA) {
+ double areaRatio =
+ (double) requestedArea / MAX_WALLPAPER_EXTRACTION_AREA;
+ double nearestPowOf2 =
+ Math.floor(Math.log(areaRatio) / (2 * Math.log(2)));
+ options.inSampleSize = (int) Math.pow(2, nearestPowOf2);
}
+ Rect region = new Rect(0, 0, decoder.getWidth(), decoder.getHeight());
+ bitmap = decoder.decodeRegion(region, options);
+ decoder.recycle();
+ } catch (IOException | NullPointerException e) {
+ Log.e(TAG, "Fetching partial bitmap failed, trying old method", e);
}
if (bitmap == null) {
drawable = wm.getDrawable();