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

Commit 3f13a29b authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Release bitmap object after task snapshot restore from disk." into main

parents 2ce08837 afc288f4
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -179,12 +179,6 @@ class AppSnapshotLoader {
                return null;
            }
            final HardwareBuffer buffer = hwBitmap.getHardwareBuffer();
            if (buffer == null) {
                Slog.w(TAG, "Failed to retrieve gralloc buffer for bitmap: "
                        + bitmapFile.getPath());
                return null;
            }

            final ComponentName topActivityComponent = ComponentName.unflattenFromString(
                    proto.topActivityComponent);

@@ -202,15 +196,17 @@ class AppSnapshotLoader {
                densityDpi = DisplayMetrics.DENSITY_DEVICE_STABLE;
            }

            return new TaskSnapshot(proto.id, SystemClock.elapsedRealtimeNanos(),
                    topActivityComponent, buffer, hwBitmap.getColorSpace(),
                    proto.orientation, proto.rotation, taskSize,
            final TaskSnapshot snapshot = new TaskSnapshot(proto.id,
                    SystemClock.elapsedRealtimeNanos(), topActivityComponent, buffer,
                    hwBitmap.getColorSpace(), proto.orientation, proto.rotation, taskSize,
                    new Rect(proto.insetLeft, proto.insetTop, proto.insetRight, proto.insetBottom),
                    new Rect(proto.letterboxInsetLeft, proto.letterboxInsetTop,
                            proto.letterboxInsetRight, proto.letterboxInsetBottom),
                    loadLowResolutionBitmap, proto.isRealSnapshot, proto.windowingMode,
                    proto.appearance, proto.isTranslucent, false /* hasImeSurface */, proto.uiMode,
                    densityDpi);
            hwBitmap.recycle();
            return snapshot;
        } catch (IOException e) {
            Slog.w(TAG, "Unable to load task snapshot data for Id=" + id);
            return null;