summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/app/WallpaperManager.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java
index b570ae60ee91..11c01e61911c 100644
--- a/core/java/android/app/WallpaperManager.java
+++ b/core/java/android/app/WallpaperManager.java
@@ -586,12 +586,12 @@ public class WallpaperManager {
Rect dimensions = null;
synchronized (this) {
+ ParcelFileDescriptor pfd = null;
try {
Bundle params = new Bundle();
+ pfd = mService.getWallpaperWithFeature(context.getOpPackageName(),
+ context.getAttributionTag(), this, FLAG_SYSTEM, params, userId);
// Let's peek user wallpaper first.
- ParcelFileDescriptor pfd = mService.getWallpaperWithFeature(
- context.getOpPackageName(), context.getAttributionTag(), this,
- FLAG_SYSTEM, params, userId);
if (pfd != null) {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
@@ -600,6 +600,13 @@ public class WallpaperManager {
}
} catch (RemoteException ex) {
Log.w(TAG, "peek wallpaper dimensions failed", ex);
+ } finally {
+ if (pfd != null) {
+ try {
+ pfd.close();
+ } catch (IOException ignored) {
+ }
+ }
}
}
// If user wallpaper is unavailable, may be the default one instead.