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
This commit is contained in:
Ramjee Singh 2018-08-27 16:22:16 +05:30 committed by Gerrit - the friendly Code Review server
parent e4c9c814bd
commit f57ff2aee6
1 changed files with 7 additions and 11 deletions

View File

@ -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;
}