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

Commit d6bd16a2 authored by Hall Liu's avatar Hall Liu Committed by android-build-merger
Browse files

Try harder to connect to bluetooth

am: 5a317fcb

Change-Id: Iefe2dae6ee30d73a163e5d83c725872d3554b485
parents 8c326e03 5a317fcb
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -594,14 +594,20 @@ public class BluetoothRouteManager extends StateMachine {

        String actualAddress = matchingDevice.isPresent()
                ? address : getActiveDeviceAddress();
        if (actualAddress == null) {
            Log.i(this, "No device specified and BT stack has no active device."
                    + " Using arbitrary device");
            if (deviceList.size() > 0) {
                actualAddress = deviceList.iterator().next().getAddress();
            } else {
                Log.i(this, "No devices available at all. Not connecting.");
                return null;
            }
        }
        if (!matchingDevice.isPresent()) {
            Log.i(this, "No device with address %s available. Using %s instead.",
                    address, actualAddress);
        }
        if (actualAddress == null) {
            Log.i(this, "No device specified and BT stack has no active device. Not connecting.");
            return null;
        }
        if (!connectAudio(actualAddress)) {
            boolean shouldRetry = retryCount < MAX_CONNECTION_RETRIES;
            Log.w(LOG_TAG, "Could not connect to %s. Will %s", actualAddress,