getOfflineLicenseKeySetIds() respects plugin security level.
[ Merge of http://go/wvgerrit/208430 ]
The MediaDrm plugin API getOfflineLicenseKeySetIds() was listing
both L1 and L3 offline licenses. While this is generally acceptable,
apps might force set L3 via the setStringProperty(), which should
cause the DRM plugin to behave as if it is L3 only.
This change will cause the WVDrmPlugin list L3 only if the app had
set the security level to L3.
Bug: 357863269
Bug: 372105842
Test: DRM Compliance ATP via ABTD
Test: libwvdrmdrmplugin_hal_test on Oriole
Change-Id: I1a6e10b7eb880eef4ba36ed31b12ebfe8617f002
(cherry picked from commit 26b888b094)
This commit is contained in:
@@ -965,21 +965,27 @@ Status WVDrmPlugin::unprovisionDevice() {
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus WVDrmPlugin::getOfflineLicenseKeySetIds(
|
||||
vector<::aidl::android::hardware::drm::KeySetId>* _aidl_return) {
|
||||
_aidl_return->clear();
|
||||
vector<::aidl::android::hardware::drm::KeySetId>* keySetIds) {
|
||||
keySetIds->clear();
|
||||
CdmIdentifier identifier;
|
||||
const auto status = mCdmIdentifierBuilder.getCdmIdentifier(&identifier);
|
||||
if (status != Status::OK) {
|
||||
return toNdkScopedAStatus(status);
|
||||
}
|
||||
|
||||
const std::vector<CdmSecurityLevel> levels = {wvcdm::kSecurityLevelL1,
|
||||
wvcdm::kSecurityLevelL3};
|
||||
std::vector<CdmSecurityLevel> levelsToList;
|
||||
if (mPropertySet.security_level() != wvcdm::QUERY_VALUE_SECURITY_LEVEL_L3) {
|
||||
// Do not list L1 offline licenses if the DRM plugin is in
|
||||
// L3-only mode.
|
||||
levelsToList.push_back(wvcdm::kSecurityLevelL1);
|
||||
}
|
||||
// Always list L3, as "default" may imply either.
|
||||
levelsToList.push_back(wvcdm::kSecurityLevelL3);
|
||||
|
||||
std::vector<CdmKeySetId> allKeySetIds;
|
||||
CdmResponseType res(wvcdm::UNKNOWN_ERROR);
|
||||
bool success = false;
|
||||
for (auto level : levels) {
|
||||
for (const auto& level : levelsToList) {
|
||||
std::vector<CdmKeySetId> levelKeySetIds;
|
||||
res = mCDM->ListStoredLicenses(level, identifier, &levelKeySetIds);
|
||||
|
||||
@@ -1004,15 +1010,13 @@ Status WVDrmPlugin::unprovisionDevice() {
|
||||
// Filter out key sets based on ATSC mode.
|
||||
const auto isAllowedKeySetId =
|
||||
mPropertySet.use_atsc_mode() ? IsAtscKeySetId : IsNotAtscKeySetId;
|
||||
std::vector<KeySetId> keySetIds;
|
||||
keySetIds->reserve(allKeySetIds.size());
|
||||
for (const CdmKeySetId& keySetId : allKeySetIds) {
|
||||
if (isAllowedKeySetId(keySetId)) {
|
||||
keySetIds.push_back(KeySetId{StrToVector(keySetId)});
|
||||
keySetIds->push_back(KeySetId{StrToVector(keySetId)});
|
||||
}
|
||||
}
|
||||
|
||||
*_aidl_return = std::move(keySetIds);
|
||||
return toNdkScopedAStatus(mapCdmResponseType(wvcdm::NO_ERROR));
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus WVDrmPlugin::getOfflineLicenseState(
|
||||
|
||||
Reference in New Issue
Block a user