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

Commit 11d8a6ef authored by Sudheer Shanka's avatar Sudheer Shanka Committed by Android (Google) Code Review
Browse files

Merge "Update BlobStoreMS to use LongSparseArray.removeIf(Predicate)."

parents e864e970 4acba54d
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -858,12 +858,9 @@ public class BlobStoreManagerService extends SystemService {
        writeBlobsInfoAsync();

        // Cleanup any stale sessions.
        final ArrayList<Integer> indicesToRemove = new ArrayList<>();
        for (int i = 0, userCount = mSessions.size(); i < userCount; ++i) {
            final LongSparseArray<BlobStoreSession> userSessions = mSessions.valueAt(i);
            indicesToRemove.clear();
            for (int j = 0, sessionsCount = userSessions.size(); j < sessionsCount; ++j) {
                final BlobStoreSession blobStoreSession = userSessions.valueAt(j);
            userSessions.removeIf((sessionId, blobStoreSession) -> {
                boolean shouldRemove = false;

                // Cleanup sessions which haven't been modified in a while.
@@ -880,13 +877,10 @@ public class BlobStoreManagerService extends SystemService {
                if (shouldRemove) {
                    blobStoreSession.getSessionFile().delete();
                    mActiveBlobIds.remove(blobStoreSession.getSessionId());
                    indicesToRemove.add(j);
                    deletedBlobIds.add(blobStoreSession.getSessionId());
                }
            }
            for (int j = 0; j < indicesToRemove.size(); ++j) {
                userSessions.removeAt(indicesToRemove.get(j));
            }
                return shouldRemove;
            });
        }
        if (LOGV) {
            Slog.v(TAG, "Completed idle maintenance; deleted "