libwvhidl: upgrade to android.hardware.drm@1.4

Bug: 136119370
Test: GtsMediaTestCases MediaDrmTest#testRequiresSecureDecoder
Change-Id: Iaaa7c225c0056904b5fd98c4557ec47f661b2c7d
This commit is contained in:
Robert Shih
2021-01-19 05:52:59 -08:00
parent 5eb7d21fd5
commit 56195b41c6
27 changed files with 204 additions and 49 deletions

View File

@@ -88,6 +88,7 @@ cc_library_static {
"android.hardware.drm@1.1",
"android.hardware.drm@1.2",
"android.hardware.drm@1.3",
"android.hardware.drm@1.4",
"android.hidl.memory@1.0",
"libcrypto",
"liblog",

View File

@@ -21,7 +21,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_2 {
namespace V1_4 {
namespace widevine {
using std::map;
@@ -34,7 +34,7 @@ using wvcdm::WvContentDecryptionModule;
const OEMCrypto_Algorithm kInvalidCryptoAlgorithm =
static_cast<OEMCrypto_Algorithm>(-1);
struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
struct WVDrmPlugin : public ::drm::V1_4::IDrmPlugin, IDrmPluginListener,
wvcdm::WvCdmEventListener {
WVDrmPlugin(const sp<WvContentDecryptionModule>& cdm,
@@ -220,6 +220,11 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
Return<void> sendSessionLostState(
const hidl_vec<uint8_t>& sessionId) override;
Return<bool> requiresSecureDecoder(const hidl_string& mime, SecurityLevel level)
override;
Return<bool> requiresSecureDecoderDefault(const hidl_string& mime) override;
// The following methods do not use hidl interface, it is used internally.
virtual Status unprovisionDevice();
@@ -484,7 +489,7 @@ struct WVDrmPlugin : public IDrmPlugin, IDrmPluginListener,
};
} // namespace widevine
} // namespace V1_2
} // namespace V1_4
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -41,7 +41,7 @@ static const std::string kKeyOrigin = "origin";
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_2 {
namespace V1_4 {
namespace widevine {
using android::hardware::drm::V1_2::widevine::toHidlVec;
@@ -1926,6 +1926,35 @@ Return<void> WVDrmPlugin::sendSessionLostState(
return err;
}
Return<bool> WVDrmPlugin::requiresSecureDecoder(
const hidl_string& mime, SecurityLevel level) {
if (!strncasecmp(mime.c_str(), "video/", 6)) {
// Type is video, so check level to see if we require a secure decoder.
return level == SecurityLevel::HW_SECURE_ALL
|| level == SecurityLevel::HW_SECURE_DECODE;
} else {
// Type is not video, so never require a secure decoder.
return false;
}
}
Return<bool> WVDrmPlugin::requiresSecureDecoderDefault(const hidl_string& mime) {
if (!strncasecmp(mime.c_str(), "video/", 6)) {
// Type is video, so check level to see if we require a secure decoder.
std::string level(mPropertySet.security_level());
if (level == kResetSecurityLevel) {
mCDM->QueryStatus(wvcdm::kLevelDefault,
wvcdm::QUERY_KEY_SECURITY_LEVEL, &level);
}
return level == wvcdm::QUERY_VALUE_SECURITY_LEVEL_L1;
} else {
// Type is not video, so never require a secure decoder.
return false;
}
}
void WVDrmPlugin::OnSessionRenewalNeeded(const CdmSessionId& cdmSessionId) {
const std::vector<uint8_t> sessionId = StrToVector(cdmSessionId);
const hidl_vec<uint8_t> data; // data is ignored
@@ -2313,7 +2342,7 @@ uint32_t WVDrmPlugin::CdmIdentifierBuilder::getNextUniqueId() {
}
} // namespace widevine
} // namespace V1_2
} // namespace V1_4
} // namespace drm
} // namespace hardware
} // namespace wvdrm

View File

@@ -100,6 +100,7 @@ LOCAL_SHARED_LIBRARIES := \
android.hardware.drm@1.1 \
android.hardware.drm@1.2 \
android.hardware.drm@1.3 \
android.hardware.drm@1.4 \
android.hidl.memory@1.0 \
libbinder \
libbase \

View File

@@ -31,7 +31,7 @@
namespace wvdrm {
namespace hardware {
namespace drm {
namespace V1_2 {
namespace V1_4 {
namespace widevine {
using android::hardware::drm::V1_2::widevine::toHidlVec;
@@ -3427,7 +3427,7 @@ TEST_F(WVDrmPluginTest, RemoveOfflineLicense) {
}
} // namespace widevine
} // namespace V1_2
} // namespace V1_4
} // namespace drm
} // namespace hardware
} // namespace wvdrm