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

Commit 23755a67 authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Android (Google) Code Review
Browse files

Merge "Remove GATT context if client registration did not succeed" into lmp-mr1-dev

parents f40c3ef0 46c7e486
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -133,6 +133,23 @@ import java.util.UUID;
        }
    }

    /**
     * Remove the context for a given UUID
     */
    void remove(UUID uuid) {
        synchronized (mApps) {
            Iterator<App> i = mApps.iterator();
            while(i.hasNext()) {
                App entry = i.next();
                if (entry.uuid.equals(uuid)) {
                    entry.unlinkToDeath();
                    i.remove();
                    break;
                }
            }
        }
    }

    /**
     * Remove the context for a given application ID.
     */
+6 −2
Original line number Diff line number Diff line
@@ -638,8 +638,12 @@ public class GattService extends ProfileService {
        if (DBG) Log.d(TAG, "onClientRegistered() - UUID=" + uuid + ", clientIf=" + clientIf);
        ClientMap.App app = mClientMap.getByUuid(uuid);
        if (app != null) {
            if (status == 0) {
                app.id = clientIf;
                app.linkToDeath(new ClientDeathRecipient(clientIf));
            } else {
                mClientMap.remove(uuid);
            }
            app.callback.onClientRegistered(status, clientIf);
        }
    }