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

Commit c8ce398f authored by Kyle Horimoto's avatar Kyle Horimoto Committed by android-build-merger
Browse files

ContextMap: Remove connection references when an app is removed

am: 15ce1f78

Change-Id: Ief6374e50288b58108c816915798f8456f2611d2
parents 3edbd137 15ce1f78
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -190,6 +190,7 @@ import com.android.bluetooth.btservice.BluetoothProto;
            while (i.hasNext()) {
                App entry = i.next();
                if (entry.id == id) {
                    removeConnectionsByAppId(id);
                    entry.unlinkToDeath();
                    entry.appScanStats.isRegistered = false;
                    i.remove();
@@ -227,6 +228,19 @@ import com.android.bluetooth.btservice.BluetoothProto;
        }
    }

    /**
     * Remove all connections for a given application ID.
     */
    void removeConnectionsByAppId(int appId) {
        Iterator<Connection> i = mConnections.iterator();
        while (i.hasNext()) {
            Connection connection = i.next();
            if (connection.appId == appId) {
                i.remove();
            }
        }
    }

    /**
     * Get an application context by ID.
     */