Loading android/app/aidl/android/bluetooth/IBluetooth.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -225,8 +225,8 @@ interface IBluetooth @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") oneway void requestActivityInfo(in IBluetoothActivityEnergyInfoListener listener, in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") oneway void startBrEdr(in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)") oneway void bleOnToOn(in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)") oneway void bleOnToOff(in AttributionSource attributionSource); Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +4 −5 Original line number Diff line number Diff line Loading @@ -3807,17 +3807,16 @@ public class AdapterService extends Service { } @Override public void startBrEdr(AttributionSource source) { public void bleOnToOn(AttributionSource source) { AdapterService service = getService(); if (service == null || !callerIsSystemOrActiveOrManagedUser(service, TAG, "startBrEdr") || !Utils.checkConnectPermissionForDataDelivery(service, source, TAG)) { || !callerIsSystemOrActiveOrManagedUser(service, TAG, "bleOnToOn")) { return; } service.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, null); service.startBrEdr(); service.bleOnToOn(); } @Override Loading Loading @@ -5776,7 +5775,7 @@ public class AdapterService extends Service { } @VisibleForTesting void startBrEdr() { void bleOnToOn() { mAdapterStateMachine.sendMessage(AdapterState.USER_TURN_ON); } Loading android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -486,7 +486,7 @@ public class AdapterServiceTest { offToBleOn(looper, gattService, adapter, ctx, callback, nativeInterface); adapter.startBrEdr(); adapter.bleOnToOn(); TestUtils.syncHandler(looper, AdapterState.USER_TURN_ON); verifyStateChange(callback, STATE_BLE_ON, STATE_TURNING_ON); Loading Loading @@ -766,7 +766,7 @@ public class AdapterServiceTest { assertThat(mAdapterService.getBluetoothScan()).isNotNull(); assertThat(mAdapterService.getBluetoothGatt()).isNull(); mAdapterService.startBrEdr(); mAdapterService.bleOnToOn(); TestUtils.syncHandler(mLooper, AdapterState.USER_TURN_ON); verifyStateChange(callback, STATE_BLE_ON, STATE_TURNING_ON); Loading Loading @@ -823,7 +823,7 @@ public class AdapterServiceTest { mIBluetoothCallback, mNativeInterface); mAdapterService.startBrEdr(); mAdapterService.bleOnToOn(); syncHandler(AdapterState.USER_TURN_ON); verifyStateChange(STATE_BLE_ON, STATE_TURNING_ON); assertThat(mAdapterService.mSetProfileServiceStateCounter).isEqualTo(2); Loading service/src/AdapterBinder.kt +2 −2 Original line number Diff line number Diff line Loading @@ -59,8 +59,8 @@ class AdapterBinder(rawBinder: IBinder) { } @Throws(RemoteException::class) fun startBrEdr(source: AttributionSource) { adapterBinder.startBrEdr(source) fun bleOnToOn(source: AttributionSource) { adapterBinder.bleOnToOn(source) } @Throws(RemoteException::class) Loading service/src/com/android/server/bluetooth/BluetoothManagerService.java +15 −6 Original line number Diff line number Diff line Loading @@ -1069,13 +1069,11 @@ class BluetoothManagerService { if (isBluetoothPersistedStateOnBluetooth() || !isBleAppPresent()) { Log.i(TAG, "continueFromBleOnState: Starting br edr"); // This triggers transition to STATE_ON mAdapter.startBrEdr(mContext.getAttributionSource()); bleOnToOn(); setBluetoothPersistedState(BLUETOOTH_ON_BLUETOOTH); } else { Log.i(TAG, "continueFromBleOnState: Staying in BLE_ON"); } } catch (RemoteException e) { Log.e(TAG, "Unable to call onServiceUp", e); } finally { mAdapterLock.readLock().unlock(); } Loading Loading @@ -1907,7 +1905,7 @@ class BluetoothManagerService { Log.i(TAG, "Already at BLE_ON State"); } else { Log.w(TAG, "BT Enable in BLE_ON State, going to ON"); mAdapter.startBrEdr(mContext.getAttributionSource()); bleOnToOn(); } break; case STATE_BLE_TURNING_ON: Loading @@ -1921,8 +1919,6 @@ class BluetoothManagerService { } if (isHandled) return; } } catch (RemoteException e) { Log.e(TAG, "", e); } finally { mAdapterLock.readLock().unlock(); } Loading Loading @@ -2036,6 +2032,19 @@ class BluetoothManagerService { } } private void bleOnToOn() { if (!mState.oneOf(STATE_BLE_ON)) { Log.d(TAG, "bleOnToOn: Impossible transition from " + mState); return; } Log.d(TAG, "bleOnToOn: sending request"); try { mAdapter.bleOnToOn(mContext.getAttributionSource()); } catch (RemoteException e) { Log.e(TAG, "Unable to call bleOnToOn()", e); } } private void bleOnToOff() { if (!mState.oneOf(STATE_BLE_ON)) { Log.d(TAG, "bleOnToOff: Impossible transition from " + mState); Loading Loading
android/app/aidl/android/bluetooth/IBluetooth.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -225,8 +225,8 @@ interface IBluetooth @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") oneway void requestActivityInfo(in IBluetoothActivityEnergyInfoListener listener, in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})") oneway void startBrEdr(in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)") oneway void bleOnToOn(in AttributionSource attributionSource); @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)") oneway void bleOnToOff(in AttributionSource attributionSource); Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +4 −5 Original line number Diff line number Diff line Loading @@ -3807,17 +3807,16 @@ public class AdapterService extends Service { } @Override public void startBrEdr(AttributionSource source) { public void bleOnToOn(AttributionSource source) { AdapterService service = getService(); if (service == null || !callerIsSystemOrActiveOrManagedUser(service, TAG, "startBrEdr") || !Utils.checkConnectPermissionForDataDelivery(service, source, TAG)) { || !callerIsSystemOrActiveOrManagedUser(service, TAG, "bleOnToOn")) { return; } service.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, null); service.startBrEdr(); service.bleOnToOn(); } @Override Loading Loading @@ -5776,7 +5775,7 @@ public class AdapterService extends Service { } @VisibleForTesting void startBrEdr() { void bleOnToOn() { mAdapterStateMachine.sendMessage(AdapterState.USER_TURN_ON); } Loading
android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java +3 −3 Original line number Diff line number Diff line Loading @@ -486,7 +486,7 @@ public class AdapterServiceTest { offToBleOn(looper, gattService, adapter, ctx, callback, nativeInterface); adapter.startBrEdr(); adapter.bleOnToOn(); TestUtils.syncHandler(looper, AdapterState.USER_TURN_ON); verifyStateChange(callback, STATE_BLE_ON, STATE_TURNING_ON); Loading Loading @@ -766,7 +766,7 @@ public class AdapterServiceTest { assertThat(mAdapterService.getBluetoothScan()).isNotNull(); assertThat(mAdapterService.getBluetoothGatt()).isNull(); mAdapterService.startBrEdr(); mAdapterService.bleOnToOn(); TestUtils.syncHandler(mLooper, AdapterState.USER_TURN_ON); verifyStateChange(callback, STATE_BLE_ON, STATE_TURNING_ON); Loading Loading @@ -823,7 +823,7 @@ public class AdapterServiceTest { mIBluetoothCallback, mNativeInterface); mAdapterService.startBrEdr(); mAdapterService.bleOnToOn(); syncHandler(AdapterState.USER_TURN_ON); verifyStateChange(STATE_BLE_ON, STATE_TURNING_ON); assertThat(mAdapterService.mSetProfileServiceStateCounter).isEqualTo(2); Loading
service/src/AdapterBinder.kt +2 −2 Original line number Diff line number Diff line Loading @@ -59,8 +59,8 @@ class AdapterBinder(rawBinder: IBinder) { } @Throws(RemoteException::class) fun startBrEdr(source: AttributionSource) { adapterBinder.startBrEdr(source) fun bleOnToOn(source: AttributionSource) { adapterBinder.bleOnToOn(source) } @Throws(RemoteException::class) Loading
service/src/com/android/server/bluetooth/BluetoothManagerService.java +15 −6 Original line number Diff line number Diff line Loading @@ -1069,13 +1069,11 @@ class BluetoothManagerService { if (isBluetoothPersistedStateOnBluetooth() || !isBleAppPresent()) { Log.i(TAG, "continueFromBleOnState: Starting br edr"); // This triggers transition to STATE_ON mAdapter.startBrEdr(mContext.getAttributionSource()); bleOnToOn(); setBluetoothPersistedState(BLUETOOTH_ON_BLUETOOTH); } else { Log.i(TAG, "continueFromBleOnState: Staying in BLE_ON"); } } catch (RemoteException e) { Log.e(TAG, "Unable to call onServiceUp", e); } finally { mAdapterLock.readLock().unlock(); } Loading Loading @@ -1907,7 +1905,7 @@ class BluetoothManagerService { Log.i(TAG, "Already at BLE_ON State"); } else { Log.w(TAG, "BT Enable in BLE_ON State, going to ON"); mAdapter.startBrEdr(mContext.getAttributionSource()); bleOnToOn(); } break; case STATE_BLE_TURNING_ON: Loading @@ -1921,8 +1919,6 @@ class BluetoothManagerService { } if (isHandled) return; } } catch (RemoteException e) { Log.e(TAG, "", e); } finally { mAdapterLock.readLock().unlock(); } Loading Loading @@ -2036,6 +2032,19 @@ class BluetoothManagerService { } } private void bleOnToOn() { if (!mState.oneOf(STATE_BLE_ON)) { Log.d(TAG, "bleOnToOn: Impossible transition from " + mState); return; } Log.d(TAG, "bleOnToOn: sending request"); try { mAdapter.bleOnToOn(mContext.getAttributionSource()); } catch (RemoteException e) { Log.e(TAG, "Unable to call bleOnToOn()", e); } } private void bleOnToOff() { if (!mState.oneOf(STATE_BLE_ON)) { Log.d(TAG, "bleOnToOff: Impossible transition from " + mState); Loading