Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b1cde220 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Close ParcelFileDesciptor properly" into sc-v2-dev am: bae76ba7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16084831

Change-Id: Ifc4e740a0b1576a7ae615d1b296aa2b3456ecd11
parents 17ddd9db bae76ba7
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -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.