diff options
author | Roshan Pius <rpius@google.com> | 2015-07-10 17:10:30 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-07-10 17:10:30 +0000 |
commit | 0eb4da607118e28d56d18ff1bd1f060b0431c61c (patch) | |
tree | 8901284abc3e99257958086803bebf1894797b1e /telecomm | |
parent | 0bac7fa791ced8e1e1ab67eca72c48be1b19eded (diff) | |
parent | 1cb0de17a9a4de137247f7bf69ec44a83e30efa2 (diff) | |
download | frameworks_base-0eb4da607118e28d56d18ff1bd1f060b0431c61c.zip frameworks_base-0eb4da607118e28d56d18ff1bd1f060b0431c61c.tar.gz frameworks_base-0eb4da607118e28d56d18ff1bd1f060b0431c61c.tar.bz2 |
am 1cb0de17: Merge "Correct the comparison done in removeAdapter." into mnc-dev
* commit '1cb0de17a9a4de137247f7bf69ec44a83e30efa2':
Correct the comparison done in removeAdapter.
Diffstat (limited to 'telecomm')
-rw-r--r-- | telecomm/java/android/telecom/ConnectionServiceAdapter.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java index 4ab9ee5..4562514 100644 --- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java +++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java @@ -48,6 +48,12 @@ final class ConnectionServiceAdapter implements DeathRecipient { } 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)) { try { adapter.asBinder().linkToDeath(this, 0); @@ -58,8 +64,13 @@ final class ConnectionServiceAdapter implements DeathRecipient { } void removeAdapter(IConnectionServiceAdapter adapter) { - if (adapter != null && mAdapters.remove(adapter)) { - adapter.asBinder().unlinkToDeath(this, 0); + if (adapter != null) { + for (IConnectionServiceAdapter it : mAdapters) { + if (it.asBinder() == adapter.asBinder() && mAdapters.remove(it)) { + adapter.asBinder().unlinkToDeath(this, 0); + break; + } + } } } |