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

Commit fbe4f76f authored by Sungsoo Lim's avatar Sungsoo Lim Committed by Chris Manton
Browse files

Clear bonding initiated when all profile disabled

Bug: 208477588
Tag: #refactor
Test: atest CtsBluetoothTestCases bluetooth_test_gd_unit
Change-Id: I40e0751479e34b904500cecaebc3b2e7725bcf7e
parent daa7c0ef
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1097,7 +1097,7 @@ public class AdapterService extends Service {
     * @return true if any profile is enabled, false otherwise
     */
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)
    private boolean isAnyProfileEnabled(BluetoothDevice device) {
    boolean isAnyProfileEnabled(BluetoothDevice device) {

        if (mA2dpService != null && mA2dpService.getConnectionPolicy(device)
                > BluetoothProfile.CONNECTION_POLICY_FORBIDDEN) {
+6 −0
Original line number Diff line number Diff line
@@ -788,6 +788,12 @@ final class RemoteDevices {
            if (sAdapterService.getConnectionState(device) == 0) {
                resetBatteryLevel(device);
            }
            if (!sAdapterService.isAnyProfileEnabled(device)) {
                DeviceProperties deviceProp = getDeviceProperties(device);
                if (deviceProp != null) {
                    deviceProp.setBondingInitiatedLocally(false);
                }
            }
            debugLog(
                    "aclStateChangeCallback: Adapter State: " + BluetoothAdapter.nameForState(state)
                            + " Disconnected: " + device