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

Commit 267faf03 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Bluetooth: Don't Initiate Connection if UUID not updated"

parents c2f10fc3 4b8ec1d8
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -544,7 +544,29 @@ final class CachedBluetoothDevice implements Comparable<CachedBluetoothDevice> {
     * Refreshes the UI when framework alerts us of a UUID change.
     */
    void onUuidChanged() {
        Log.d(TAG, " onUuidChanged, mProfile Size " + mProfiles.size());
        List<LocalBluetoothProfile> mPrevProfiles =
                new ArrayList<LocalBluetoothProfile>();
        mPrevProfiles.clear();
        mPrevProfiles.addAll(mProfiles);
        updateProfiles();
        /*
         * Check if new profiles are added
         */
        if ((mPrevProfiles.containsAll(mProfiles)) && (!mPrevProfiles.isEmpty())) {
            Log.d(TAG,"UUID not udpated, returning");
            mProfiles.clear();
            mProfiles.addAll(mPrevProfiles);
            return;
        }
        for (int i = 0; i<mProfiles.size(); ++i) {
            if (!mPrevProfiles.contains(mProfiles.get(i))) {
                mPrevProfiles.add(mProfiles.get(i));
            }
        }
        mProfiles.clear();
        mProfiles.addAll(mPrevProfiles);

        ParcelUuid[] uuids = mDevice.getUuids();
        long timeout = MAX_UUID_DELAY_FOR_AUTO_CONNECT;
        if (DEBUG){