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

Commit 68716e33 authored by Himanshu Rawat's avatar Himanshu Rawat Committed by Gerrit Code Review
Browse files

Merge changes I1432b4fc,I1e23f5d6 into main

* changes:
  Remove remove_bond_with_address_map flag
  Remove device properties after BOND_NONE is processed
parents c8df9a6a 0a3f1d88
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -489,6 +489,9 @@ final class BondStateMachine extends StateMachine {
            infoLog("Invalid bond state " + newState);
            return;
        }

        mRemoteDevices.onBondStateChange(device, newState);

        if (devProp != null) {
            oldState = devProp.getBondState();
        }
+0 −5
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ package com.android.bluetooth.btservice;
import android.bluetooth.OobData;
import android.bluetooth.UidTraffic;

import com.android.bluetooth.flags.Flags;

class JniCallbacks {

    private RemoteDevices mRemoteDevices;
@@ -68,9 +66,6 @@ class JniCallbacks {

    void bondStateChangeCallback(int status, byte[] address, int newState, int hciReason) {
        mBondStateMachine.bondStateChangeCallback(status, address, newState, hciReason);
        if (Flags.removeBondWithAddressMap()) {
            mRemoteDevices.onBondStateChange(address, newState);
        }
    }

    void addressConsolidateCallback(byte[] mainAddress, byte[] secondaryAddress) {
+9 −10
Original line number Diff line number Diff line
@@ -1140,7 +1140,7 @@ public class RemoteDevices {
                mAdapterService.sendBroadcast(
                        intent, BLUETOOTH_CONNECT, Utils.getTempBroadcastOptions().toBundle());
            } else if (device.getBondState() == BluetoothDevice.BOND_NONE) {
                removeAddressMapping(address);
                removeAddressMapping(Utils.getAddressStringFromByte(address));
            }
            if (state == BluetoothAdapter.STATE_ON || state == BluetoothAdapter.STATE_TURNING_OFF) {
                mAdapterService.notifyAclDisconnected(device, transportLinkType);
@@ -1223,21 +1223,20 @@ public class RemoteDevices {
        }
    }

    private void removeAddressMapping(byte[] address) {
        String key = Utils.getAddressStringFromByte(address);
    private void removeAddressMapping(String address) {
        synchronized (mDevices) {
            mDevices.remove(key);
            mDeviceQueue.remove(key); // Remove from LRU cache
            mDevices.remove(address);
            mDeviceQueue.remove(address); // Remove from LRU cache

            // Remove from dual mode device mappings
            mDualDevicesMap.values().remove(key);
            mDualDevicesMap.remove(key);
            mDualDevicesMap.values().remove(address);
            mDualDevicesMap.remove(address);
        }
    }

    void onBondStateChange(byte[] address, int newState) {
        if (newState == BluetoothDevice.BOND_NONE) {
            removeAddressMapping(address);
    void onBondStateChange(BluetoothDevice device, int newState) {
        if (Flags.removeAddressMapOnUnbond() && newState == BluetoothDevice.BOND_NONE) {
            removeAddressMapping(device.getAddress());
        }
    }

+0 −7
Original line number Diff line number Diff line
@@ -55,13 +55,6 @@ flag {
    bug: "321120941"
}

flag {
    name: "remove_bond_with_address_map"
    namespace: "bluetooth"
    description: "Removes the address map when the bond is removed"
    bug: "326603271"
}

flag {
    name: "remove_address_map_on_unbond"
    namespace: "bluetooth"