Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0813a54e authored by Jack He's avatar Jack He Committed by David Duarte
Browse files

Battery: Only connect or disconnect BAS for BLE ACL link

* Restrict BAS usage to BLE only to avoid affecting BR/EDR link

Bug: 285628594
Test: none
(cherry picked from https://android-review.googlesource.com/q/commit:a10e36a11a0efbb5d417af5e8d4fb97bfe35ff78)
Merged-In: Id4f52a490938e8084ea3dc0c277cb4782c747ddd
Change-Id: Id4f52a490938e8084ea3dc0c277cb4782c747ddd
parent 0703acee
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -892,7 +892,9 @@ final class RemoteDevices {
                            break;
                        case AbstractionLayer.BT_PROPERTY_BDADDR:
                            deviceProperties.setAddress(val);
                            debugLog("Remote Address is:" + Utils.getRedactedAddressStringFromByte(val));
                            debugLog(
                                    "Remote Address is:"
                                            + Utils.getRedactedAddressStringFromByte(val));
                            break;
                        case AbstractionLayer.BT_PROPERTY_CLASS_OF_DEVICE:
                            final int newBluetoothClass = Utils.byteArrayToInt(val);
@@ -1103,7 +1105,7 @@ final class RemoteDevices {
                intent = new Intent(BluetoothAdapter.ACTION_BLE_ACL_CONNECTED);
            }
            BatteryService batteryService = BatteryService.getBatteryService();
            if (batteryService != null) {
            if (batteryService != null && transportLinkType == BluetoothDevice.TRANSPORT_LE) {
                batteryService.connectIfPossible(device);
            }
            SecurityLog.writeEvent(SecurityLog.TAG_BLUETOOTH_CONNECTION,
@@ -1139,7 +1141,8 @@ final class RemoteDevices {
                BatteryService batteryService = BatteryService.getBatteryService();
                if (batteryService != null
                        && batteryService.getConnectionState(device)
                        != BluetoothProfile.STATE_DISCONNECTED) {
                                != BluetoothProfile.STATE_DISCONNECTED
                        && transportLinkType == BluetoothDevice.TRANSPORT_LE) {
                    batteryService.disconnect(device);
                }
                resetBatteryLevel(device);