Add ATSC support - part 1
[ Merge of http://go/wvgerrit/100864 and http://go/ag/10704773 ] ATSC 3.0 allows for licenses to be downloaded OTA and are tied to a DRM certificate that may be shared across apps. The provisioning process for ATSC may happen at the factory or during an OS update. This contrasts from the regular OTT model, which requires that provisioning and license download have an uplink as well as a downlink connection. This adds support for the ATSC mode property. ATSC mode can only be set (or unset) before sessions are opened. Once the CDM identifier is set/sealed, requests to modify the ATSC mode will be rejected. If one needs to open sessions with both ATSC mode and regular (non-ATSC) mode, separate MediaDrm objects will need to be created. The default mode is to not use ATSC. Enable ATSC mode by calling mediaDrm.setPropertyString("atscMode", "enable") Disable ATSC mode by calling mediaDrm.setPropertyString("atscMode", "disable") Provisioning and unprovisioning requests for ATSC will be rejected as certificates will be retrieved by the ATSC service. Bug: 139730600 Test: WV unit/integration test, GtsMediaTestCases Change-Id: I142f286c711fe007ff42125c3c8cdc6450b6ea36
This commit is contained in:
@@ -700,6 +700,12 @@ Return<void> WVDrmPlugin::getProvisionRequest_1_2(
|
||||
std::string defaultUrl;
|
||||
std::vector<uint8_t> request;
|
||||
|
||||
if (mPropertySet.use_atsc_mode()) {
|
||||
_hidl_cb(mapCdmResponseType_1_2(wvcdm::PROVISIONING_NOT_ALLOWED_FOR_ATSC),
|
||||
toHidlVec(request), hidl_string(defaultUrl));
|
||||
return Void();
|
||||
}
|
||||
|
||||
CdmIdentifier identifier;
|
||||
status = static_cast<Status_V1_2>(mCdmIdentifierBuilder.getCdmIdentifier(&identifier));
|
||||
if (status != Status_V1_2::OK) {
|
||||
@@ -1261,6 +1267,12 @@ Return<void> WVDrmPlugin::getPropertyString(const hidl_string& propertyName,
|
||||
status = queryProperty(wvcdm::QUERY_KEY_MAX_USAGE_TABLE_ENTRIES, value);
|
||||
} else if (name == "oemCryptoApiMinorVersion") {
|
||||
status = queryProperty(wvcdm::QUERY_KEY_OEMCRYPTO_API_MINOR_VERSION, value);
|
||||
} else if (name == "atscMode") {
|
||||
if (mPropertySet.use_atsc_mode()) {
|
||||
value = kEnable;
|
||||
} else {
|
||||
value = kDisable;
|
||||
}
|
||||
} else {
|
||||
ALOGE("App requested unknown string property %s", name.c_str());
|
||||
status = Status::ERROR_DRM_CANNOT_HANDLE;
|
||||
@@ -1413,6 +1425,23 @@ Return<Status> WVDrmPlugin::setPropertyString(const hidl_string& propertyName,
|
||||
return mapCdmResponseType(res);
|
||||
} else if (name == "decryptHashSessionId") {
|
||||
mDecryptHashSessionId = _value.c_str();
|
||||
} else if (name == "atscMode") {
|
||||
if (_value == kEnable) {
|
||||
if (!mCdmIdentifierBuilder.set_use_atsc_mode(true)) {
|
||||
ALOGE("Cdm identifier builder is sealed. Setting ATSC mode prohibited");
|
||||
return Status::BAD_VALUE;
|
||||
}
|
||||
mPropertySet.set_use_atsc_mode(true);
|
||||
} else if (_value == kDisable) {
|
||||
if (!mCdmIdentifierBuilder.set_use_atsc_mode(false)) {
|
||||
ALOGE("Cdm identifier builder is sealed. Setting ATSC mode prohibited");
|
||||
return Status::BAD_VALUE;
|
||||
}
|
||||
mPropertySet.set_use_atsc_mode(false);
|
||||
} else {
|
||||
ALOGE("App requested unknown ATSC mode %s", _value.c_str());
|
||||
return Status::BAD_VALUE;
|
||||
}
|
||||
} else {
|
||||
ALOGE("App set unknown string property %s", name.c_str());
|
||||
return Status::ERROR_DRM_CANNOT_HANDLE;
|
||||
@@ -2077,6 +2106,9 @@ bool WVDrmPlugin::initDataResemblesPSSH(const std::vector<uint8_t>& initData) {
|
||||
}
|
||||
|
||||
Status WVDrmPlugin::unprovision(const CdmIdentifier& identifier) {
|
||||
if (mPropertySet.use_atsc_mode())
|
||||
return mapCdmResponseType(wvcdm::PROVISIONING_NOT_ALLOWED_FOR_ATSC);
|
||||
|
||||
CdmResponseType res1 = mCDM->Unprovision(wvcdm::kSecurityLevelL1, identifier);
|
||||
CdmResponseType res3 = mCDM->Unprovision(wvcdm::kSecurityLevelL3, identifier);
|
||||
if (!isCdmResponseTypeSuccess(res1))
|
||||
@@ -2149,6 +2181,13 @@ bool WVDrmPlugin::CdmIdentifierBuilder::set_origin(const std::string& id) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WVDrmPlugin::CdmIdentifierBuilder::set_use_atsc_mode(bool enable) {
|
||||
if (is_sealed()) return false;
|
||||
mCdmIdentifier.app_package_name =
|
||||
enable ? wvcdm::ATSC_APP_PACKAGE_NAME : mAppPackageName;
|
||||
return true;
|
||||
}
|
||||
|
||||
Status WVDrmPlugin::CdmIdentifierBuilder::calculateSpoid() {
|
||||
if (mUseSpoid) {
|
||||
std::string deviceId;
|
||||
@@ -2159,7 +2198,8 @@ Status WVDrmPlugin::CdmIdentifierBuilder::calculateSpoid() {
|
||||
SHA256_CTX ctx;
|
||||
SHA256_Init(&ctx);
|
||||
SHA256_Update(&ctx, deviceId.data(), deviceId.length());
|
||||
SHA256_Update(&ctx, mAppPackageName.data(), mAppPackageName.length());
|
||||
SHA256_Update(&ctx, mCdmIdentifier.app_package_name.data(),
|
||||
mCdmIdentifier.app_package_name.length());
|
||||
SHA256_Update(&ctx, origin().data(), origin().length());
|
||||
SHA256_Final(hash, &ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user