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

Commit 21bba84f authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "AudioService: use AttributionSource for communication route" into main

parents b8bd4a55 0ce4046f
Loading
Loading
Loading
Loading
+15 −6
Original line number Original line Diff line number Diff line
@@ -51,6 +51,7 @@ import android.compat.annotation.ChangeId;
import android.compat.annotation.EnabledSince;
import android.compat.annotation.EnabledSince;
import android.compat.annotation.Overridable;
import android.compat.annotation.Overridable;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.AttributionSource;
import android.content.ComponentName;
import android.content.ComponentName;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
@@ -1918,12 +1919,18 @@ public class AudioManager {
    @Deprecated public void setSpeakerphoneOn(boolean on) {
    @Deprecated public void setSpeakerphoneOn(boolean on) {
        final IAudioService service = getService();
        final IAudioService service = getService();
        try {
        try {
            service.setSpeakerphoneOn(mICallBack, on);
            service.setSpeakerphoneOn(mICallBack, on, getAttributionSource());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
    }
    }


    private AttributionSource getAttributionSource() {
        Context context = getContext();
        return (context != null)
                     ? context.getAttributionSource() : AttributionSource.myAttributionSource();
    }

    /**
    /**
     * Checks whether the speakerphone is on or off.
     * Checks whether the speakerphone is on or off.
     *
     *
@@ -3089,7 +3096,8 @@ public class AudioManager {
        final IAudioService service = getService();
        final IAudioService service = getService();
        try {
        try {
            service.startBluetoothSco(mICallBack,
            service.startBluetoothSco(mICallBack,
                    getContext().getApplicationInfo().targetSdkVersion);
                    getContext().getApplicationInfo().targetSdkVersion,
                    getAttributionSource());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
@@ -3114,7 +3122,7 @@ public class AudioManager {
    public void startBluetoothScoVirtualCall() {
    public void startBluetoothScoVirtualCall() {
        final IAudioService service = getService();
        final IAudioService service = getService();
        try {
        try {
            service.startBluetoothScoVirtualCall(mICallBack);
            service.startBluetoothScoVirtualCall(mICallBack, getAttributionSource());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
@@ -3134,7 +3142,7 @@ public class AudioManager {
    @Deprecated public void stopBluetoothSco() {
    @Deprecated public void stopBluetoothSco() {
        final IAudioService service = getService();
        final IAudioService service = getService();
        try {
        try {
            service.stopBluetoothSco(mICallBack);
            service.stopBluetoothSco(mICallBack,  getAttributionSource());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
@@ -9023,7 +9031,8 @@ public class AudioManager {
                Log.w(TAG, "setCommunicationDevice: device not found: " + device);
                Log.w(TAG, "setCommunicationDevice: device not found: " + device);
                return false;
                return false;
            }
            }
            return getService().setCommunicationDevice(mICallBack, device.getId());
            return getService().setCommunicationDevice(mICallBack, device.getId(),
                    getAttributionSource());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
@@ -9035,7 +9044,7 @@ public class AudioManager {
     */
     */
    public void clearCommunicationDevice() {
    public void clearCommunicationDevice() {
        try {
        try {
            getService().setCommunicationDevice(mICallBack, 0);
            getService().setCommunicationDevice(mICallBack, 0, getAttributionSource());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
            throw e.rethrowFromSystemServer();
        }
        }
+6 −5
Original line number Original line Diff line number Diff line
@@ -234,7 +234,7 @@ interface IAudioService {


    int getEncodedSurroundMode(int targetSdkVersion);
    int getEncodedSurroundMode(int targetSdkVersion);


    void setSpeakerphoneOn(IBinder cb, boolean on);
    void setSpeakerphoneOn(IBinder cb, boolean on, in AttributionSource attributionSource);


    boolean isSpeakerphoneOn();
    boolean isSpeakerphoneOn();


@@ -263,9 +263,10 @@ interface IAudioService {


    int getCurrentAudioFocus();
    int getCurrentAudioFocus();


    void startBluetoothSco(IBinder cb, int targetSdkVersion);
    void startBluetoothSco(IBinder cb, int targetSdkVersion,
    void startBluetoothScoVirtualCall(IBinder cb);
            in AttributionSource attributionSource);
    void stopBluetoothSco(IBinder cb);
    void startBluetoothScoVirtualCall(IBinder cb, in AttributionSource attributionSource);
    void stopBluetoothSco(IBinder cb, in AttributionSource attributionSource);


    void forceVolumeControlStream(int streamType, IBinder cb);
    void forceVolumeControlStream(int streamType, IBinder cb);


@@ -542,7 +543,7 @@ interface IAudioService {


    int[] getAvailableCommunicationDeviceIds();
    int[] getAvailableCommunicationDeviceIds();


    boolean setCommunicationDevice(IBinder cb, int portId);
    boolean setCommunicationDevice(IBinder cb, int portId, in AttributionSource attributionSource);


    int getCommunicationDevice();
    int getCommunicationDevice();