Merge "NearbyFastPairProviderSimulatorApp: Only set BR/EDR IOCapability"

This commit is contained in:
David Duarte 2023-04-19 15:31:41 +00:00 • committed by Gerrit Code Review
commit 94334d6d80
2 changed files with 5 additions and 16 deletions

View file

@ -657,9 +657,7 @@ public class MainActivity extends Activity {
int desiredIoCapability = getIoCapabilityFromModelId(modelId);
mBluetoothController.setIoCapability(
/*ioCapabilityClassic=*/ desiredIoCapability,
/*ioCapabilityBLE=*/ desiredIoCapability);
mBluetoothController.setIoCapability(desiredIoCapability);
runOnUiThread(() -> {
updateStringStatusView(
@ -950,9 +948,7 @@ public class MainActivity extends Activity {
}
// Recover the IO capability.
mBluetoothController.setIoCapability(
/*ioCapabilityClassic=*/ IO_CAPABILITY_IO, /*ioCapabilityBLE=*/
IO_CAPABILITY_KBDISP);
mBluetoothController.setIoCapability(IO_CAPABILITY_IO);
super.onDestroy();
}

View file

@ -50,23 +50,16 @@ class BluetoothController(
}
/**
* Sets the Input/Output capability of the device for both classic Bluetooth and BLE operations.
* Sets the Input/Output capability of the device for classic Bluetooth operations.
* Note: In order to let changes take effect, this method will make sure the Bluetooth stack is
* restarted by blocking calling thread.
*
* @param ioCapabilityClassic One of {@link #IO_CAPABILITY_IO}, {@link #IO_CAPABILITY_NONE},
* ```
* {@link #IO_CAPABILITY_KBDISP} or more in {@link BluetoothAdapter}.
* @param ioCapabilityBLE
* ```
* One of {@link #IO_CAPABILITY_IO}, {@link #IO_CAPABILITY_NONE}, {@link
* ```
* #IO_CAPABILITY_KBDISP} or more in {@link BluetoothAdapter}.
* ```
*/
fun setIoCapability(ioCapabilityClassic: Int, ioCapabilityBLE: Int) {
fun setIoCapability(ioCapabilityClassic: Int) {
bluetoothAdapter.ioCapability = ioCapabilityClassic
bluetoothAdapter.leIoCapability = ioCapabilityBLE
// Toggling airplane mode on/off to restart Bluetooth stack and reset the BLE.
try {
@ -273,4 +266,4 @@ class BluetoothController(
private const val TURN_AIRPLANE_MODE_OFF = 0
private const val TURN_AIRPLANE_MODE_ON = 1
}
}
}