Merge "Correct the comparison done in removeAdapter." into mnc-dev
This commit is contained in:
@@ -48,6 +48,12 @@ final class ConnectionServiceAdapter implements DeathRecipient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addAdapter(IConnectionServiceAdapter adapter) {
|
void addAdapter(IConnectionServiceAdapter adapter) {
|
||||||
|
for (IConnectionServiceAdapter it : mAdapters) {
|
||||||
|
if (it.asBinder() == adapter.asBinder()) {
|
||||||
|
Log.w(this, "Ignoring duplicate adapter addition.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (mAdapters.add(adapter)) {
|
if (mAdapters.add(adapter)) {
|
||||||
try {
|
try {
|
||||||
adapter.asBinder().linkToDeath(this, 0);
|
adapter.asBinder().linkToDeath(this, 0);
|
||||||
@@ -58,8 +64,13 @@ final class ConnectionServiceAdapter implements DeathRecipient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void removeAdapter(IConnectionServiceAdapter adapter) {
|
void removeAdapter(IConnectionServiceAdapter adapter) {
|
||||||
if (adapter != null && mAdapters.remove(adapter)) {
|
if (adapter != null) {
|
||||||
|
for (IConnectionServiceAdapter it : mAdapters) {
|
||||||
|
if (it.asBinder() == adapter.asBinder() && mAdapters.remove(it)) {
|
||||||
adapter.asBinder().unlinkToDeath(this, 0);
|
adapter.asBinder().unlinkToDeath(this, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user