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

Commit 2408a923 authored by Omair Kamil's avatar Omair Kamil
Browse files

Update connections data structure in ContextMap to be an ArrayList.

It's currently a HashSet, but the stored type does not override the hashCode method. Objects are only added to the set immediately after being created, so there's not even deduplication based on internal address.

Bug: 327849650
Test: atest com.android.bluetooth.gatt.ContextMapTest
Flag: EXEMPT - no logic change
Change-Id: I1472f5b3065a0920dd8ece6b5c773d9cc314183f
parent 60c7e635
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -204,8 +204,9 @@ public class ContextMap<C, T> {
    private final EvictingQueue<AppAdvertiseStats> mLastAdvertises =
            EvictingQueue.create(ADVERTISE_STATE_MAX_SIZE);

    /** Internal list of connected devices **/
    private Set<Connection> mConnections = new HashSet<Connection>();
    /** Internal list of connected devices */
    private List<Connection> mConnections = new ArrayList<Connection>();

    private final Object mConnectionsLock = new Object();

    /** Add an entry to the application context list. */
@@ -384,9 +385,7 @@ public class ContextMap<C, T> {
        return app;
    }

    /**
     * Get an application context by the calling Apps name.
     */
    /** Get an application context by the calling Apps name. */
    public App getByName(String name) {
        App app = getAppByPredicate(entry -> entry.name.equals(name));
        if (app == null) {