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

Commit 48410cf0 authored by William Escande's avatar William Escande
Browse files

AICS: onExtAudioInDescriptionChanged: skip serialize

Bug: 361263965
Test: atest vc_test
Flag: com.android.bluetooth.flags.leaudio_add_aics_support
Change-Id: I9708db6275710b7f322f62cae8c1c4d079caa1ad
parent cfe847b8
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.bluetooth.vc;

import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_CONNECTION_STATE_CHANGED;
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_OUT_DESCRIPTION_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_OUT_LOCATION_CHANGED;
@@ -171,15 +170,8 @@ class VolumeControlNativeCallback {
    }

    @VisibleForTesting
    void onExtAudioInDescriptionChanged(int externalInputId, String descr, byte[] address) {
        VolumeControlStackEvent event =
                new VolumeControlStackEvent(EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED);
        event.device = getDevice(address);
        event.valueInt1 = externalInputId;
        event.valueString1 = descr;

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

    @VisibleForTesting
+2 −9
Original line number Diff line number Diff line
@@ -1097,10 +1097,9 @@ public class VolumeControlService extends ProfileService {
        input.setType(id, type);
    }

    void handleDeviceExtInputDescriptionChanged(
            BluetoothDevice device, int id, String description) {
    void onExtAudioInDescriptionChanged(BluetoothDevice device, int id, String description) {
        String logInfo =
                "handleDeviceExtInputDescriptionChanged("
                "onExtAudioInDescriptionChanged("
                        + ("device:" + device)
                        + (", id" + id)
                        + (", description" + description)
@@ -1184,12 +1183,6 @@ public class VolumeControlService extends ProfileService {
            return;
        }

        if (stackEvent.type == VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED) {
            handleDeviceExtInputDescriptionChanged(
                    device, stackEvent.valueInt1, stackEvent.valueString1);
            return;
        }

        if (stackEvent.type == VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED) {
            handleDeviceExtInputGainPropsChanged(
                    device,
+0 −5
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_DESCR_CHANGED = 10;
    public static final int EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED = 11;

    public int type;
@@ -81,8 +80,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_DESCR_CHANGED:
                return "EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED";
            case EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED:
                return "EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED";
            default:
@@ -102,7 +99,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_DESCR_CHANGED:
            case EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED:
                return "{ext input id:" + value + "}";
            default:
@@ -168,7 +164,6 @@ public class VolumeControlStackEvent {
    private static String eventTypeString1ToString(int type, String value) {
        switch (type) {
            case EVENT_TYPE_EXT_AUDIO_OUT_DESCRIPTION_CHANGED:
            case EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED:
                return "{description:" + value + "}";
            default:
                break;
+3 −7
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.bluetooth.vc;

import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_CONNECTION_STATE_CHANGED;
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_OUT_DESCRIPTION_CHANGED;
import static com.android.bluetooth.vc.VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_OUT_LOCATION_CHANGED;
@@ -190,14 +189,11 @@ public class VolumeControlNativeCallbackTest {

    @Test
    public void onExtAudioInDescriptionChanged() {
        int externalInputId = 2;
        int id = 2;
        String descr = "microphone";

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

        expect.that(event.type).isEqualTo(EVENT_TYPE_EXT_AUDIO_IN_DESCR_CHANGED);
        mNativeCallback.onExtAudioInDescriptionChanged(id, descr, null);
        verify(mService).onExtAudioInDescriptionChanged(any(), eq(id), eq(descr));
    }

    @Test