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

Commit c18cd05c authored by Hans Boehm's avatar Hans Boehm Committed by android-build-merger
Browse files

Merge "Remove NotificationVisibility storage pool" am: 24141e81 am: cd2a7fb3

am: 8e96fe2c

Change-Id: I48d179b2e44b55541a5fe7b89d2daa1f7eeb5dd4
parents 57e396c5 8e96fe2c
Loading
Loading
Loading
Loading
+1 −16
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import java.util.Collection;
public class NotificationVisibility implements Parcelable {
    private static final String TAG = "NoViz";
    private static final int MAX_POOL_SIZE = 25;
    private static ArrayDeque<NotificationVisibility> sPool = new ArrayDeque<>(MAX_POOL_SIZE);
    private static int sNexrId = 0;

    public String key;
@@ -119,11 +118,6 @@ public class NotificationVisibility implements Parcelable {
    }

    private static NotificationVisibility obtain() {
        synchronized (sPool) {
            if (!sPool.isEmpty()) {
                return sPool.poll();
            }
        }
        return new NotificationVisibility();
    }

@@ -135,16 +129,7 @@ public class NotificationVisibility implements Parcelable {
     * </p>
     */
    public void recycle() {
        if (key == null) {
            // do nothing on multiple recycles
            return;
        }
        key = null;
        if (sPool.size() < MAX_POOL_SIZE) {
            synchronized (sPool) {
                sPool.offer(this);
            }
        }
        // With a modern GC, this is no longer useful for objects this small.
    }

    /**