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

Commit 4d0ae943 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12404440 from 0f6e00fa to 24Q4-release

Change-Id: I0866f9fe8b333f6bb4d2e85a7e76791dcecff512
parents 4ecfa5db 0f6e00fa
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -350,7 +350,8 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
        mActiveBluetoothDevice = null;
        mTypeRoutes = new ArrayMap<>();
        mStreamingRoutes = new HashSet<>();
        mPendingAudioRoute = new PendingAudioRoute(this, mAudioManager, mBluetoothRouteManager);
        mPendingAudioRoute = new PendingAudioRoute(this, mAudioManager, mBluetoothRouteManager,
                mFeatureFlags);
        mStreamingRoute = new AudioRoute(AudioRoute.TYPE_STREAMING, null, null);
        mStreamingRoutes.add(mStreamingRoute);

@@ -981,7 +982,7 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
            mPendingAudioRoute.clearPendingMessages();
            onCurrentRouteChanged();
            if (mFeatureFlags.telecomMetricsSupport()) {
                mMetricsController.getAudioRouteStats().onRouteExit(mPendingAudioRoute);
                mMetricsController.getAudioRouteStats().onRouteExit(mPendingAudioRoute, true);
            }
        }
    }
@@ -1467,4 +1468,10 @@ public class CallAudioRouteController implements CallAudioRouteAdapter {
        }
        mIsActive = active;
    }

    void fallBack(String btAddressToExclude) {
        mMetricsController.getAudioRouteStats().onRouteExit(mPendingAudioRoute, false);
        sendMessageWithSessionInfo(SWITCH_BASELINE_ROUTE, INCLUDE_BLUETOOTH_IN_BASELINE,
                btAddressToExclude);
    }
}
+10 −9
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.util.ArraySet;
import android.util.Pair;

import com.android.server.telecom.bluetooth.BluetoothRouteManager;
import com.android.server.telecom.flags.FeatureFlags;

import java.util.Set;

