summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2015-07-08 16:52:37 -0700
committerRoshan Pius <rpius@google.com>2015-07-08 17:45:54 -0700
commit75c36b681e3331f4e60fa62abe4615c1ffc5b401 (patch)
tree9a4dbe9a5de9df490b475c389b908d1551d37d87 /telecomm
parent1ca6207a1ec5bf9c12027c4f09a4fe18bd3f825c (diff)
downloadframeworks_base-75c36b681e3331f4e60fa62abe4615c1ffc5b401.zip
frameworks_base-75c36b681e3331f4e60fa62abe4615c1ffc5b401.tar.gz
frameworks_base-75c36b681e3331f4e60fa62abe4615c1ffc5b401.tar.bz2
Correct the comparison done in removeAdapter.
Since addAdapter is storing the proxy binder objects in the adapter set, we need to compare the underlying binder objects when trying to remove the adapter from the adapter set. This was resulting in adapters accumulating in adapter set every time a RemoteService was created. BUG: 22062692 Change-Id: Ib9cc25a8b95622a524ed5a07d3ef56673669cd27
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapter.java15
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;
+ }
+ }
}
}