From 600109cb79098824410c09ff7d4e70d75ba8809f Mon Sep 17 00:00:00 2001 From: Stanley Tng Date: Tue, 20 Mar 2018 16:54:27 -0700 Subject: [PATCH] Calls unlinkToDeath in binderDied to deregister When a registered BLE App unexpectedly dies and the binderDied callback is called, the unlinkToDeath is called to remove linkage. Also, refactor code to use an existing function. Test: Manual test by repeatedly killing the gms core process. Bug: 74076974 Change-Id: If47a534ecafe7fceae14f8cf8526987cabd279cd (cherry picked from commit 699f42e24658b74f4b869b10633e9f31a7a9d7a8) --- .../server/BluetoothManagerService.java | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index ae56cb92686ef..216794139c417 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -637,29 +637,10 @@ class BluetoothManagerService extends IBluetoothManager.Stub { IBinder token = entry.getKey(); ClientDeathRecipient deathRec = entry.getValue(); if (deathRec.equals(this)) { - mBleApps.remove(token); + updateBleAppCount(token, false, mPackageName); break; } } - - 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(); - } - } catch (RemoteException e) { - Slog.e(TAG, "Unable to call onBrEdrDown", e); - } finally { - mBluetoothLock.readLock().unlock(); - } } public String getPackageName() {