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

Commit 5a6a10c7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clean up update_preferred_audio_device_logic" into main

parents 7e9a0750 86f8562c
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -79,17 +79,6 @@ flag {
  }
}

# OWNER=pmadapurmath TARGET=25Q3
flag {
  name: "update_preferred_audio_device_logic"
  namespace: "telecom"
  description: "Change the use of preferred device for strategy to only use it at the start of the call and include relevant syncing with AudioManager#getCommunicationDevice"
  bug: "377345692"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

# OWNER=pmadapurmath TARGET=25Q3
flag {
  name: "call_audio_routing_performance_improvemenent"
+3 −8
Original line number Diff line number Diff line
@@ -133,9 +133,7 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
            try {
                if (AudioManager.ACTION_SPEAKERPHONE_STATE_CHANGED.equals(intent.getAction())) {
                    if (mAudioManager != null) {
                        AudioDeviceInfo info = mFeatureFlags.updatePreferredAudioDeviceLogic()
                                ? getCurrentCommunicationDevice()
                                : mAudioManager.getCommunicationDevice();
                        AudioDeviceInfo info = getCurrentCommunicationDevice();
                        if ((info != null) &&
                                (info.getType() == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER)) {
                            if (mCurrentRoute.getType() != AudioRoute.TYPE_SPEAKER) {
@@ -1330,10 +1328,7 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
        // Get corresponding audio route
        @AudioRoute.AudioRouteType int type = DEVICE_INFO_TYPE_TO_AUDIO_ROUTE_TYPE.get(
                deviceAttr.getType());
        AudioDeviceInfo currentCommunicationDevice = null;
        if (mFeatureFlags.updatePreferredAudioDeviceLogic()) {
            currentCommunicationDevice = getCurrentCommunicationDevice();
        }
        AudioDeviceInfo currentCommunicationDevice = getCurrentCommunicationDevice();
        // We will default to TYPE_INVALID if the currentCommunicationDevice is null or the type
        // cannot be resolved from the given audio device info.
        int communicationDeviceAudioType = getAudioType(currentCommunicationDevice);
@@ -1480,7 +1475,7 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
    public AudioRoute getBaseRoute(boolean includeBluetooth, String btAddressToExclude) {
        // Catch-all case for all invocations to this method where we shouldn't be using
        // getPreferredAudioRouteFromStrategy
        if (mFeatureFlags.updatePreferredAudioDeviceLogic() && !mUsePreferredDeviceStrategy) {
        if (!mUsePreferredDeviceStrategy) {
            return calculateBaselineRoute(false, includeBluetooth, btAddressToExclude);
        }
        AudioRoute destRoute = getPreferredAudioRouteFromStrategy();
+0 −2
Original line number Diff line number Diff line
@@ -283,7 +283,6 @@ public class CallAudioRouteControllerTest extends TelecomTestCase {
    @SmallTest
    @Test
    public void testAudioRouteForPreferredDeviceStrategy() {
        when(mFeatureFlags.updatePreferredAudioDeviceLogic()).thenReturn(true);
        mController.initialize();
        mController.sendMessageWithSessionInfo(SWITCH_FOCUS, RINGING_FOCUS, 0);
        waitForRouteActiveStateAndVerify(true);
@@ -302,7 +301,6 @@ public class CallAudioRouteControllerTest extends TelecomTestCase {
    @SmallTest
    @Test
    public void testAudioRouteCommunicationDeviceSyncWithPreferredDeviceStrategy() {
        when(mFeatureFlags.updatePreferredAudioDeviceLogic()).thenReturn(true);
        mController.initialize();
        // Set up tests so that the current communication device is different from the preferred
        // device for strategy.