Loading service/src/com/android/server/bluetooth/BluetoothManagerService.java +5 −46 Original line number Diff line number Diff line Loading @@ -491,16 +491,7 @@ class BluetoothManagerService { } } int st = STATE_OFF; try { mBluetoothLock.readLock().lock(); st = synchronousGetState(); } catch (RemoteException | TimeoutException e) { Log.e(TAG, "Unable to call getState", e); return; } finally { mBluetoothLock.readLock().unlock(); } int st = mState.get(); Log.d( TAG, Loading Loading @@ -1026,14 +1017,6 @@ class BluetoothManagerService { return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } @GuardedBy("mBluetoothLock") private int synchronousGetState() throws RemoteException, TimeoutException { if (mBluetooth == null) return STATE_OFF; final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); mBluetooth.getState(recv); return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(STATE_OFF); } @GuardedBy("mBluetoothLock") private void synchronousOnBrEdrDown(AttributionSource attributionSource) throws RemoteException, TimeoutException { Loading Loading @@ -1111,17 +1094,7 @@ class BluetoothManagerService { } int getState() { mBluetoothLock.readLock().lock(); try { if (mBluetooth != null) { return synchronousGetState(); } } catch (RemoteException | TimeoutException e) { Log.e(TAG, "getState()", e); } finally { mBluetoothLock.readLock().unlock(); } return STATE_OFF; return mState.get(); } class ClientDeathRecipient implements IBinder.DeathRecipient { Loading Loading @@ -1209,14 +1182,12 @@ class BluetoothManagerService { private void disableBleScanMode() { mBluetoothLock.writeLock().lock(); try { if (mBluetooth != null && synchronousGetState() != STATE_ON) { if (mBluetooth != null && mState.oneOf(STATE_ON)) { if (DBG) { Log.d(TAG, "Resetting the mEnable flag for clean disable"); } mEnable = false; } } catch (RemoteException | TimeoutException e) { Log.e(TAG, "getState()", e); } finally { mBluetoothLock.writeLock().unlock(); } Loading Loading @@ -1765,18 +1736,7 @@ class BluetoothManagerService { } private boolean bindService(int rebindCount) { int state = STATE_OFF; try { mBluetoothLock.readLock().lock(); state = synchronousGetState(); } catch (RemoteException | TimeoutException e) { Log.e(TAG, "Unable to call getState", e); return false; } finally { mBluetoothLock.readLock().unlock(); } if (state != STATE_ON) { if (!mState.oneOf(STATE_ON)) { if (DBG) { Log.d(TAG, "Unable to bindService while Bluetooth is disabled"); } Loading Loading @@ -2138,8 +2098,7 @@ class BluetoothManagerService { try { if (mBluetooth != null) { boolean isHandled = true; int state = synchronousGetState(); switch (state) { switch (mState.get()) { case STATE_BLE_ON: if (isBle == 1) { Log.i(TAG, "Already at BLE_ON State"); Loading Loading
service/src/com/android/server/bluetooth/BluetoothManagerService.java +5 −46 Original line number Diff line number Diff line Loading @@ -491,16 +491,7 @@ class BluetoothManagerService { } } int st = STATE_OFF; try { mBluetoothLock.readLock().lock(); st = synchronousGetState(); } catch (RemoteException | TimeoutException e) { Log.e(TAG, "Unable to call getState", e); return; } finally { mBluetoothLock.readLock().unlock(); } int st = mState.get(); Log.d( TAG, Loading Loading @@ -1026,14 +1017,6 @@ class BluetoothManagerService { return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(null); } @GuardedBy("mBluetoothLock") private int synchronousGetState() throws RemoteException, TimeoutException { if (mBluetooth == null) return STATE_OFF; final SynchronousResultReceiver<Integer> recv = SynchronousResultReceiver.get(); mBluetooth.getState(recv); return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(STATE_OFF); } @GuardedBy("mBluetoothLock") private void synchronousOnBrEdrDown(AttributionSource attributionSource) throws RemoteException, TimeoutException { Loading Loading @@ -1111,17 +1094,7 @@ class BluetoothManagerService { } int getState() { mBluetoothLock.readLock().lock(); try { if (mBluetooth != null) { return synchronousGetState(); } } catch (RemoteException | TimeoutException e) { Log.e(TAG, "getState()", e); } finally { mBluetoothLock.readLock().unlock(); } return STATE_OFF; return mState.get(); } class ClientDeathRecipient implements IBinder.DeathRecipient { Loading Loading @@ -1209,14 +1182,12 @@ class BluetoothManagerService { private void disableBleScanMode() { mBluetoothLock.writeLock().lock(); try { if (mBluetooth != null && synchronousGetState() != STATE_ON) { if (mBluetooth != null && mState.oneOf(STATE_ON)) { if (DBG) { Log.d(TAG, "Resetting the mEnable flag for clean disable"); } mEnable = false; } } catch (RemoteException | TimeoutException e) { Log.e(TAG, "getState()", e); } finally { mBluetoothLock.writeLock().unlock(); } Loading Loading @@ -1765,18 +1736,7 @@ class BluetoothManagerService { } private boolean bindService(int rebindCount) { int state = STATE_OFF; try { mBluetoothLock.readLock().lock(); state = synchronousGetState(); } catch (RemoteException | TimeoutException e) { Log.e(TAG, "Unable to call getState", e); return false; } finally { mBluetoothLock.readLock().unlock(); } if (state != STATE_ON) { if (!mState.oneOf(STATE_ON)) { if (DBG) { Log.d(TAG, "Unable to bindService while Bluetooth is disabled"); } Loading Loading @@ -2138,8 +2098,7 @@ class BluetoothManagerService { try { if (mBluetooth != null) { boolean isHandled = true; int state = synchronousGetState(); switch (state) { switch (mState.get()) { case STATE_BLE_ON: if (isBle == 1) { Log.i(TAG, "Already at BLE_ON State"); Loading