audio: Implement getters for hardware mixer controls
The VTS test for volume accessors first determines whether
the accessor is supported by calling the getter. The getter
must return `UNSUPPORTED_OPERATION` if the control is not
supported. For this reason, wire the getter to the hardware
mixer implementation.
Bug: 302132812
Test: atest VtsHalAudioCoreTargetTest
Change-Id: Ia50def0d076b6d3c46db55123186eab34bbbb954
diff --git a/audio/aidl/default/alsa/Mixer.h b/audio/aidl/default/alsa/Mixer.h
index 8fba1e0..41f19a8 100644
--- a/audio/aidl/default/alsa/Mixer.h
+++ b/audio/aidl/default/alsa/Mixer.h
@@ -39,6 +39,11 @@
bool isValid() const { return mMixer != nullptr; }
+ ndk::ScopedAStatus getMasterMute(bool* muted);
+ ndk::ScopedAStatus getMasterVolume(float* volume);
+ ndk::ScopedAStatus getMicGain(float* gain);
+ ndk::ScopedAStatus getMicMute(bool* muted);
+ ndk::ScopedAStatus getVolumes(std::vector<float>* volumes);
ndk::ScopedAStatus setMasterMute(bool muted);
ndk::ScopedAStatus setMasterVolume(float volume);
ndk::ScopedAStatus setMicGain(float gain);
@@ -60,9 +65,16 @@
static const std::map<Control, std::vector<ControlNamesAndExpectedCtlType>> kPossibleControls;
static Controls initializeMixerControls(struct mixer* mixer);
+ ndk::ScopedAStatus findControl(Control ctl, struct mixer_ctl** result);
+ ndk::ScopedAStatus getMixerControlMute(Control ctl, bool* muted);
+ ndk::ScopedAStatus getMixerControlVolume(Control ctl, float* volume);
ndk::ScopedAStatus setMixerControlMute(Control ctl, bool muted);
ndk::ScopedAStatus setMixerControlVolume(Control ctl, float volume);
+ int getMixerControlPercent(struct mixer_ctl* ctl, std::vector<int>* percents)
+ REQUIRES(mMixerAccess);
+ int getMixerControlValues(struct mixer_ctl* ctl, std::vector<int>* values)
+ REQUIRES(mMixerAccess);
int setMixerControlPercent(struct mixer_ctl* ctl, int percent) REQUIRES(mMixerAccess);
int setMixerControlPercent(struct mixer_ctl* ctl, const std::vector<int>& percents)
REQUIRES(mMixerAccess);