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

Commit 3023ece0 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Automerger Merge Worker
Browse files

Merge "AudioDeviceBroker: Fix not setting proper call volume for LE Headset"...

Merge "AudioDeviceBroker: Fix not setting proper call volume for LE Headset" into udc-dev am: 0eeb400e am: 99eda4e2 am: 167d6beb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23258556



Change-Id: I80ba9c3ada31b2987ca2f5f2b8d093d074498507
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 0f058b3b 167d6beb
Loading
Loading
Loading
Loading
+24 −0
Original line number Original line Diff line number Diff line
@@ -420,6 +420,20 @@ import java.util.concurrent.atomic.AtomicBoolean;
            mBtHelper.stopBluetoothSco(eventSource);
            mBtHelper.stopBluetoothSco(eventSource);
        }
        }


        // In BT classic for communication, the device changes from a2dp to sco device, but for
        // LE Audio it stays the same and we must trigger the proper stream volume alignment, if
        // LE Audio communication device is activated after the audio system has already switched to
        // MODE_IN_CALL mode.
        if (isBluetoothLeAudioRequested()) {
            final int streamType = mAudioService.getBluetoothContextualVolumeStream();
            final int leAudioVolIndex = getVssVolumeForDevice(streamType, device.getInternalType());
            final int leAudioMaxVolIndex = getMaxVssVolumeForStream(streamType);
            if (AudioService.DEBUG_COMM_RTE) {
                Log.v(TAG, "setCommunicationRouteForClient restoring LE Audio device volume lvl.");
            }
            postSetLeAudioVolumeIndex(leAudioVolIndex, leAudioMaxVolIndex, streamType);
        }

        updateCommunicationRoute(eventSource);
        updateCommunicationRoute(eventSource);
    }
    }


@@ -632,6 +646,16 @@ import java.util.concurrent.atomic.AtomicBoolean;
        return isDeviceRequestedForCommunication(AudioDeviceInfo.TYPE_BLUETOOTH_SCO);
        return isDeviceRequestedForCommunication(AudioDeviceInfo.TYPE_BLUETOOTH_SCO);
    }
    }


    /**
     * Helper method on top of isDeviceRequestedForCommunication() indicating if
     * Bluetooth LE Audio communication device is currently requested or not.
     * @return true if Bluetooth LE Audio device is requested, false otherwise.
     */
    /*package*/ boolean isBluetoothLeAudioRequested() {
        return isDeviceRequestedForCommunication(AudioDeviceInfo.TYPE_BLE_HEADSET)
                || isDeviceRequestedForCommunication(AudioDeviceInfo.TYPE_BLE_SPEAKER);
    }

    /**
    /**
     * Indicates if preferred route selection for communication is Bluetooth SCO.
     * Indicates if preferred route selection for communication is Bluetooth SCO.
     * @return true if Bluetooth SCO is preferred , false otherwise.
     * @return true if Bluetooth SCO is preferred , false otherwise.