[ 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
77 lines
2.1 KiB
C++
77 lines
2.1 KiB
C++
//
|
|
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine Master
|
|
// License Agreement.
|
|
//
|
|
|
|
//#define LOG_NDEBUG 0
|
|
#define LOG_TAG "WVCdm"
|
|
#include <utils/Log.h>
|
|
|
|
#include "WVDrmFactory.h"
|
|
|
|
#include "android-base/properties.h"
|
|
#include "wv_cdm_constants.h"
|
|
#include "wv_content_decryption_module.h"
|
|
#include "HidlTypes.h"
|
|
#include "WVCDMSingleton.h"
|
|
#include "WVDrmPlugin.h"
|
|
#include "WVUUID.h"
|
|
|
|
namespace wvdrm {
|
|
namespace hardware {
|
|
namespace drm {
|
|
namespace V1_2 {
|
|
namespace widevine {
|
|
|
|
WVGenericCryptoInterface WVDrmFactory::sOemCryptoInterface;
|
|
|
|
Return<bool> WVDrmFactory::isCryptoSchemeSupported(
|
|
const hidl_array<uint8_t, 16>& uuid) {
|
|
return isWidevineUUID(uuid.data());
|
|
}
|
|
|
|
Return<bool> WVDrmFactory::isContentTypeSupported(
|
|
const hidl_string& initDataType) {
|
|
return wvcdm::WvContentDecryptionModule::IsSupported(initDataType.c_str());
|
|
}
|
|
|
|
Return<void> WVDrmFactory::createPlugin(
|
|
const hidl_array<uint8_t, 16>& uuid,
|
|
const hidl_string& appPackageName,
|
|
createPlugin_cb _hidl_cb) {
|
|
|
|
WVDrmPlugin *plugin = NULL;
|
|
if (!isCryptoSchemeSupported(uuid.data())) {
|
|
ALOGE("Widevine Drm HAL: failed to create drm plugin, " \
|
|
"invalid crypto scheme");
|
|
_hidl_cb(Status::ERROR_DRM_CANNOT_HANDLE, plugin);
|
|
return Void();
|
|
}
|
|
|
|
plugin = new WVDrmPlugin(getCDM(), appPackageName.c_str(),
|
|
&sOemCryptoInterface, areSpoidsEnabled());
|
|
_hidl_cb(Status::OK, plugin);
|
|
return Void();
|
|
}
|
|
|
|
bool WVDrmFactory::areSpoidsEnabled() {
|
|
// Check what this device's first API level was.
|
|
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 =
|
|
android::base::GetIntProperty<int32_t>("ro.build.version.sdk", 0);
|
|
}
|
|
return firstApiLevel >= 26; // Android O
|
|
}
|
|
|
|
|
|
} // namespace widevine
|
|
} // namespace V1_2
|
|
} // namespace drm
|
|
} // namespace hardware
|
|
} // namespace wvdrm
|