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

Commit 2445841e authored by Makoto Onuki's avatar Makoto Onuki Committed by android-build-merger
Browse files

Merge "Don't retain a bitmap unnecessarily" into oc-mr1-dev

am: 8ede87de

Change-Id: I3bfdd696cfd7abb1cb9ff04d93b7ebe3953280c9
parents 51ba8c76 8ede87de
Loading
Loading
Loading
Loading
+93 −84
Original line number Diff line number Diff line
@@ -679,6 +679,16 @@ public class TaskPersister {
                }
                writeTaskIdsFiles();

                processNextItem();
            }
        }

        private void processNextItem() {
            // This part is extracted into a method so that the GC can clearly see the end of the
            // scope of the variable 'item'.  If this part was in the loop above, the last item
            // it processed would always "leak".
            // See https://b.corp.google.com/issues/64438652#comment7

            // If mNextWriteTime, then don't delay between each call to saveToXml().
            final WriteQueueItem item;
            synchronized (TaskPersister.this) {
@@ -725,7 +735,7 @@ public class TaskPersister {
                final String filePath = imageWriteQueueItem.mFilePath;
                if (!createParentDirectory(filePath)) {
                    Slog.e(TAG, "Error while creating images directory for file: " + filePath);
                        continue;
                    return;
                }
                final Bitmap bitmap = imageWriteQueueItem.mImage;
                if (DEBUG) Slog.d(TAG, "writing bitmap: filename=" + filePath);
@@ -778,4 +788,3 @@ public class TaskPersister {
        }
    }
}
}