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

Commit b28fd0bb authored by Venkata Jagadeesh Garaga's avatar Venkata Jagadeesh Garaga Committed by Bruno Martins
Browse files

GAP: Reset bondingInitiatedLocally flag(1/3)



When Pairing initiated from DUT, bondingIinitiatedLocally
flag sets from adapterservice. If user disable profile
options from UI and tries to connect from remote,DUT
rejects the incoming connection, when dut rejects
connection some remotes may initiates pairing again.

Profile options should be in disable state after incoming
pairing successful as user disabled profile options, but
profile options getting enabled as bondingInitiatedLocally
not reset.

Hence Reset bondingInitiatedLocally flag after connection

 Conflicts:
	packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java

Change-Id: I612b0718fcc4f6aaeded112fee4cb51ad7f25772
CRs-Fixed: 2457374
Signed-off-by: default avatarVolodymyr Zhdanov <wight554@gmail.com>
parent be64cbb4
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1303,6 +1303,22 @@ public final class BluetoothDevice implements Parcelable {
        return false;
    }

    /** @hide */
    @UnsupportedAppUsage
    public void setBondingInitiatedLocally(boolean localInitiated) {
        final IBluetooth service = sService;
        if (service == null) {
            Log.w(TAG, "BT not enabled, setBondingInitiatedLocally failed");
            return;
        }
        try {
            service.setBondingInitiatedLocally(this, localInitiated);
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        }
        return;
    }

    /**
     * Set the Out Of Band data for a remote device to be used later
     * in the pairing mechanism. Users can obtain this data through other
+7 −2
Original line number Diff line number Diff line
@@ -737,12 +737,17 @@ public class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice>
        refresh();

        if (bondState == BluetoothDevice.BOND_BONDED) {
            boolean mIsBondingInitiatedLocally = mDevice.isBondingInitiatedLocally();
            Log.w(TAG, "mIsBondingInitiatedLocally" + mIsBondingInitiatedLocally);
            if (mIsBondingInitiatedLocally) {
                mDevice.setBondingInitiatedLocally(false);
            }
            if (mIsTwsConnectEnabled) {
                Log.d(TAG, "Initiating connection to" + mDevice);
                if (mDevice.isBondingInitiatedLocally() || mDevice.isTwsPlusDevice()) {
                if (mIsBondingInitiatedLocally || mDevice.isTwsPlusDevice()) {
                    connect();
                }
            } else if (mDevice.isBondingInitiatedLocally()) {
            } else if (mIsBondingInitiatedLocally) {
                connect();
            }
        }