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

Commit 0a3c1b0e authored by Kevin Rocard's avatar Kevin Rocard Committed by Arne Coucheron
Browse files

HAL: Align error code with HIDL wrapper



Here is how the HIDL wrapper interprets status error codes:
0         => Result::OK
-EINVAL   => Result::INVALID_ARGUMENTS
-ENODATA  => Result::INVALID_STATE
-ENODEV   => Result::NOT_INITIALIZED
-ENOSYS   => Result::NOT_SUPPORTED
otherwise => Result::INVALID_STATE

This is consistent with most of the hal.
This patch changes the few places where it was not to unify the
behaviours.

Test: vts-tradefed run vts --module VtsHalAudioV2_0Target
Test: call/play music/record/video...
Bug: 36311550
Change-Id: Id821d15ae3269cd2c9699924e2b174c7347a6d07
Signed-off-by: default avatarKevin Rocard <krocard@google.com>
parent 063824f6
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -2055,7 +2055,7 @@ static int out_get_render_position(const struct audio_stream_out *stream,
            return 0;
        }
    } else
        return -EINVAL;
        return -ENODATA;
}

static int out_add_audio_effect(const struct audio_stream *stream __unused,
@@ -2073,14 +2073,14 @@ static int out_remove_audio_effect(const struct audio_stream *stream __unused,
static int out_get_next_write_timestamp(const struct audio_stream_out *stream __unused,
                                        int64_t *timestamp __unused)
{
    return -EINVAL;
    return -ENOSYS;
}

static int out_get_presentation_position(const struct audio_stream_out *stream,
                                   uint64_t *frames, struct timespec *timestamp)
{
    struct stream_out *out = (struct stream_out *)stream;
    int ret = -1;
    int ret = -ENODATA;
    unsigned long dsp_frames;

    lock_output_stream(out);
@@ -2381,7 +2381,7 @@ static char* in_get_parameters(const struct audio_stream *stream,
static int in_set_gain(struct audio_stream_in *stream __unused,
                       float gain __unused)
{
    return 0;
    return -ENOSYS;
}

static ssize_t in_read(struct audio_stream_in *stream, void *buffer,