Implement isEnabled in terms of getState
Bug: 145171640 Test: compile & check everything works normally Change-Id: I169e220ab83546d76317e518652c66c9bd2229a2
This commit is contained in:
@@ -830,18 +830,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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -613,22 +613,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() {
|
||||
|
||||
Reference in New Issue
Block a user