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

Commit 4df3c8ef authored by Pranav Madapurmath's avatar Pranav Madapurmath
Browse files

Remove ignore auto route to watch flag

This flag has rolled out and can be removed.

Bug: 409612172
Flag: EXEMPT flag cleanup
Test: atest CallAudioRouteControllerTest
Test: atest CallAudioRouteStateMachineTest
Change-Id: If496f77cc4a6a3aa6350b38c3425acb20e90dabe
parent 09c0dfed
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -25,14 +25,6 @@ flag {
  bug: "289861657"
}

# OWNER=pmadapurmath TARGET=24Q1
flag {
  name: "ignore_auto_route_to_watch_device"
  namespace: "telecom"
  description: "Ignore auto routing to wearable devices."
  bug: "294378768"
}

# OWNER=pmadapurmath TARGET=24Q3
flag {
  name: "transit_route_before_audio_disconnect_bt"
+3 −30
Original line number Diff line number Diff line
@@ -1390,9 +1390,7 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
        } else {
            // Most recent active route will always be the last in the array (ensure that we don't
            // auto route to a wearable device unless it's already active).
            String autoRoutingToWatchExcerpt = mFeatureFlags.ignoreAutoRouteToWatchDevice()
                    ? " (except watch)"
                    : "";
            String autoRoutingToWatchExcerpt = " (except inactive watch)";
            Log.i(this, "getPreferredAudioRouteFromDefault: Audio routing defaulting to "
                    + "most recently active BT route" + autoRoutingToWatchExcerpt + ".");
            return activeWatchOrNonWatchDeviceRoute;
@@ -1535,12 +1533,6 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
     * device.
     */
    private AudioRoute getActiveWatchOrNonWatchDeviceRoute(String btAddressToExclude) {
        if (!mFeatureFlags.ignoreAutoRouteToWatchDevice()) {
            Log.i(this, "getActiveWatchOrNonWatchDeviceRoute: ignore_auto_route_to_watch_device "
                    + "flag is disabled. Routing to most recently reported active device.");
            return getMostRecentlyActiveBtRoute(btAddressToExclude);
        }

        List<AudioRoute> bluetoothRoutes = getAvailableBluetoothDevicesForRouting();
        // Traverse the routes from the most recently active recorded devices first.
        AudioRoute nonWatchDeviceRoute = null;
@@ -1562,8 +1554,8 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
                    && (device.equals(mCallAudioState.getActiveBluetoothDevice())
                    || isActiveDevice)) {
                Log.i(this, "getActiveWatchOrNonWatchDeviceRoute: Routing to active watch - %s",
                        bluetoothRoutes.get(0));
                return bluetoothRoutes.get(0);
                        bluetoothRoutes.get(bluetoothRoutes.size() - 1));
                return bluetoothRoutes.get(bluetoothRoutes.size() - 1);
            }
            // Record the first occurrence of a non-watch device route if found.
            if (!mBluetoothRouteManager.isWatch(device)) {
@@ -1589,25 +1581,6 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
        return bluetoothRoutes;
    }

    /**
     * Returns the most actively reported bluetooth route excluding the passed in route.
     */
    private AudioRoute getMostRecentlyActiveBtRoute(String btAddressToExclude) {
        List<AudioRoute> bluetoothRoutes = mBluetoothRoutes.keySet().stream().toList();
        for (int i = bluetoothRoutes.size() - 1; i >= 0; i--) {
            AudioRoute route = bluetoothRoutes.get(i);
            // Skip LE route if it's not the lead device.
            if (isLeAudioNonLeadDeviceOrServiceUnavailable(
                    route.getType(), mBluetoothRoutes.get(route))) {
                continue;
            }
            if (!route.getBluetoothAddress().equals(btAddressToExclude)) {
                return route;
            }
        }
        return null;
    }

    private boolean isLeAudioNonLeadDeviceOrServiceUnavailable(@AudioRoute.AudioRouteType int type,
            BluetoothDevice device) {
        BluetoothLeAudio leAudioService = getLeAudioService();
+0 −5
Original line number Diff line number Diff line
@@ -1958,11 +1958,6 @@ public class CallAudioRouteStateMachine extends StateMachine implements CallAudi
    }

    private boolean isWatchActiveOrOnlyWatchesAvailable() {
        if (!mFeatureFlags.ignoreAutoRouteToWatchDevice()) {
            Log.i(this, "isWatchActiveOrOnlyWatchesAvailable: Flag is disabled.");
            return false;
        }

        boolean containsWatchDevice = false;
        boolean containsNonWatchDevice = false;
        Collection<BluetoothDevice> connectedBtDevices =
+1 −1
Original line number Diff line number Diff line
@@ -815,7 +815,7 @@ public class BluetoothRouteManager extends StateMachine {
                    + " Using arbitrary device - except watch");
            if (deviceList.size() > 0) {
                for (BluetoothDevice device : deviceList) {
                    if (mFeatureFlags.ignoreAutoRouteToWatchDevice() && isWatch(device)) {
                    if (isWatch(device)) {
                        Log.i(this, "Skipping a watch device: " + device);
                        continue;
                    }
+0 −3
Original line number Diff line number Diff line
@@ -212,7 +212,6 @@ public class CallAudioRouteControllerTest extends TelecomTestCase {
        when(mCallAudioManager.getForegroundCall()).thenReturn(mCall);
        when(mCall.getVideoState()).thenReturn(VideoProfile.STATE_AUDIO_ONLY);
        when(mCall.getSupportedAudioRoutes()).thenReturn(CallAudioState.ROUTE_ALL);
        when(mFeatureFlags.ignoreAutoRouteToWatchDevice()).thenReturn(false);
        when(mFeatureFlags.useRefactoredAudioRouteSwitching()).thenReturn(true);
        when(mFeatureFlags.callAudioRoutingPerformanceImprovemenent()).thenReturn(true);
        BLUETOOTH_DEVICES.add(BLUETOOTH_DEVICE_1);
@@ -830,7 +829,6 @@ public class CallAudioRouteControllerTest extends TelecomTestCase {
    @SmallTest
    @Test
    public void testIgnoreAutoRouteToWatch() {
        when(mFeatureFlags.ignoreAutoRouteToWatchDevice()).thenReturn(true);
        when(mBluetoothRouteManager.isWatch(any(BluetoothDevice.class))).thenReturn(true);

        mController.initialize();
@@ -1005,7 +1003,6 @@ public class CallAudioRouteControllerTest extends TelecomTestCase {
    @SmallTest
    @Test
    public void testRouteFromBtSwitchInRingingSelected() {
        when(mFeatureFlags.ignoreAutoRouteToWatchDevice()).thenReturn(true);
        when(mBluetoothRouteManager.isWatch(any(BluetoothDevice.class))).thenReturn(true);
        when(mBluetoothRouteManager.isInbandRingEnabled(eq(AudioRoute.TYPE_BLUETOOTH_SCO),
                eq(BLUETOOTH_DEVICE_1))).thenReturn(false);
Loading