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: I2f3337ad417567ea3b4dea3eb004c60f96527c41
This commit is contained in:
Chienyuan
2018-12-17 21:31:40 +08:00
parent 6eaf48ea57
commit 2ea2b16824

View File

@@ -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;
@@ -1259,7 +1260,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;