Update property retrival method

[ Merge of http://go/wvgerrit/70203 ]

The earlier property_get() method had a limitation on property length.
Properties of some new devices exceed that length. An error message
is returned rather than a truncated string. Replace its use with
android::base::GetProperty() which does not have a length limitation.

Bug: 115358798
Test: WV unit/integration tests
Change-Id: I46ce9a7e77bcd031225d0082f83c57d484fe5405
This commit is contained in:
Rahul Frias
2019-01-11 00:57:32 -08:00
parent a4e66ac673
commit ef00d6ffa5
20 changed files with 49 additions and 38 deletions

View File

@@ -9,7 +9,7 @@
#include <sstream>
#include <string>
#include <cutils/properties.h>
#include <android-base/properties.h>
#include "log.h"
@@ -24,7 +24,6 @@ const char kFactoryKeyboxPath[] = "/factory/wv.keys";
const char kWVCdmVersion[] = "15.0.0";
bool GetAndroidProperty(const char* key, std::string* value) {
char val[PROPERTY_VALUE_MAX];
if (!key) {
LOGW("GetAndroidProperty: Invalid property key parameter");
return false;
@@ -35,10 +34,9 @@ bool GetAndroidProperty(const char* key, std::string* value) {
return false;
}
if (property_get(key, val, "Unknown") <= 0) return false;
*value = android::base::GetProperty(key, "");
*value = val;
return true;
return value->size() > 0;
}
} // namespace