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

@@ -10,7 +10,7 @@
#include "WVDrmFactory.h"
#include "cutils/properties.h"
#include "android-base/properties.h"
#include "wv_cdm_constants.h"
#include "wv_content_decryption_module.h"
#include "HidlTypes.h"
@@ -57,11 +57,13 @@ Return<void> WVDrmFactory::createPlugin(
bool WVDrmFactory::areSpoidsEnabled() {
// Check what this device's first API level was.
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);
}
return firstApiLevel >= 26; // Android O
}