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

Commit 65c10671 authored by Rahul Sabnis's avatar Rahul Sabnis Committed by Gerrit Code Review
Browse files

Merge "Use default audio profile sysprops if the preference is not overriden"

parents 3cb0ffe5 78a2d7f6
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -4336,9 +4336,22 @@ public class AdapterService extends Service {
        // If there are no preferences stored, return the defaults
        Bundle storedBundle = mDatabaseManager.getPreferredAudioProfiles(groupLead);
        if (storedBundle.isEmpty()) {
            //TODO(b/265077414): replace with default audio policy sysprop
            int outputOnlyDefault = BluetoothProfile.LE_AUDIO;
            int duplexDefault = BluetoothProfile.LE_AUDIO;
            // Gets the default output only audio profile or defaults to LE_AUDIO if not present
            int outputOnlyDefault = BluetoothProperties.getDefaultOutputOnlyAudioProfile().orElse(
                    BluetoothProfile.LE_AUDIO);
            if (outputOnlyDefault != BluetoothProfile.A2DP
                    && outputOnlyDefault != BluetoothProfile.LE_AUDIO) {
                outputOnlyDefault = BluetoothProfile.LE_AUDIO;
            }

            // Gets the default duplex audio profile or defaults to LE_AUDIO if not present
            int duplexDefault = BluetoothProperties.getDefaultDuplexAudioProfile().orElse(
                    BluetoothProfile.LE_AUDIO);
            if (duplexDefault != BluetoothProfile.HEADSET
                    && duplexDefault != BluetoothProfile.LE_AUDIO) {
                duplexDefault = BluetoothProfile.LE_AUDIO;
            }

            if (isOutputOnlyAudioSupported(groupLead)) {
                storedBundle.putInt(BluetoothAdapter.AUDIO_MODE_OUTPUT_ONLY, outputOnlyDefault);
            }
+3 −1
Original line number Diff line number Diff line
@@ -5079,7 +5079,9 @@ public final class BluetoothAdapter {
     * Gets the preferred profile for each audio mode for system routed audio. This API
     * returns a Bundle with mappings between each audio mode and its preferred audio profile. If no
     * values are set via {@link #setPreferredAudioProfiles(BluetoothDevice, Bundle)}, this API
     * returns the default system preferences set via a sysprop.
     * returns the default system preferences set via the sysprops
     * {@link BluetoothProperties#getDefaultOutputOnlyAudioProfile()} and
     * {@link BluetoothProperties#getDefaultDuplexAudioProfile()}.
     * <p>
     * An audio capable device must support at least one audio mode with a preferred audio profile.
     * If a device does not support an audio mode, the audio mode will be omitted from the keys of