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

Commit cfe847b8 authored by William Escande's avatar William Escande
Browse files

AICS: onExtAudioInTypeChanged: skip serialize

Bug: 361263965
Test: atest vc_test
Flag: com.android.bluetooth.flags.leaudio_add_aics_support
Change-Id: Ibfb4d480933630a37738b2a6664d185ebb421d3c
parent d1a4aa17
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_CONNEC
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_DEVICE_AVAILABLE;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_TYPE_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_OUT_DESCRIPTION_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_OUT_LOCATION_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_OUT_VOL_OFFSET_CHANGED;
@@ -167,15 +166,8 @@ class VolumeControlNativeCallback {
    }

    @VisibleForTesting
    void onExtAudioInTypeChanged(int externalInputId, int type, byte[] address) {
        VolumeControlStackEvent event =
                new VolumeControlStackEvent(EVENT_TYPE_EXT_AUDIO_IN_TYPE_CHANGED);
        event.device = getDevice(address);
        event.valueInt1 = externalInputId;
        event.valueInt2 = type;

        Log.d(TAG, "onExtAudioInTypeChanged: " + event);
        mVolumeControlService.messageFromNative(event);
    void onExtAudioInTypeChanged(int id, int type, byte[] address) {
        sendMessageToService(s -> s.onExtAudioInTypeChanged(getDevice(address), id, type));
    }

    @VisibleForTesting
+2 −7
Original line number Diff line number Diff line
@@ -1074,9 +1074,9 @@ public class VolumeControlService extends ProfileService {
        input.setStatus(id, status);
    }

    void handleDeviceExtInputTypeChanged(BluetoothDevice device, int id, int type) {
    void onExtAudioInTypeChanged(BluetoothDevice device, int id, int type) {
        String logInfo =
                "handleDeviceExtInputTypeChanged("
                "onExtAudioInTypeChanged("
                        + ("device:" + device)
                        + (", id" + id)
                        + (", type" + type)
@@ -1184,11 +1184,6 @@ public class VolumeControlService extends ProfileService {
            return;
        }

        if (stackEvent.type == VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_TYPE_CHANGED) {
            handleDeviceExtInputTypeChanged(device, stackEvent.valueInt1, stackEvent.valueInt2);
            return;
        }

        if (stackEvent.type == VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED) {
            handleDeviceExtInputDescriptionChanged(
                    device, stackEvent.valueInt1, stackEvent.valueString1);
+0 −6
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ public class VolumeControlStackEvent {
    public static final int EVENT_TYPE_EXT_AUDIO_OUT_VOL_OFFSET_CHANGED = 4;
    public static final int EVENT_TYPE_EXT_AUDIO_OUT_LOCATION_CHANGED = 5;
    public static final int EVENT_TYPE_EXT_AUDIO_OUT_DESCRIPTION_CHANGED = 6;
    public static final int EVENT_TYPE_EXT_AUDIO_IN_TYPE_CHANGED = 9;
    public static final int EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED = 10;
    public static final int EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED = 11;

@@ -82,8 +81,6 @@ public class VolumeControlStackEvent {
                return "EVENT_TYPE_EXT_AUDIO_OUT_LOCATION_CHANGED";
            case EVENT_TYPE_EXT_AUDIO_OUT_DESCRIPTION_CHANGED:
                return "EVENT_TYPE_EXT_AUDIO_OUT_DESCRIPTION_CHANGED";
            case EVENT_TYPE_EXT_AUDIO_IN_TYPE_CHANGED:
                return "EVENT_TYPE_EXT_AUDIO_IN_TYPE_CHANGED";
            case EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED:
                return "EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED";
            case EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED:
@@ -105,7 +102,6 @@ public class VolumeControlStackEvent {
            case EVENT_TYPE_EXT_AUDIO_OUT_LOCATION_CHANGED:
            case EVENT_TYPE_EXT_AUDIO_OUT_DESCRIPTION_CHANGED:
                return "{ext output id:" + value + "}";
            case EVENT_TYPE_EXT_AUDIO_IN_TYPE_CHANGED:
            case EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED:
            case EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED:
                return "{ext input id:" + value + "}";
@@ -123,8 +119,6 @@ public class VolumeControlStackEvent {
                return "{volume:" + value + "}";
            case EVENT_TYPE_DEVICE_AVAILABLE:
                return "{num_ext_inputs:" + value + "}";
            case EVENT_TYPE_EXT_AUDIO_IN_TYPE_CHANGED:
                return "{type:" + value + "}";
            default:
                break;
        }
+3 −7
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_CONNEC
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_DEVICE_AVAILABLE;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_TYPE_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_OUT_DESCRIPTION_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_OUT_LOCATION_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_OUT_VOL_OFFSET_CHANGED;
@@ -182,14 +181,11 @@ public class VolumeControlNativeCallbackTest {

    @Test
    public void onExtAudioInTypeChanged() {
        int externalInputId = 2;
        int id = 2;
        int type = 1;

        mNativeCallback.onExtAudioInTypeChanged(externalInputId, type, null);
        verify(mService).messageFromNative(mEvent.capture());
        VolumeControlStackEvent event = mEvent.getValue();

        expect.that(event.type).isEqualTo(EVENT_TYPE_EXT_AUDIO_IN_TYPE_CHANGED);
        mNativeCallback.onExtAudioInTypeChanged(id, type, null);
        verify(mService).onExtAudioInTypeChanged(any(), eq(id), eq(type));
    }

    @Test