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

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