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

Commit 695a3c37 authored by Ramjee Singh's avatar Ramjee Singh Committed by Gerrit - the friendly Code Review server
Browse files

hal: Fix for parsing platform info xml.

- platform_info contains three values for orientation and
  geo location. platform_info core logic only parses 2
  fields.
- Fix is to parse all fields for orientation and mic geo
  location.

Change-Id: I787a11531301fa7b0fdd15d3f82ffb6a72b41a9a
parent 8f5e3372
Loading
Loading
Loading
Loading
+7 −11
Original line number Diff line number Diff line
@@ -639,7 +639,7 @@ static void process_microphone_characteristic(const XML_Char **attr) {
        goto done;
    }
    microphone.num_frequency_responses = atoi(attr[curIdx++]);
    if (microphone.num_frequency_responses >= AUDIO_MICROPHONE_MAX_FREQUENCY_RESPONSES) {
    if (microphone.num_frequency_responses > AUDIO_MICROPHONE_MAX_FREQUENCY_RESPONSES) {
        ALOGE("%s: num_frequency_responses is too large", __func__);
        goto done;
    }
@@ -654,8 +654,7 @@ static void process_microphone_characteristic(const XML_Char **attr) {
        while (token) {
            microphone.frequency_responses[0][num_frequencies++] = atof(token);
            if (num_frequencies >= AUDIO_MICROPHONE_MAX_FREQUENCY_RESPONSES) {
                ALOGE("%s: num %u of frequency is too large", __func__, num_frequencies);
                goto done;
                break;
            }
            token = strtok_r(NULL, " ", &context);
        }
@@ -669,8 +668,7 @@ static void process_microphone_characteristic(const XML_Char **attr) {
        while (token) {
            microphone.frequency_responses[1][num_responses++] = atof(token);
            if (num_responses >= AUDIO_MICROPHONE_MAX_FREQUENCY_RESPONSES) {
                ALOGE("%s: num %u of response is too large", __func__, num_responses);
                goto done;
                break;
            }
            token = strtok_r(NULL, " ", &context);
        }
@@ -725,12 +723,11 @@ static void process_microphone_characteristic(const XML_Char **attr) {
        while (token) {
            orientation[idx++] = atof(token);
            if (idx >= 3) {
                ALOGE("%s: orientation invalid", __func__);
                goto done;
                break;
            }
            token = strtok_r(NULL, " ", &context);
        }
        if (idx != 2) {
        if (idx != 3) {
            ALOGE("%s: orientation invalid", __func__);
            goto done;
        }
@@ -755,12 +752,11 @@ static void process_microphone_characteristic(const XML_Char **attr) {
        while (token) {
            geometric_location[idx++] = atof(token);
            if (idx >= 3) {
                ALOGE("%s: geometric_location invalid", __func__);
                goto done;
                break;
            }
            token = strtok_r(NULL, " ", &context);
        }
        if (idx != 2) {
        if (idx != 3) {
            ALOGE("%s: geometric_location invalid", __func__);
            goto done;
        }