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
diff --git a/hal/platform_info.c b/hal/platform_info.c
index e35b7c4..3341f20 100644
--- a/hal/platform_info.c
+++ b/hal/platform_info.c
@@ -639,7 +639,7 @@
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 @@
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 @@
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 @@
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 @@
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;
}