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

Commit 7ab88334 authored by William Escande's avatar William Escande
Browse files

AudioRoutingManager: Fix flaky test

Bug: 332624733
Fix: 332624733
Test: atest AudioRoutingManager --rerun-until-failure
Flag: Exempt, this is test only change, code has no logical change
Change-Id: I7af2222b96ecdcbeb1a3778e09d94538d02ba1ca
parent c6394f6f
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1398,7 +1398,8 @@ public class A2dpService extends ProfileService {
            }
            if (Flags.audioRoutingCentralization()) {
                return ((AudioRoutingManager) service.getActiveDeviceManager())
                        .activateDeviceProfile(device, BluetoothProfile.A2DP);
                        .activateDeviceProfile(device, BluetoothProfile.A2DP)
                        .join();
            }

            if (device == null) {
+2 −2
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ public class AudioRoutingManager extends ActiveDeviceManager {
     * @param profile The profile to be activated
     * @param receiver to post the results
     */
    public boolean activateDeviceProfile(BluetoothDevice device, int profile) {
    public CompletableFuture<Boolean> activateDeviceProfile(BluetoothDevice device, int profile) {
        CompletableFuture<Boolean> future = new CompletableFuture<>();

        mHandler.post(
@@ -109,7 +109,7 @@ public class AudioRoutingManager extends ActiveDeviceManager {
                        future.complete(
                                mHandler.activateDeviceProfile(
                                        mHandler.getAudioRoutingDevice(device), profile)));
        return future.join();
        return future;
    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -994,7 +994,8 @@ public class HearingAidService extends ProfileService {

            if (Flags.audioRoutingCentralization()) {
                return ((AudioRoutingManager) service.mAdapterService.getActiveDeviceManager())
                        .activateDeviceProfile(device, BluetoothProfile.HEARING_AID);
                        .activateDeviceProfile(device, BluetoothProfile.HEARING_AID)
                        .join();
            }
            if (device == null) {
                return service.removeActiveDevice(false);
+2 −1
Original line number Diff line number Diff line
@@ -782,7 +782,8 @@ public class HeadsetService extends ProfileService {

            if (Flags.audioRoutingCentralization()) {
                return ((AudioRoutingManager) service.mAdapterService.getActiveDeviceManager())
                        .activateDeviceProfile(device, BluetoothProfile.HEADSET);
                        .activateDeviceProfile(device, BluetoothProfile.HEADSET)
                        .join();
            }

            return service.setActiveDevice(device);
+2 −1
Original line number Diff line number Diff line
@@ -4393,7 +4393,8 @@ public class LeAudioService extends ProfileService {

            if (Flags.audioRoutingCentralization()) {
                return ((AudioRoutingManager) service.mAdapterService.getActiveDeviceManager())
                        .activateDeviceProfile(device, BluetoothProfile.LE_AUDIO);
                        .activateDeviceProfile(device, BluetoothProfile.LE_AUDIO)
                        .join();
            }
            if (device == null) {
                return service.removeActiveDevice(true);
Loading