Loading core/java/android/bluetooth/BluetoothAdapter.java +1 −12 Original line number Diff line number Diff line Loading @@ -862,18 +862,7 @@ public final class BluetoothAdapter { */ @RequiresPermission(Manifest.permission.BLUETOOTH) public boolean isEnabled() { try { mServiceLock.readLock().lock(); if (mService != null) { return mService.isEnabled(); } } catch (RemoteException e) { Log.e(TAG, "", e); } finally { mServiceLock.readLock().unlock(); } return false; return getState() == BluetoothAdapter.STATE_ON; } /** Loading core/java/android/bluetooth/BluetoothDevice.java +3 −32 Original line number Diff line number Diff line Loading @@ -1131,20 +1131,7 @@ public final class BluetoothDevice implements Parcelable { */ @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) public boolean createBond() { final IBluetooth service = sService; if (service == null) { Log.e(TAG, "BT not enabled. Cannot create bond to Remote Device"); return false; } try { Log.i(TAG, "createBond() for device " + getAddress() + " called by pid: " + Process.myPid() + " tid: " + Process.myTid()); return service.createBond(this, TRANSPORT_AUTO); } catch (RemoteException e) { Log.e(TAG, "", e); } return false; return createBond(TRANSPORT_AUTO); } /** Loading @@ -1165,23 +1152,7 @@ public final class BluetoothDevice implements Parcelable { */ @UnsupportedAppUsage public boolean createBond(int transport) { final IBluetooth service = sService; if (service == null) { Log.e(TAG, "BT not enabled. Cannot create bond to Remote Device"); return false; } if (TRANSPORT_AUTO > transport || transport > TRANSPORT_LE) { throw new IllegalArgumentException(transport + " is not a valid Bluetooth transport"); } try { Log.i(TAG, "createBond() for device " + getAddress() + " called by pid: " + Process.myPid() + " tid: " + Process.myTid()); return service.createBond(this, transport); } catch (RemoteException e) { Log.e(TAG, "", e); } return false; return createBondOutOfBand(transport, null); } /** Loading Loading @@ -1209,7 +1180,7 @@ public final class BluetoothDevice implements Parcelable { return false; } try { return service.createBondOutOfBand(this, transport, oobData); return service.createBond(this, transport, oobData); } catch (RemoteException e) { Log.e(TAG, "", e); } Loading services/core/java/com/android/server/BluetoothManagerService.java +5 −32 Original line number Diff line number Diff line Loading @@ -614,22 +614,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } public boolean isEnabled() { if ((Binder.getCallingUid() != Process.SYSTEM_UID) && (!checkIfCallerIsForegroundUser())) { Slog.w(TAG, "isEnabled(): not allowed for non-active and non system user"); return false; } try { mBluetoothLock.readLock().lock(); if (mBluetooth != null) { return mBluetooth.isEnabled(); } } catch (RemoteException e) { Slog.e(TAG, "isEnabled()", e); } finally { mBluetoothLock.readLock().unlock(); } return false; return getState() == BluetoothAdapter.STATE_ON; } public int getState() { Loading Loading @@ -1796,15 +1781,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub { //Do enable request try { if (!mQuietEnable) { if (!mBluetooth.enable()) { if (!mBluetooth.enable(mQuietEnable)) { Slog.e(TAG, "IBluetooth.enable() returned false"); } } else { if (!mBluetooth.enableNoAutoConnect()) { Slog.e(TAG, "IBluetooth.enableNoAutoConnect() returned false"); } } } catch (RemoteException e) { Slog.e(TAG, "Unable to call enable()", e); } Loading Loading @@ -2078,15 +2057,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } else if (mBluetooth != null) { //Enable bluetooth try { if (!mQuietEnable) { if (!mBluetooth.enable()) { if (!mBluetooth.enable(mQuietEnable)) { Slog.e(TAG, "IBluetooth.enable() returned false"); } } else { if (!mBluetooth.enableNoAutoConnect()) { Slog.e(TAG, "IBluetooth.enableNoAutoConnect() returned false"); } } } catch (RemoteException e) { Slog.e(TAG, "Unable to call enable()", e); } Loading Loading
core/java/android/bluetooth/BluetoothAdapter.java +1 −12 Original line number Diff line number Diff line Loading @@ -862,18 +862,7 @@ public final class BluetoothAdapter { */ @RequiresPermission(Manifest.permission.BLUETOOTH) public boolean isEnabled() { try { mServiceLock.readLock().lock(); if (mService != null) { return mService.isEnabled(); } } catch (RemoteException e) { Log.e(TAG, "", e); } finally { mServiceLock.readLock().unlock(); } return false; return getState() == BluetoothAdapter.STATE_ON; } /** Loading
core/java/android/bluetooth/BluetoothDevice.java +3 −32 Original line number Diff line number Diff line Loading @@ -1131,20 +1131,7 @@ public final class BluetoothDevice implements Parcelable { */ @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN) public boolean createBond() { final IBluetooth service = sService; if (service == null) { Log.e(TAG, "BT not enabled. Cannot create bond to Remote Device"); return false; } try { Log.i(TAG, "createBond() for device " + getAddress() + " called by pid: " + Process.myPid() + " tid: " + Process.myTid()); return service.createBond(this, TRANSPORT_AUTO); } catch (RemoteException e) { Log.e(TAG, "", e); } return false; return createBond(TRANSPORT_AUTO); } /** Loading @@ -1165,23 +1152,7 @@ public final class BluetoothDevice implements Parcelable { */ @UnsupportedAppUsage public boolean createBond(int transport) { final IBluetooth service = sService; if (service == null) { Log.e(TAG, "BT not enabled. Cannot create bond to Remote Device"); return false; } if (TRANSPORT_AUTO > transport || transport > TRANSPORT_LE) { throw new IllegalArgumentException(transport + " is not a valid Bluetooth transport"); } try { Log.i(TAG, "createBond() for device " + getAddress() + " called by pid: " + Process.myPid() + " tid: " + Process.myTid()); return service.createBond(this, transport); } catch (RemoteException e) { Log.e(TAG, "", e); } return false; return createBondOutOfBand(transport, null); } /** Loading Loading @@ -1209,7 +1180,7 @@ public final class BluetoothDevice implements Parcelable { return false; } try { return service.createBondOutOfBand(this, transport, oobData); return service.createBond(this, transport, oobData); } catch (RemoteException e) { Log.e(TAG, "", e); } Loading
services/core/java/com/android/server/BluetoothManagerService.java +5 −32 Original line number Diff line number Diff line Loading @@ -614,22 +614,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } public boolean isEnabled() { if ((Binder.getCallingUid() != Process.SYSTEM_UID) && (!checkIfCallerIsForegroundUser())) { Slog.w(TAG, "isEnabled(): not allowed for non-active and non system user"); return false; } try { mBluetoothLock.readLock().lock(); if (mBluetooth != null) { return mBluetooth.isEnabled(); } } catch (RemoteException e) { Slog.e(TAG, "isEnabled()", e); } finally { mBluetoothLock.readLock().unlock(); } return false; return getState() == BluetoothAdapter.STATE_ON; } public int getState() { Loading Loading @@ -1796,15 +1781,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub { //Do enable request try { if (!mQuietEnable) { if (!mBluetooth.enable()) { if (!mBluetooth.enable(mQuietEnable)) { Slog.e(TAG, "IBluetooth.enable() returned false"); } } else { if (!mBluetooth.enableNoAutoConnect()) { Slog.e(TAG, "IBluetooth.enableNoAutoConnect() returned false"); } } } catch (RemoteException e) { Slog.e(TAG, "Unable to call enable()", e); } Loading Loading @@ -2078,15 +2057,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } else if (mBluetooth != null) { //Enable bluetooth try { if (!mQuietEnable) { if (!mBluetooth.enable()) { if (!mBluetooth.enable(mQuietEnable)) { Slog.e(TAG, "IBluetooth.enable() returned false"); } } else { if (!mBluetooth.enableNoAutoConnect()) { Slog.e(TAG, "IBluetooth.enableNoAutoConnect() returned false"); } } } catch (RemoteException e) { Slog.e(TAG, "Unable to call enable()", e); } Loading