Loading core/java/android/bluetooth/BluetoothAdapter.java +5 −11 Original line number Original line Diff line number Diff line Loading @@ -789,19 +789,13 @@ public final class BluetoothAdapter { public boolean enableBLE() { public boolean enableBLE() { if (!isBleScanAlwaysAvailable()) return false; if (!isBleScanAlwaysAvailable()) return false; if (isLeEnabled() == true) { if (DBG) Log.d(TAG, "enableBLE(): BT is already enabled..!"); try { try { mManagerService.updateBleAppCount(mToken, true); mManagerService.updateBleAppCount(mToken, true); } catch (RemoteException e) { if (isLeEnabled()) { Log.e(TAG, "", e); if (DBG) Log.d(TAG, "enableBLE(): Bluetooth already enabled"); } return true; return true; } } if (DBG) Log.d(TAG, "enableBLE(): Calling enable"); try { if (DBG) Log.d(TAG, "Calling enableBLE"); mManagerService.updateBleAppCount(mToken, true); return mManagerService.enable(ActivityThread.currentPackageName()); return mManagerService.enable(ActivityThread.currentPackageName()); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "", e); Log.e(TAG, "", e); Loading services/core/java/com/android/server/BluetoothManagerService.java +8 −2 Original line number Original line Diff line number Diff line Loading @@ -222,6 +222,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { mBluetoothLock.readLock().lock(); mBluetoothLock.readLock().lock(); if (mBluetooth != null) { if (mBluetooth != null) { mBluetooth.onBrEdrDown(); mBluetooth.onBrEdrDown(); mEnable = false; mEnableExternal = false; mEnableExternal = false; } } } catch (RemoteException e) { } catch (RemoteException e) { Loading Loading @@ -465,7 +466,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub { if (DBG) Slog.d(TAG, "Disabling LE only mode after application crash"); if (DBG) Slog.d(TAG, "Disabling LE only mode after application crash"); try { try { mBluetoothLock.readLock().lock(); mBluetoothLock.readLock().lock(); if (mBluetooth != null) { if (mBluetooth != null && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { mEnable = false; mBluetooth.onBrEdrDown(); mBluetooth.onBrEdrDown(); } } } catch (RemoteException e) { } catch (RemoteException e) { Loading @@ -482,6 +485,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub { @Override @Override public boolean isBleScanAlwaysAvailable() { public boolean isBleScanAlwaysAvailable() { if (isAirplaneModeOn() && !mEnable) { return false; } try { try { return (Settings.Global.getInt(mContentResolver, return (Settings.Global.getInt(mContentResolver, Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE)) != 0; Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE)) != 0; Loading Loading
core/java/android/bluetooth/BluetoothAdapter.java +5 −11 Original line number Original line Diff line number Diff line Loading @@ -789,19 +789,13 @@ public final class BluetoothAdapter { public boolean enableBLE() { public boolean enableBLE() { if (!isBleScanAlwaysAvailable()) return false; if (!isBleScanAlwaysAvailable()) return false; if (isLeEnabled() == true) { if (DBG) Log.d(TAG, "enableBLE(): BT is already enabled..!"); try { try { mManagerService.updateBleAppCount(mToken, true); mManagerService.updateBleAppCount(mToken, true); } catch (RemoteException e) { if (isLeEnabled()) { Log.e(TAG, "", e); if (DBG) Log.d(TAG, "enableBLE(): Bluetooth already enabled"); } return true; return true; } } if (DBG) Log.d(TAG, "enableBLE(): Calling enable"); try { if (DBG) Log.d(TAG, "Calling enableBLE"); mManagerService.updateBleAppCount(mToken, true); return mManagerService.enable(ActivityThread.currentPackageName()); return mManagerService.enable(ActivityThread.currentPackageName()); } catch (RemoteException e) { } catch (RemoteException e) { Log.e(TAG, "", e); Log.e(TAG, "", e); Loading
services/core/java/com/android/server/BluetoothManagerService.java +8 −2 Original line number Original line Diff line number Diff line Loading @@ -222,6 +222,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { mBluetoothLock.readLock().lock(); mBluetoothLock.readLock().lock(); if (mBluetooth != null) { if (mBluetooth != null) { mBluetooth.onBrEdrDown(); mBluetooth.onBrEdrDown(); mEnable = false; mEnableExternal = false; mEnableExternal = false; } } } catch (RemoteException e) { } catch (RemoteException e) { Loading Loading @@ -465,7 +466,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub { if (DBG) Slog.d(TAG, "Disabling LE only mode after application crash"); if (DBG) Slog.d(TAG, "Disabling LE only mode after application crash"); try { try { mBluetoothLock.readLock().lock(); mBluetoothLock.readLock().lock(); if (mBluetooth != null) { if (mBluetooth != null && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { mEnable = false; mBluetooth.onBrEdrDown(); mBluetooth.onBrEdrDown(); } } } catch (RemoteException e) { } catch (RemoteException e) { Loading @@ -482,6 +485,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub { @Override @Override public boolean isBleScanAlwaysAvailable() { public boolean isBleScanAlwaysAvailable() { if (isAirplaneModeOn() && !mEnable) { return false; } try { try { return (Settings.Global.getInt(mContentResolver, return (Settings.Global.getInt(mContentResolver, Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE)) != 0; Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE)) != 0; Loading