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

Commit d8eec52a authored by Michael Chan's avatar Michael Chan
Browse files

b/2318290 connect should be called instead of connect(profile) if device is unpaired.

Change-Id: I5d665d1c3149ffc77387f96c3822e80b84c78de1
parent c0a606d2
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -459,19 +459,19 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli

        mPendingDevice = null;

        boolean callConnect = false;
        CachedBluetoothDevice cachedDevice = getCachedBluetoothDevice(mContext, mBtManager,
                device);
        for (int i = 0; i < mProfiles.length; i++) {
            LocalBluetoothProfileManager profileManager = LocalBluetoothProfileManager
                    .getProfileManager(mBtManager, mProfiles[i]);
            boolean isConnected = profileManager.isConnected(device);
            CachedBluetoothDevice cachedDevice = getCachedBluetoothDevice(mContext, mBtManager,
                    device);

            if (DEBUG) Log.d(TAG, mProfiles[i].toString() + " = " + mCheckedItems[i]);

            if (mCheckedItems[i] && !isConnected) {
                // Checked but not connected
                if (DEBUG) Log.d(TAG, "applyBtSettings - Connecting");
                cachedDevice.connect(mProfiles[i]);
                callConnect = true;
            } else if (!mCheckedItems[i] && isConnected) {
                // Unchecked but connected
                if (DEBUG) Log.d(TAG, "applyBtSettings - Disconnecting");
@@ -484,6 +484,11 @@ public class DockService extends Service implements AlertDialog.OnMultiChoiceCli
                }
            }
        }

        if (callConnect) {
            if (DEBUG) Log.d(TAG, "applyBtSettings - Connecting");
            cachedDevice.connect();
        }
    }

    void handleUndocked(Context context, LocalBluetoothManager localManager,