diff options
author | Jeff Tinker <jtinker@google.com> | 2013-04-02 13:08:05 -0700 |
---|---|---|
committer | Jeff Tinker <jtinker@google.com> | 2013-04-03 12:20:53 -0700 |
commit | c0d5f1f8405de861ed6f1725f26cd6601e7103ab (patch) | |
tree | 710d03a7ee6541642c1dc16ac82b4ffea3903968 /drm/mediadrm/plugins/mock | |
parent | 4c63a239c404af1e055e5f9939939ab0fd09d98a (diff) | |
download | frameworks_av-c0d5f1f8405de861ed6f1725f26cd6601e7103ab.zip frameworks_av-c0d5f1f8405de861ed6f1725f26cd6601e7103ab.tar.gz frameworks_av-c0d5f1f8405de861ed6f1725f26cd6601e7103ab.tar.bz2 |
Implement async event callout from drm plugin to Java app
Change-Id: I007f147d693664e777b8758be2bb8a4c7ec0236b
Diffstat (limited to 'drm/mediadrm/plugins/mock')
-rw-r--r-- | drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp b/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp index c34690b..00f6de3 100644 --- a/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp +++ b/drm/mediadrm/plugins/mock/MockDrmCryptoPlugin.cpp @@ -343,7 +343,31 @@ namespace android { Mutex::Autolock lock(mLock); ALOGD("MockDrmPlugin::setPropertyString(name=%s, value=%s)", name.string(), value.string()); - mStringProperties.add(name, value); + + if (name == "mock-send-event") { + unsigned code, extra; + sscanf(value.string(), "%d %d", &code, &extra); + DrmPlugin::EventType eventType = (DrmPlugin::EventType)code; + + Vector<uint8_t> const *pSessionId = NULL; + ssize_t index = mByteArrayProperties.indexOfKey(String8("mock-event-session-id")); + if (index >= 0) { + pSessionId = &mByteArrayProperties[index]; + } + + Vector<uint8_t> const *pData = NULL; + index = mByteArrayProperties.indexOfKey(String8("mock-event-data")); + if (index >= 0) { + pData = &mByteArrayProperties[index]; + } + ALOGD("sending event from mock drm plugin: %d %d %s %s", + (int)code, extra, pSessionId ? vectorToString(*pSessionId) : "{}", + pData ? vectorToString(*pData) : "{}"); + + sendEvent(eventType, extra, pSessionId, pData); + } else { + mStringProperties.add(name, value); + } return OK; } |