diff options
| author | Edwin Wong <edwinwong@google.com> | 2018-08-23 13:48:27 -0700 |
|---|---|---|
| committer | Edwin Wong <edwinwong@google.com> | 2018-08-30 15:39:58 -0700 |
| commit | ad02cc6c4091a44fb60c475731c8f4cac9a55ab0 (patch) | |
| tree | feb915fc8d4ab255bb8dc71985acd8df2f18f3b3 /drm | |
| parent | 15530ac49cc9af87ab0141e0875f23f8bd6b4264 (diff) | |
| download | frameworks_av-ad02cc6c4091a44fb60c475731c8f4cac9a55ab0.tar.gz frameworks_av-ad02cc6c4091a44fb60c475731c8f4cac9a55ab0.tar.bz2 frameworks_av-ad02cc6c4091a44fb60c475731c8f4cac9a55ab0.zip | |
Add onExpirationUpdate and onKeyStatusChange listeners.
We must only create one DrmListener instance.
We then process different listeners in DrmListener::notify.
To facilitate testing, we call the listeners from clearkey plugin's
provideKeyResponse function. We have previously tested
EventType::VENDOR_DEFINED in the same manner.
bug: 77712870
Test: native CTS test testClearKeyPlaybackCenc
Test: CTS MediaDrmMockTest
Change-Id: Ie15e3012a4068824f72371a66e9fca2ee27180f8
Diffstat (limited to 'drm')
| -rw-r--r-- | drm/mediadrm/plugins/clearkey/hidl/DrmPlugin.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/drm/mediadrm/plugins/clearkey/hidl/DrmPlugin.cpp b/drm/mediadrm/plugins/clearkey/hidl/DrmPlugin.cpp index d51e29dc57..3b6108526b 100644 --- a/drm/mediadrm/plugins/clearkey/hidl/DrmPlugin.cpp +++ b/drm/mediadrm/plugins/clearkey/hidl/DrmPlugin.cpp @@ -245,11 +245,29 @@ Return<void> DrmPlugin::provideKeyResponse( setPlayPolicy(); std::vector<uint8_t> keySetId; + keySetId.clear(); + Status status = session->provideKeyResponse(response); if (status == Status::OK) { - // This is for testing AMediaDrm_setOnEventListener only. - sendEvent(EventType::VENDOR_DEFINED, 0, scope); - keySetId.clear(); + // Test calling AMediaDrm listeners. + sendEvent(EventType::VENDOR_DEFINED, toVector(scope), toVector(scope)); + + sendExpirationUpdate(toVector(scope), 100); + + std::vector<KeyStatus> keysStatus; + KeyStatus keyStatus; + + std::vector<uint8_t> keyId1 = { 0xA, 0xB, 0xC }; + keyStatus.keyId = keyId1; + keyStatus.type = V1_0::KeyStatusType::USABLE; + keysStatus.push_back(keyStatus); + + std::vector<uint8_t> keyId2 = { 0xD, 0xE, 0xF }; + keyStatus.keyId = keyId2; + keyStatus.type = V1_0::KeyStatusType::EXPIRED; + keysStatus.push_back(keyStatus); + + sendKeysChange(toVector(scope), keysStatus, true); } installSecureStop(scope); |
