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

Commit 87ecf3e8 authored by William Escande's avatar William Escande
Browse files

U on T: SdkCheck before calling createLeAudioOutputInfo

Test: Drop U prebuilt on T and make a call using sco
Test: m Bluetooth
Bug: 287186536
Change-Id: Ic814d725f97637476a2b0ee7315575af0ede5b26
parent 43f118c5
Loading
Loading
Loading
Loading
+15 −31
Original line number Diff line number Diff line
@@ -385,22 +385,6 @@
            line="281"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 34 (current min is 33): `android.media.BluetoothProfileConnectionInfo#createLeAudioOutputInfo`">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="1328"/>
    </issue>

    <issue
        id="NewApi"
        message="Call requires API level 34 (current min is 33): `android.media.BluetoothProfileConnectionInfo#createLeAudioOutputInfo`">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="3082"/>
    </issue>

    <issue
        id="SimpleDateFormat"
        message="To get local formatting use `getDateInstance()`, `getDateTimeInstance()`, or `getTimeInstance()`, or use `new SimpleDateFormat(String template, Locale locale)` with for example `Locale.US` for ASCII dates.">
@@ -3974,7 +3958,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="245"/>
            line="246"/>
    </issue>

    <issue
@@ -3982,7 +3966,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="266"/>
            line="267"/>
    </issue>

    <issue
@@ -3990,7 +3974,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="296"/>
            line="297"/>
    </issue>

    <issue
@@ -3998,7 +3982,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="296"/>
            line="297"/>
    </issue>

    <issue
@@ -4006,7 +3990,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="307"/>
            line="308"/>
    </issue>

    <issue
@@ -4014,7 +3998,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="360"/>
            line="361"/>
    </issue>

    <issue
@@ -4022,7 +4006,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="534"/>
            line="535"/>
    </issue>

    <issue
@@ -4030,7 +4014,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="1561"/>
            line="1570"/>
    </issue>

    <issue
@@ -4038,7 +4022,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="1814"/>
            line="1823"/>
    </issue>

    <issue
@@ -4046,7 +4030,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="1860"/>
            line="1869"/>
    </issue>

    <issue
@@ -4054,7 +4038,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="2249"/>
            line="2258"/>
    </issue>

    <issue
@@ -4062,7 +4046,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="2319"/>
            line="2328"/>
    </issue>

    <issue
@@ -4070,7 +4054,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="2442"/>
            line="2451"/>
    </issue>

    <issue
@@ -4078,7 +4062,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="2506"/>
            line="2515"/>
    </issue>

    <issue
@@ -4086,7 +4070,7 @@
        message="This method should only be accessed from tests or within private scope">
        <location
            file="packages/modules/Bluetooth/android/app/src/com/android/bluetooth/le_audio/LeAudioService.java"
            line="2544"/>
            line="2553"/>
    </issue>

    <issue
+25 −6
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.bluetooth.IBluetoothLeAudio.LE_AUDIO_GROUP_ID_INVALID;

import static com.android.bluetooth.Utils.enforceBluetoothPrivilegedPermission;
import static com.android.modules.utils.build.SdkLevel.isAtLeastU;

import android.annotation.RequiresPermission;
import android.annotation.SuppressLint;
@@ -1324,9 +1325,17 @@ public class LeAudioService extends ProfileService {

            final boolean suppressNoisyIntent = hasFallbackDevice || mActiveAudioOutDevice != null;

            mAudioManager.handleBluetoothActiveDeviceChanged(mActiveAudioOutDevice,
                    previousActiveOutDevice, BluetoothProfileConnectionInfo.createLeAudioOutputInfo(
                            suppressNoisyIntent, volume));
            final BluetoothProfileConnectionInfo connectionInfo;
            if (isAtLeastU()) {
                connectionInfo =
                        BluetoothProfileConnectionInfo.createLeAudioOutputInfo(
                                suppressNoisyIntent, volume);
            } else {
                connectionInfo =
                        BluetoothProfileConnectionInfo.createLeAudioInfo(suppressNoisyIntent, true);
            }
            mAudioManager.handleBluetoothActiveDeviceChanged(
                    mActiveAudioOutDevice, previousActiveOutDevice, connectionInfo);
        }

        if (isNewActiveInDevice) {
@@ -3078,9 +3087,19 @@ public class LeAudioService extends ProfileService {
            Log.i(TAG, "Sending LE Audio Output active device changed for preferred profile "
                    + "change with volume=" + volume + " and suppressNoisyIntent="
                    + suppressNoisyIntent);
            mAudioManager.handleBluetoothActiveDeviceChanged(mActiveAudioOutDevice,
                    mActiveAudioOutDevice, BluetoothProfileConnectionInfo.createLeAudioOutputInfo(
                            suppressNoisyIntent, volume));

            final BluetoothProfileConnectionInfo connectionInfo;
            if (isAtLeastU()) {
                connectionInfo =
                        BluetoothProfileConnectionInfo.createLeAudioOutputInfo(
                                suppressNoisyIntent, volume);
            } else {
                connectionInfo =
                        BluetoothProfileConnectionInfo.createLeAudioInfo(suppressNoisyIntent, true);
            }

            mAudioManager.handleBluetoothActiveDeviceChanged(
                    mActiveAudioOutDevice, mActiveAudioOutDevice, connectionInfo);
            audioFrameworkCalls++;
        }