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

Commit 6fa39161 authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Gerrit Code Review
Browse files

Merge "Remove unused AVRCP hidden API" into main

parents 791d8705 bdb465dd
Loading
Loading
Loading
Loading
+0 −14
Original line number Original line Diff line number Diff line
@@ -718,15 +718,7 @@ public class A2dpService extends ProfileService {
                .getProfileConnectionPolicy(device, BluetoothProfile.A2DP);
                .getProfileConnectionPolicy(device, BluetoothProfile.A2DP);
    }
    }


    public boolean isAvrcpAbsoluteVolumeSupported() {
        // TODO (apanicke): Add a hook here for the AvrcpTargetService.
        return false;
    }


    public void setAvrcpAbsoluteVolume(int volume) {
    public void setAvrcpAbsoluteVolume(int volume) {
        // TODO (apanicke): Instead of using A2DP as a middleman for volume changes, add a binder
        // service to the new AVRCP Profile and have the audio manager use that instead.
        if (mFactory.getAvrcpTargetService() != null) {
        if (mFactory.getAvrcpTargetService() != null) {
            mFactory.getAvrcpTargetService().sendVolumeChanged(volume);
            mFactory.getAvrcpTargetService().sendVolumeChanged(volume);
            return;
            return;
@@ -1560,12 +1552,6 @@ public class A2dpService extends ProfileService {
            }
            }
        }
        }


        @Override
        public void isAvrcpAbsoluteVolumeSupported(SynchronousResultReceiver receiver) {
            // TODO (apanicke): Add a hook here for the AvrcpTargetService.
            receiver.send(false);
        }

        @Override
        @Override
        public void setAvrcpAbsoluteVolume(int volume, AttributionSource source) {
        public void setAvrcpAbsoluteVolume(int volume, AttributionSource source) {
            A2dpService service = getService(source);
            A2dpService service = getService(source);
+0 −27
Original line number Original line Diff line number Diff line
@@ -21,7 +21,6 @@ import static android.bluetooth.BluetoothUtils.getSyncTimeout;
import android.annotation.IntDef;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.annotation.RequiresNoPermission;
import android.annotation.RequiresPermission;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SdkConstant.SdkConstantType;
@@ -669,32 +668,6 @@ public final class BluetoothA2dp implements BluetoothProfile {
        return defaultValue;
        return defaultValue;
    }
    }


    /**
     * Checks if Avrcp device supports the absolute volume feature.
     *
     * @return true if device supports absolute volume
     * @hide
     */
    @RequiresNoPermission
    public boolean isAvrcpAbsoluteVolumeSupported() {
        if (DBG) Log.d(TAG, "isAvrcpAbsoluteVolumeSupported");
        final IBluetoothA2dp service = getService();
        final boolean defaultValue = false;
        if (service == null) {
            Log.w(TAG, "Proxy not attached to service");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else if (isEnabled()) {
            try {
                final SynchronousResultReceiver<Boolean> recv = SynchronousResultReceiver.get();
                service.isAvrcpAbsoluteVolumeSupported(recv);
                return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(defaultValue);
            } catch (RemoteException | TimeoutException e) {
                Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
            }
        }
        return defaultValue;
    }

    /**
    /**
     * Tells remote device to set an absolute volume. Only if absolute volume is supported
     * Tells remote device to set an absolute volume. Only if absolute volume is supported
     *
     *
+0 −2
Original line number Original line Diff line number Diff line
@@ -48,8 +48,6 @@ oneway interface IBluetoothA2dp {
    void setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
    void setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    void getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
    void getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
    @JavaPassthrough(annotation="@android.annotation.RequiresNoPermission")
    void isAvrcpAbsoluteVolumeSupported(in SynchronousResultReceiver receiver);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    oneway void setAvrcpAbsoluteVolume(int volume, in AttributionSource attributionSource);
    oneway void setAvrcpAbsoluteVolume(int volume, in AttributionSource attributionSource);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")