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

Commit cc2c6a07 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "BtProfileConnectionInfo update api review"

parents fa9d5b2e ac11d772
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -140,7 +140,7 @@ package android.media {
    method public void adjustSuggestedStreamVolumeForUid(int, int, int, @NonNull String, int, int, int);
    method @NonNull public java.util.List<android.bluetooth.BluetoothCodecConfig> getHwOffloadFormatsSupportedForA2dp();
    method @NonNull public java.util.List<android.bluetooth.BluetoothLeAudioCodecConfig> getHwOffloadFormatsSupportedForLeAudio();
    method @RequiresPermission("android.permission.BLUETOOTH_STACK") public void handleBluetoothActiveDeviceChanged(@Nullable android.bluetooth.BluetoothDevice, @Nullable android.bluetooth.BluetoothDevice, @NonNull android.media.BtProfileConnectionInfo);
    method @RequiresPermission("android.permission.BLUETOOTH_STACK") public void handleBluetoothActiveDeviceChanged(@Nullable android.bluetooth.BluetoothDevice, @Nullable android.bluetooth.BluetoothDevice, @NonNull android.media.BluetoothProfileConnectionInfo);
    method @RequiresPermission("android.permission.BLUETOOTH_STACK") public void setA2dpSuspended(boolean);
    method @RequiresPermission("android.permission.BLUETOOTH_STACK") public void setBluetoothHeadsetProperties(@NonNull String, boolean, boolean);
    method @RequiresPermission("android.permission.BLUETOOTH_STACK") public void setHfpEnabled(boolean);
@@ -150,18 +150,18 @@ package android.media {
    field public static final int FLAG_FROM_KEY = 4096; // 0x1000
  }

  public final class BtProfileConnectionInfo implements android.os.Parcelable {
    method @NonNull public static android.media.BtProfileConnectionInfo a2dpInfo(boolean, int);
    method @NonNull public static android.media.BtProfileConnectionInfo a2dpSinkInfo(int);
  public final class BluetoothProfileConnectionInfo implements android.os.Parcelable {
    method @NonNull public static android.media.BluetoothProfileConnectionInfo createA2dpInfo(boolean, int);
    method @NonNull public static android.media.BluetoothProfileConnectionInfo createA2dpSinkInfo(int);
    method @NonNull public static android.media.BluetoothProfileConnectionInfo createHearingAidInfo(boolean);
    method @NonNull public static android.media.BluetoothProfileConnectionInfo createLeAudioInfo(boolean, boolean);
    method public int describeContents();
    method public boolean getIsLeOutput();
    method public int getProfile();
    method public boolean getSuppressNoisyIntent();
    method public int getVolume();
    method @NonNull public static android.media.BtProfileConnectionInfo hearingAidInfo(boolean);
    method @NonNull public static android.media.BtProfileConnectionInfo leAudio(boolean, boolean);
    method public boolean isLeOutput();
    method public boolean isSuppressNoisyIntent();
    method public void writeToParcel(@NonNull android.os.Parcel, int);
    field @NonNull public static final android.os.Parcelable.Creator<android.media.BtProfileConnectionInfo> CREATOR;
    field @NonNull public static final android.os.Parcelable.Creator<android.media.BluetoothProfileConnectionInfo> CREATOR;
  }

  public class MediaMetadataRetriever implements java.lang.AutoCloseable {
+3 −2
Original line number Diff line number Diff line
@@ -5806,13 +5806,14 @@ public class AudioManager {
     * @param newDevice Bluetooth device connected or null if there is no new devices
     * @param previousDevice Bluetooth device disconnected or null if there is no disconnected
     * devices
     * @param info contain all info related to the device. {@link BtProfileConnectionInfo}
     * @param info contain all info related to the device. {@link BluetoothProfileConnectionInfo}
     * {@hide}
     */
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_STACK)
    public void handleBluetoothActiveDeviceChanged(@Nullable BluetoothDevice newDevice,
            @Nullable BluetoothDevice previousDevice, @NonNull BtProfileConnectionInfo info) {
            @Nullable BluetoothDevice previousDevice,
            @NonNull BluetoothProfileConnectionInfo info) {
        final IAudioService service = getService();
        try {
            service.handleBluetoothActiveDeviceChanged(newDevice, previousDevice, info);
+1 −1
Original line number Diff line number Diff line
@@ -16,5 +16,5 @@

package android.media;

parcelable BtProfileConnectionInfo;
parcelable BluetoothProfileConnectionInfo;
+27 −27
Original line number Diff line number Diff line
@@ -26,15 +26,14 @@ import android.os.Parcelable;
 * {@hide}
 */
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public final class BtProfileConnectionInfo implements Parcelable {

public final class BluetoothProfileConnectionInfo implements Parcelable {
    private final int mProfile;
    private final boolean mSupprNoisy;
    private final int mVolume;
    private final boolean mIsLeOutput;

    private BtProfileConnectionInfo(int profile, boolean suppressNoisyIntent, int volume,
            boolean isLeOutput) {
    private BluetoothProfileConnectionInfo(int profile, boolean suppressNoisyIntent,
            int volume, boolean isLeOutput) {
        mProfile = profile;
        mSupprNoisy = suppressNoisyIntent;
        mVolume = volume;
@@ -45,21 +44,21 @@ public final class BtProfileConnectionInfo implements Parcelable {
     * Constructor used by BtHelper when a profile is connected
     * {@hide}
     */
    public BtProfileConnectionInfo(int profile) {
    public BluetoothProfileConnectionInfo(int profile) {
        this(profile, false, -1, false);
    }

    public static final @NonNull Parcelable.Creator<BtProfileConnectionInfo> CREATOR =
            new Parcelable.Creator<BtProfileConnectionInfo>() {
    public static final @NonNull Parcelable.Creator<BluetoothProfileConnectionInfo> CREATOR =
            new Parcelable.Creator<BluetoothProfileConnectionInfo>() {
                @Override
                public BtProfileConnectionInfo createFromParcel(Parcel source) {
                    return new BtProfileConnectionInfo(source.readInt(), source.readBoolean(),
                            source.readInt(), source.readBoolean());
                public BluetoothProfileConnectionInfo createFromParcel(Parcel source) {
                    return new BluetoothProfileConnectionInfo(source.readInt(),
                            source.readBoolean(), source.readInt(), source.readBoolean());
                }

                @Override
                public BtProfileConnectionInfo[] newArray(int size) {
                    return new BtProfileConnectionInfo[size];
                public BluetoothProfileConnectionInfo[] newArray(int size) {
                    return new BluetoothProfileConnectionInfo[size];
                }
            };

@@ -84,10 +83,10 @@ public final class BtProfileConnectionInfo implements Parcelable {
     *
     * @param volume of device -1 to ignore value
     */
    public static @NonNull BtProfileConnectionInfo a2dpInfo(boolean suppressNoisyIntent,
            int volume) {
        return new BtProfileConnectionInfo(BluetoothProfile.A2DP, suppressNoisyIntent, volume,
            false);
    public static @NonNull BluetoothProfileConnectionInfo createA2dpInfo(
            boolean suppressNoisyIntent, int volume) {
        return new BluetoothProfileConnectionInfo(BluetoothProfile.A2DP, suppressNoisyIntent,
            volume, false);
    }

    /**
@@ -96,8 +95,8 @@ public final class BtProfileConnectionInfo implements Parcelable {
     *
     * @param volume of device -1 to ignore value
     */
    public static @NonNull BtProfileConnectionInfo a2dpSinkInfo(int volume) {
        return new BtProfileConnectionInfo(BluetoothProfile.A2DP_SINK, true, volume, false);
    public static @NonNull BluetoothProfileConnectionInfo createA2dpSinkInfo(int volume) {
        return new BluetoothProfileConnectionInfo(BluetoothProfile.A2DP_SINK, true, volume, false);
    }

    /**
@@ -106,9 +105,10 @@ public final class BtProfileConnectionInfo implements Parcelable {
     * @param suppressNoisyIntent if true the {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY}
     * intent will not be sent.
     */
    public static @NonNull BtProfileConnectionInfo hearingAidInfo(boolean suppressNoisyIntent) {
        return new BtProfileConnectionInfo(BluetoothProfile.HEARING_AID, suppressNoisyIntent, -1,
            false);
    public static @NonNull BluetoothProfileConnectionInfo createHearingAidInfo(
            boolean suppressNoisyIntent) {
        return new BluetoothProfileConnectionInfo(BluetoothProfile.HEARING_AID, suppressNoisyIntent,
            -1, false);
    }

    /**
@@ -119,10 +119,10 @@ public final class BtProfileConnectionInfo implements Parcelable {
     *
     * @param isLeOutput if true mean the device is an output device, if false it's an input device
     */
    public static @NonNull BtProfileConnectionInfo leAudio(boolean suppressNoisyIntent,
            boolean isLeOutput) {
        return new BtProfileConnectionInfo(BluetoothProfile.LE_AUDIO, suppressNoisyIntent, -1,
            isLeOutput);
    public static @NonNull BluetoothProfileConnectionInfo createLeAudioInfo(
            boolean suppressNoisyIntent, boolean isLeOutput) {
        return new BluetoothProfileConnectionInfo(BluetoothProfile.LE_AUDIO, suppressNoisyIntent,
            -1, isLeOutput);
    }

    /**
@@ -136,7 +136,7 @@ public final class BtProfileConnectionInfo implements Parcelable {
     * @return {@code true} if {@link AudioManager.ACTION_AUDIO_BECOMING_NOISY} intent will not be
     * sent
     */
    public boolean getSuppressNoisyIntent() {
    public boolean isSuppressNoisyIntent() {
        return mSupprNoisy;
    }

@@ -153,7 +153,7 @@ public final class BtProfileConnectionInfo implements Parcelable {
     * @return {@code true} is the LE device is an output device, {@code false} if it's an input
     * device
     */
    public boolean getIsLeOutput() {
    public boolean isLeOutput() {
        return mIsLeOutput;
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import android.media.AudioFocusInfo;
import android.media.AudioPlaybackConfiguration;
import android.media.AudioRecordingConfiguration;
import android.media.AudioRoutesInfo;
import android.media.BtProfileConnectionInfo;
import android.media.BluetoothProfileConnectionInfo;
import android.media.IAudioFocusDispatcher;
import android.media.IAudioModeDispatcher;
import android.media.IAudioRoutesObserver;
@@ -268,7 +268,7 @@ interface IAudioService {
    oneway void playerHasOpPlayAudio(in int piid, in boolean hasOpPlayAudio);

    void handleBluetoothActiveDeviceChanged(in BluetoothDevice newDevice,
            in BluetoothDevice previousDevice, in BtProfileConnectionInfo info);
            in BluetoothDevice previousDevice, in BluetoothProfileConnectionInfo info);

    oneway void setFocusRequestResultFromExtPolicy(in AudioFocusInfo afi, int requestResult,
            in IAudioPolicyCallback pcb);
Loading