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:
@@ -5,6 +5,7 @@ LOCAL_CFLAGS := \
|
||||
-Wno-unused \
|
||||
-Wno-unused-parameter
|
||||
LOCAL_C_INCLUDES := \
|
||||
system/core/base/include \
|
||||
system/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/util/include \
|
||||
|
||||
@@ -5,6 +5,7 @@ LOCAL_CFLAGS := \
|
||||
-Wno-unused \
|
||||
-Wno-unused-parameter
|
||||
LOCAL_C_INCLUDES := \
|
||||
system/core/base/include \
|
||||
system/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/util/include \
|
||||
|
||||
@@ -5,6 +5,7 @@ LOCAL_CFLAGS := \
|
||||
-Wno-unused \
|
||||
-Wno-unused-parameter
|
||||
LOCAL_C_INCLUDES := \
|
||||
system/core/base/include \
|
||||
system/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/util/include \
|
||||
|
||||
@@ -5,6 +5,7 @@ LOCAL_CFLAGS := \
|
||||
-Wno-unused \
|
||||
-Wno-unused-parameter
|
||||
LOCAL_C_INCLUDES := \
|
||||
system/core/base/include \
|
||||
system/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/util/include \
|
||||
|
||||
@@ -2,31 +2,29 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
// The function property_get is defined differently if it comes from the IN_APP
|
||||
// version or from the Android OS.
|
||||
#if defined(IN_APP_FASTBALL)
|
||||
#include "properties_fastball.h"
|
||||
#else
|
||||
#include <cutils/properties.h>
|
||||
#include <android-base/properties.h>
|
||||
#endif
|
||||
|
||||
namespace wvoec3 {
|
||||
|
||||
const char *getUniqueID(size_t *len) {
|
||||
static char temp_value[PROPERTY_VALUE_MAX * 2];
|
||||
int actual_len = property_get("ro.serialno", temp_value, NULL);
|
||||
if (actual_len <= 0) {
|
||||
actual_len = property_get("net.hostname", temp_value, NULL);
|
||||
}
|
||||
if (actual_len <= 0) {
|
||||
strncpy(temp_value, "0123456789abc", PROPERTY_VALUE_MAX);
|
||||
static std::string unique_id;
|
||||
unique_id = android::base::GetProperty("ro.serialno", "");
|
||||
if (unique_id.empty()) {
|
||||
unique_id = android::base::GetProperty("net.hostname", "0123456789abc");
|
||||
}
|
||||
#if defined(IN_APP_FASTBALL) || defined(IN_APP_MOVIES)
|
||||
actual_len +=
|
||||
property_get("package.name", temp_value + actual_len, "com.google.inapp");
|
||||
unique_id += android::base::GetProperty("package.name", "com.google.inapp");
|
||||
#endif
|
||||
*len = actual_len;
|
||||
return temp_value;
|
||||
*len = unique_id.size();
|
||||
return unique_id.c_str();
|
||||
}
|
||||
|
||||
} // namespace wvoec3
|
||||
|
||||
@@ -5,6 +5,7 @@ LOCAL_CFLAGS := \
|
||||
-Wno-unused \
|
||||
-Wno-unused-parameter
|
||||
LOCAL_C_INCLUDES := \
|
||||
system/core/base/include \
|
||||
system/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/util/include \
|
||||
|
||||
@@ -5,6 +5,7 @@ LOCAL_CFLAGS := \
|
||||
-Wno-unused \
|
||||
-Wno-unused-parameter
|
||||
LOCAL_C_INCLUDES := \
|
||||
system/core/base/include \
|
||||
system/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/core/include \
|
||||
vendor/widevine/libwvdrmengine/cdm/util/include \
|
||||
|
||||
Reference in New Issue
Block a user