@@ -41,6 +42,7 @@ public class PendingAudioRoute {
    private CallAudioRouteController mCallAudioRouteController;
    private AudioManager mAudioManager;
    private BluetoothRouteManager mBluetoothRouteManager;
    private FeatureFlags mFeatureFlags;
    /**
     * The {@link AudioRoute} that this pending audio switching started with
     */
@@ -52,17 +54,17 @@ public class PendingAudioRoute {
    private AudioRoute mDestRoute;
    private Set<Pair<Integer, String>> mPendingMessages;
    private boolean mActive;
    private boolean mIsFailed;
    /**
     * The device that has been set for communication by Telecom
     */
    private @AudioRoute.AudioRouteType int mCommunicationDeviceType = AudioRoute.TYPE_INVALID;

    PendingAudioRoute(CallAudioRouteController controller, AudioManager audioManager,
            BluetoothRouteManager bluetoothRouteManager) {
            BluetoothRouteManager bluetoothRouteManager, FeatureFlags featureFlags) {
        mCallAudioRouteController = controller;
        mAudioManager = audioManager;
        mBluetoothRouteManager = bluetoothRouteManager;
        mFeatureFlags = featureFlags;
        mPendingMessages = new ArraySet<>();
        mActive = false;
        mCommunicationDeviceType = AudioRoute.TYPE_INVALID;
@@ -96,10 +98,13 @@ public class PendingAudioRoute {
    public void onMessageReceived(Pair<Integer, String> message, String btAddressToExclude) {
        Log.i(this, "onMessageReceived: message - %s", message);
        if (message.first == PENDING_ROUTE_FAILED) {
            mIsFailed = true;
            // Fallback to base route
            if (mFeatureFlags.telecomMetricsSupport()) {
                mCallAudioRouteController.fallBack(btAddressToExclude);
            } else {
                mCallAudioRouteController.sendMessageWithSessionInfo(
                        SWITCH_BASELINE_ROUTE, INCLUDE_BLUETOOTH_IN_BASELINE, btAddressToExclude);
            }
            return;
        }

@@ -141,8 +146,4 @@ public class PendingAudioRoute {
    public void overrideDestRoute(AudioRoute route) {
        mDestRoute = route;
    }

    public boolean isFailed() {
        return mIsFailed;
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -180,10 +180,9 @@ public class AudioRouteStats extends TelecomPulledAtom {
        });
    }

    public void onRouteExit(PendingAudioRoute pendingRoute) {
    public void onRouteExit(PendingAudioRoute pendingRoute, boolean isSuccess) {
        // Check the dest type on the route exiting as it may be different as the enter
        int destType = convertAudioType(pendingRoute.getDestRoute(), false);
        boolean isSuccess = !pendingRoute.isFailed();
        long curTime = SystemClock.elapsedRealtime();
        post(() -> {
            if (mIsOngoing) {
+5 −6
Original line number Diff line number Diff line
@@ -122,7 +122,6 @@ public class TelecomPulledAtomTest extends TelecomTestCase {
        mTempFile = mTempFolder.newFile(FILE_NAME_TEST_ATOM);
        doReturn(mTempFile).when(mSpyContext).getFileStreamPath(anyString());
        doReturn(mFileOutputStream).when(mSpyContext).openFileOutput(anyString(), anyInt());
        doReturn(false).when(mMockPendingAudioRoute).isFailed();
        doReturn(mMockSourceRoute).when(mMockPendingAudioRoute).getOrigRoute();
        doReturn(mMockDestRoute).when(mMockPendingAudioRoute).getDestRoute();
        doReturn(TYPE_EARPIECE).when(mMockSourceRoute).getType();
@@ -345,7 +344,7 @@ public class TelecomPulledAtomTest extends TelecomTestCase {

        audioRouteStats.onRouteEnter(mMockPendingAudioRoute);
        waitForHandlerActionDelayed(audioRouteStats, TEST_TIMEOUT, latency);
        audioRouteStats.onRouteExit(mMockPendingAudioRoute);
        audioRouteStats.onRouteExit(mMockPendingAudioRoute, true);
        waitForHandlerAction(audioRouteStats, 100);

        // Verify that the stats should not be saved before the revert threshold is expired
@@ -375,7 +374,7 @@ public class TelecomPulledAtomTest extends TelecomTestCase {

        audioRouteStats.onRouteEnter(mMockPendingAudioRoute);
        waitForHandlerActionDelayed(audioRouteStats, TEST_TIMEOUT, latency);
        audioRouteStats.onRouteExit(mMockPendingAudioRoute);
        audioRouteStats.onRouteExit(mMockPendingAudioRoute, true);
        waitForHandlerAction(audioRouteStats, delay);

        // Verify that the stats should not be saved before the revert threshold is expired
@@ -411,7 +410,7 @@ public class TelecomPulledAtomTest extends TelecomTestCase {

        audioRouteStats.onRouteEnter(mMockPendingAudioRoute);
        waitForHandlerActionDelayed(audioRouteStats, TEST_TIMEOUT, latency);
        audioRouteStats.onRouteExit(mMockPendingAudioRoute);
        audioRouteStats.onRouteExit(mMockPendingAudioRoute, true);
        waitForHandlerAction(audioRouteStats, delay);

        // Verify that the stats should not be saved before the revert threshold is expired
@@ -449,7 +448,7 @@ public class TelecomPulledAtomTest extends TelecomTestCase {

        audioRouteStats.onRouteEnter(mMockPendingAudioRoute);
        waitForHandlerActionDelayed(audioRouteStats, TEST_TIMEOUT, latency);
        audioRouteStats.onRouteExit(mMockPendingAudioRoute);
        audioRouteStats.onRouteExit(mMockPendingAudioRoute, true);
        waitForHandlerAction(audioRouteStats, delay);

        // Verify that the stats should not be saved before the revert threshold is expired
@@ -505,7 +504,7 @@ public class TelecomPulledAtomTest extends TelecomTestCase {

        audioRouteStats.onRouteEnter(mMockPendingAudioRoute);
        waitForHandlerActionDelayed(audioRouteStats, TEST_TIMEOUT, latency);
        audioRouteStats.onRouteExit(mMockPendingAudioRoute);
        audioRouteStats.onRouteExit(mMockPendingAudioRoute, true);
        waitForHandlerAction(audioRouteStats, 100);

        doReturn(mMockDestRoute).when(mMockPendingAudioRoute).getOrigRoute();