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

@@ -72,7 +72,7 @@ LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.0 \
android.hardware.drm@1.1 \
android.hardware.drm@1.2 \
libcutils \
libbase \
libdl \
libhidlbase \
libhidlmemory \

View File

@@ -9,6 +9,8 @@
#include "WVDrmFactory.h"
#include "HidlTypes.h"
#include "android-base/properties.h"
namespace wvdrm {
namespace hardware {
namespace drm {
@@ -97,11 +99,13 @@ TEST(WVDrmFactoryTest, DoesNotSupportUnsupportedContainerFormats) {
TEST(WVDrmFactoryTest, CalculatesSpoidUseCorrectly) {
WVDrmFactory factory;
int32_t firstApiLevel = property_get_int32("ro.product.first_api_level", 0);
int32_t firstApiLevel =
android::base::GetIntProperty<int32_t>("ro.product.first_api_level", 0);
if (firstApiLevel == 0) {
// First API Level is 0 on factory ROMs, but we can assume the current SDK
// version is the first if it's a factory ROM.
firstApiLevel = property_get_int32("ro.build.version.sdk", 0);
firstApiLevel =
android::base::GetIntProperty<int32_t>("ro.build.version.sdk", 0);
}
bool shouldUseSpoids = (firstApiLevel >= 26); // Android O