Merge changes from topic "cleanup-ble-app-list-at-death" into pi-dev

* changes:
  Calls unlinkToDeath in binderDied to deregister
  Remove BLE App entry from mBleApps list when App died
This commit is contained in:
TreeHugger Robot
2018-03-26 15:03:19 +00:00
committed by Android (Google) Code Review

View File

@@ -632,23 +632,14 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
if (DBG) {
Slog.d(TAG, "Binder is dead - unregister " + mPackageName);
}
if (isBleAppPresent()) {
// Nothing to do, another app is here.
return;
}
if (DBG) {
Slog.d(TAG, "Disabling LE only mode after application crash");
}
try {
mBluetoothLock.readLock().lock();
if (mBluetooth != null && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) {
mEnable = false;
mBluetooth.onBrEdrDown();
for (Map.Entry<IBinder, ClientDeathRecipient> entry : mBleApps.entrySet()) {
IBinder token = entry.getKey();
ClientDeathRecipient deathRec = entry.getValue();
if (deathRec.equals(this)) {
updateBleAppCount(token, false, mPackageName);
break;
}
} catch (RemoteException e) {
Slog.e(TAG, "Unable to call onBrEdrDown", e);
} finally {
mBluetoothLock.readLock().unlock();
}
}