diff options
| author | Pavlin Radoslavov <pavlin@google.com> | 2016-05-24 15:28:41 -0700 |
|---|---|---|
| committer | Pavlin Radoslavov <pavlin@google.com> | 2016-05-24 22:57:14 +0000 |
| commit | 630c0a3a0748855515a6544da3380c12f83a619e (patch) | |
| tree | 31efee78867471ba2b01776b4098c6545f50e51b /framework/java/android/bluetooth/BluetoothAdapter.java | |
| parent | 6d126c81896c8956f36a162382815b121f3e2be1 (diff) | |
Add missing "try ... finally" safeguards
Safeguards for code protected by ReentrantReadWriteLock.
Bug: 28734075
Bug: 28799467
Change-Id: Ib7f598a92e8df6bd855ca48cdd094c1c73a935f2
Diffstat (limited to 'framework/java/android/bluetooth/BluetoothAdapter.java')
| -rw-r--r-- | framework/java/android/bluetooth/BluetoothAdapter.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/framework/java/android/bluetooth/BluetoothAdapter.java b/framework/java/android/bluetooth/BluetoothAdapter.java index 4c8657810c..9390bcd13d 100644 --- a/framework/java/android/bluetooth/BluetoothAdapter.java +++ b/framework/java/android/bluetooth/BluetoothAdapter.java @@ -2045,12 +2045,15 @@ public final class BluetoothAdapter { public void onBluetoothServiceDown() { if (VDBG) Log.d(TAG, "onBluetoothServiceDown: " + mService); - mServiceLock.writeLock().lock(); - mService = null; - if (mLeScanClients != null) mLeScanClients.clear(); - if (sBluetoothLeAdvertiser != null) sBluetoothLeAdvertiser.cleanup(); - if (sBluetoothLeScanner != null) sBluetoothLeScanner.cleanup(); - mServiceLock.writeLock().unlock(); + try { + mServiceLock.writeLock().lock(); + mService = null; + if (mLeScanClients != null) mLeScanClients.clear(); + if (sBluetoothLeAdvertiser != null) sBluetoothLeAdvertiser.cleanup(); + if (sBluetoothLeScanner != null) sBluetoothLeScanner.cleanup(); + } finally { + mServiceLock.writeLock().unlock(); + } synchronized (mProxyServiceStateCallbacks) { for (IBluetoothManagerCallback cb : mProxyServiceStateCallbacks ){ |
