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

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

AICS: Check mute value and update to int type

Bug: 361263965
Test: atest vc_test
Flag: com.android.bluetooth.flags.leaudio_add_aics_support
Change-Id: I7b0a28408752dcb16d68c36d9ed9693c2c5579e5
parent 03544e4c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ public:
  }

  void OnExtAudioInStateChanged(const RawAddress& bd_addr, uint8_t ext_input_id, int8_t gain_val,
                                uint8_t gain_mode, bool mute) override {
                                uint8_t gain_mode, uint8_t mute) override {
    log::info("");

    std::shared_lock<std::shared_timed_mutex> lock(callbacks_mutex);
@@ -237,7 +237,7 @@ public:
    sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress),
                                     reinterpret_cast<const jbyte*>(&bd_addr));
    sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onExtAudioInStateChanged, (jint)ext_input_id,
                                 (jint)gain_val, (jint)gain_mode, (jboolean)mute, addr.get());
                                 (jint)gain_val, (jint)gain_mode, (jint)mute, addr.get());
  }

  void OnExtAudioInStatusChanged(const RawAddress& bd_addr, uint8_t ext_input_id,
@@ -893,7 +893,7 @@ int register_com_android_bluetooth_vc(JNIEnv* env) {
          {"onExtAudioOutLocationChanged", "(II[B)V", &method_onExtAudioOutLocationChanged},
          {"onExtAudioOutDescriptionChanged", "(ILjava/lang/String;[B)V",
           &method_onExtAudioOutDescriptionChanged},
          {"onExtAudioInStateChanged", "(IIIZ[B)V", &method_onExtAudioInStateChanged},
          {"onExtAudioInStateChanged", "(IIII[B)V", &method_onExtAudioInStateChanged},
          {"onExtAudioInStatusChanged", "(II[B)V", &method_onExtAudioInStatusChanged},
          {"onExtAudioInTypeChanged", "(II[B)V", &method_onExtAudioInTypeChanged},
          {"onExtAudioInGainPropsChanged", "(IIII[B)V", &method_onExtAudioInGainPropsChanged},
+7 −7
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ class VolumeControlInputDescriptor {
         */
        int mGainMode = 0;

        boolean mIsMute = false;
        int mMute = 2; // DISABLED

        /* See AICS 1.0
         * The Gain_Setting (mGainValue) field is a signed value for which a single increment or
@@ -113,9 +113,9 @@ class VolumeControlInputDescriptor {
        return mVolumeInputs[id].mGainValue;
    }

    boolean isMuted(int id) {
        if (!isValidId(id)) return false;
        return mVolumeInputs[id].mIsMute;
    int getMute(int id) {
        if (!isValidId(id)) return 2; // MuteField.DISABLED
        return mVolumeInputs[id].mMute;
    }

    void setPropSettings(int id, int gainUnit, int gainMin, int gainMax) {
@@ -126,7 +126,7 @@ class VolumeControlInputDescriptor {
        mVolumeInputs[id].mGainSettingsMaxSetting = gainMax;
    }

    void setState(int id, int gainValue, int gainMode, boolean mute) {
    void setState(int id, int gainValue, int gainMode, int mute) {
        if (!isValidId(id)) return;

        Descriptor desc = mVolumeInputs[id];
@@ -138,7 +138,7 @@ class VolumeControlInputDescriptor {

        desc.mGainValue = gainValue;
        desc.mGainMode = gainMode;
        desc.mIsMute = mute;
        desc.mMute = mute;
    }

    void dump(StringBuilder sb) {
@@ -150,7 +150,7 @@ class VolumeControlInputDescriptor {
            ProfileService.println(sb, "        status: " + desc.mStatus);
            ProfileService.println(sb, "        gainValue: " + desc.mGainValue);
            ProfileService.println(sb, "        gainMode: " + desc.mGainMode);
            ProfileService.println(sb, "        mute: " + desc.mIsMute);
            ProfileService.println(sb, "        mute: " + desc.mMute);
            ProfileService.println(sb, "        units:" + desc.mGainSettingsUnits);
            ProfileService.println(sb, "        minGain:" + desc.mGainSettingsMinSetting);
            ProfileService.println(sb, "        maxGain:" + desc.mGainSettingsMaxSetting);
+2 −2
Original line number Diff line number Diff line
@@ -454,7 +454,7 @@ public class VolumeControlNativeInterface {

    @VisibleForTesting
    void onExtAudioInStateChanged(
            int externalInputId, int gainValue, int gainMode, boolean mute, byte[] address) {
            int externalInputId, int gainValue, int gainMode, int mute, byte[] address) {
        VolumeControlStackEvent event =
                new VolumeControlStackEvent(
                        VolumeControlStackEvent.EVENT_TYPE_EXT_AUDIO_IN_STATE_CHANGED);
@@ -462,7 +462,7 @@ public class VolumeControlNativeInterface {
        event.valueInt1 = externalInputId;
        event.valueInt2 = gainValue;
        event.valueInt3 = gainMode;
        event.valueBool1 = mute;
        event.valueInt4 = mute;

        Log.d(TAG, "onExtAudioInStateChanged: " + event);
        sendMessageToService(event);
+2 −2
Original line number Diff line number Diff line
@@ -1022,7 +1022,7 @@ public class VolumeControlService extends ProfileService {
    }

    void handleDeviceExtInputStateChanged(
            BluetoothDevice device, int id, int gainValue, int gainMode, boolean mute) {
            BluetoothDevice device, int id, int gainValue, int gainMode, int mute) {
        String logInfo =
                "handleDeviceExtInputStateChanged("
                        + ("device:" + device)
@@ -1177,7 +1177,7 @@ public class VolumeControlService extends ProfileService {
                    stackEvent.valueInt1,
                    stackEvent.valueInt2,
                    stackEvent.valueInt3,
                    stackEvent.valueBool1);
                    stackEvent.valueInt4);
            return;
        }

+2 −1
Original line number Diff line number Diff line
@@ -159,6 +159,8 @@ public class VolumeControlStackEvent {
        switch (type) {
            case EVENT_TYPE_EXT_AUDIO_IN_GAIN_PROPS_CHANGED:
                return "{gain set max:" + value + "}";
            case EVENT_TYPE_EXT_AUDIO_IN_STATE_CHANGED:
                return "{mute:" + value + "}";
            default:
                break;
        }
@@ -168,7 +170,6 @@ public class VolumeControlStackEvent {
    private static String eventTypeValueBool1ToString(int type, boolean value) {
        switch (type) {
            case EVENT_TYPE_VOLUME_STATE_CHANGED:
            case EVENT_TYPE_EXT_AUDIO_IN_STATE_CHANGED:
                return "{muted:" + value + "}";
            default:
                break;
Loading