diff options
author | Chienyuan <chienyuanhuang@google.com> | 2018-12-18 10:40:25 +0800 |
---|---|---|
committer | Chienyuan <chienyuanhuang@google.com> | 2018-12-18 10:40:25 +0800 |
commit | 4554d5a132649aad6f14e224d3c9e29e73f23985 (patch) | |
tree | 88a8d80d0a5c2b00f1d820c783c2157e3f9799fe /service/java/com/android/server/bluetooth/BluetoothManagerService.java | |
parent | 9ef032b089f5340abc204ee26091b459e636b810 (diff) |
BluetoothManagerService: catch NoSuchElementException for unlinkToDeath
linkToDeath fail will cause NoSuchElementException when following
unlinkToDeath, add try catch to handle it.
Bug: 121104808
Test: build pass
Change-Id: Idc4959331841946e2fc099bdc0fab7c753caf369
Diffstat (limited to 'service/java/com/android/server/bluetooth/BluetoothManagerService.java')
-rw-r--r-- | service/java/com/android/server/bluetooth/BluetoothManagerService.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/service/java/com/android/server/bluetooth/BluetoothManagerService.java b/service/java/com/android/server/bluetooth/BluetoothManagerService.java index 49de4b1577..555e89947a 100644 --- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java +++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java @@ -76,6 +76,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.Locale; import java.util.Map; +import java.util.NoSuchElementException; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReentrantReadWriteLock; @@ -1279,7 +1280,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub { if (mService == null) { return; } - mService.unlinkToDeath(this, 0); + try { + mService.unlinkToDeath(this, 0); + } catch (NoSuchElementException e) { + Log.e(TAG, "error unlinking to death", e); + } mService = null; mClassName = null; |