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

Commit ba4eba6c authored by Wu Ahan's avatar Wu Ahan
Browse files

Close ParcelFileDesciptor properly

We missed closing ParcelFileDescriptor, so close it.

Bug: 200947065
Test: Manually
Change-Id: If8ee9153898801f7c57cecebbc79e0cad611efc4
parent 4b55fab5
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.