wm: recycle bitmaps immediately in TaskSnapshotPersister

Bitmap created in TaskSnapshotPersister are very short lived and
shouldn't be left around in the Java heap.

Test: boot, switch apps, works
bug 117795621

Merged-in: I4b5e0db50c2b7adaa71cb0d22535c1b37c7523e8
Change-Id: I4b5e0db50c2b7adaa71cb0d22535c1b37c7523e8
This commit is contained in:
Tim Murray
2018-10-15 16:50:23 -07:00
parent 535fae32e5
commit 9b4eaf7409

View File

@@ -360,6 +360,7 @@ class TaskSnapshotPersister {
// For snapshots with reduced resolution, do not create or save full sized bitmaps
if (mSnapshot.isReducedResolution()) {
swBitmap.recycle();
return true;
}
@@ -372,6 +373,8 @@ class TaskSnapshotPersister {
Slog.e(TAG, "Unable to open " + file + " for persisting.", e);
return false;
}
reduced.recycle();
swBitmap.recycle();
return true;
}
}