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

Commit ae1f662a authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

libaudiohal: Allow get/setMasterVolume invocation on IDevice

get/setMasterVolume are defined on IDevice, but DeviceHalHidl
was restricting calls to it only for IPrimaryDevice. This seems
like a bug lingering from the initial implementation of the shim.

Test: make
Change-Id: Ia028959690a5ab71aade14d12d5c12488dc83e41
parent 05677f7f
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -123,15 +123,13 @@ status_t DeviceHalHidl::setVoiceVolume(float volume) {


status_t DeviceHalHidl::setMasterVolume(float volume) {
status_t DeviceHalHidl::setMasterVolume(float volume) {
    if (mDevice == 0) return NO_INIT;
    if (mDevice == 0) return NO_INIT;
    if (mPrimaryDevice == 0) return INVALID_OPERATION;
    return processReturn("setMasterVolume", mDevice->setMasterVolume(volume));
    return processReturn("setMasterVolume", mPrimaryDevice->setMasterVolume(volume));
}
}


status_t DeviceHalHidl::getMasterVolume(float *volume) {
status_t DeviceHalHidl::getMasterVolume(float *volume) {
    if (mDevice == 0) return NO_INIT;
    if (mDevice == 0) return NO_INIT;
    if (mPrimaryDevice == 0) return INVALID_OPERATION;
    Result retval;
    Result retval;
    Return<void> ret = mPrimaryDevice->getMasterVolume(
    Return<void> ret = mDevice->getMasterVolume(
            [&](Result r, float v) {
            [&](Result r, float v) {
                retval = r;
                retval = r;
                if (retval == Result::OK) {
                if (retval == Result::OK) {