summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjanardhana rao bokka <quic_jbokka@quicinc.com>2022-05-13 10:33:52 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2022-05-16 21:30:36 -0700
commit82a5be36a2e778c0eac36a25492988a421dd84ff (patch)
tree09f73ff29bfd79f9b374da7a2a85e9377343ef7c
parent2b4be04c720a95de52aed09fe81c9827a9acdcab (diff)
LE: Handling ANR related to stopAdvertisingSets
Handling ANR related to stopAdvertisingSets when binder to deathreceipt is NULL. Change-Id: If8d46bafdbbe3f106852e27caecddb4f043d6224
-rw-r--r--src/com/android/bluetooth/gatt/AdvertiseManager.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/bluetooth/gatt/AdvertiseManager.java b/src/com/android/bluetooth/gatt/AdvertiseManager.java
index 5963294fe..fa2c0d7c0 100644
--- a/src/com/android/bluetooth/gatt/AdvertiseManager.java
+++ b/src/com/android/bluetooth/gatt/AdvertiseManager.java
@@ -32,6 +32,7 @@ import com.android.bluetooth.btservice.AdapterService;
import java.util.Collections;
import java.util.HashMap;
+import java.util.NoSuchElementException;
import java.util.Iterator;
import java.util.Map;
@@ -247,9 +248,13 @@ class AdvertiseManager {
return;
}
- Integer advertiserId = adv.id;
- binder.unlinkToDeath(adv.deathRecipient, 0);
+ try {
+ binder.unlinkToDeath(adv.deathRecipient, 0);
+ } catch (NoSuchElementException e) {
+ Log.i(TAG, "stopAdvertisingSet() - link does not exist");
+ }
+ Integer advertiserId = adv.id;
if (advertiserId < 0) {
Log.i(TAG, "stopAdvertisingSet() - advertiser not finished registration yet");
// Advertiser will be freed once initiated in onAdvertisingSetStarted()
@@ -443,7 +448,11 @@ class AdvertiseManager {
Integer advertiser_id = entry.getValue().id;
IAdvertisingSetCallback callback = entry.getValue().callback;
IBinder binder = toBinder(callback);
- binder.unlinkToDeath(entry.getValue().deathRecipient, 0);
+ try {
+ binder.unlinkToDeath(entry.getValue().deathRecipient, 0);
+ } catch (NoSuchElementException e) {
+ Log.i(TAG, "stopAdvertisingSets() - link does not exist");
+ }
it.remove();
if (advertiser_id < 0) {