Replace generic OnEvent with actual event callbacks
Also pass session_id and event_listener to PolicyEngine to make it easier to dispatch events from PolicyEngine. Bug: 19771437 Merged from Widevine CDM repo: https://widevine-internal-review.googlesource.com/#/c/13816/ Change-Id: I5723cb371cb3c43c945051af3402b09069ba5859
This commit is contained in:
@@ -32,7 +32,6 @@ using android::status_t;
|
||||
using android::String8;
|
||||
using android::Vector;
|
||||
using std::map;
|
||||
using wvcdm::CdmEventType;
|
||||
using wvcdm::CdmSessionId;
|
||||
using wvcdm::CdmResponseType;
|
||||
using wvcdm::WvContentDecryptionModule;
|
||||
@@ -140,8 +139,9 @@ class WVDrmPlugin : public android::DrmPlugin,
|
||||
const Vector<uint8_t>& wrappedKey,
|
||||
Vector<uint8_t>& signature);
|
||||
|
||||
virtual void OnEvent(const CdmSessionId& cdmSessionId,
|
||||
CdmEventType cdmEventType);
|
||||
virtual void OnSessionRenewalNeeded(const CdmSessionId& cdmSessionId);
|
||||
|
||||
virtual void OnSessionExpiration(const CdmSessionId& cdmSessionId);
|
||||
|
||||
private:
|
||||
DISALLOW_EVIL_CONSTRUCTORS(WVDrmPlugin);
|
||||
|
||||
@@ -940,25 +940,18 @@ status_t WVDrmPlugin::signRSA(const Vector<uint8_t>& /* sessionId */,
|
||||
return android::OK;
|
||||
}
|
||||
|
||||
void WVDrmPlugin::OnEvent(const CdmSessionId& cdmSessionId,
|
||||
CdmEventType cdmEventType) {
|
||||
void WVDrmPlugin::OnSessionRenewalNeeded(const CdmSessionId& cdmSessionId) {
|
||||
Vector<uint8_t> sessionId;
|
||||
EventType eventType = kDrmPluginEventVendorDefined;
|
||||
|
||||
switch (cdmEventType) {
|
||||
case LICENSE_EXPIRED_EVENT:
|
||||
eventType = kDrmPluginEventKeyExpired;
|
||||
break;
|
||||
case LICENSE_RENEWAL_NEEDED_EVENT:
|
||||
eventType = kDrmPluginEventKeyNeeded;
|
||||
break;
|
||||
}
|
||||
|
||||
sessionId.appendArray(reinterpret_cast<const uint8_t*>(cdmSessionId.data()),
|
||||
cdmSessionId.size());
|
||||
sendEvent(kDrmPluginEventKeyNeeded, 0, &sessionId, NULL);
|
||||
}
|
||||
|
||||
// Call base-class method with translated event.
|
||||
sendEvent(eventType, 0, &sessionId, NULL);
|
||||
void WVDrmPlugin::OnSessionExpiration(const CdmSessionId& cdmSessionId) {
|
||||
Vector<uint8_t> sessionId;
|
||||
sessionId.appendArray(reinterpret_cast<const uint8_t*>(cdmSessionId.data()),
|
||||
cdmSessionId.size());
|
||||
sendEvent(kDrmPluginEventKeyExpired, 0, &sessionId, NULL);
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::mapAndNotifyOfCdmResponseType(
|
||||
|
||||
@@ -1200,8 +1200,8 @@ TEST_F(WVDrmPluginTest, MarshalsEvents) {
|
||||
status_t res = plugin.setListener(listener);
|
||||
ASSERT_EQ(OK, res);
|
||||
|
||||
plugin.OnEvent(cdmSessionId, LICENSE_EXPIRED_EVENT);
|
||||
plugin.OnEvent(cdmSessionId, LICENSE_RENEWAL_NEEDED_EVENT);
|
||||
plugin.OnSessionExpiration(cdmSessionId);
|
||||
plugin.OnSessionRenewalNeeded(cdmSessionId);
|
||||
}
|
||||
|
||||
TEST_F(WVDrmPluginTest, GeneratesProvisioningNeededEvent) {
|
||||
|
||||
Reference in New Issue
Block a user