diff options
author | Gene Morgan <gmorgan@google.com> | 2012-09-14 13:35:39 -0700 |
---|---|---|
committer | Jeff Tinker <jtinker@google.com> | 2012-09-20 11:52:33 -0700 |
commit | 0abeaca9d1b53ee40ce9c9d2ef543dd83b5a4cc2 (patch) | |
tree | e17375f6532c5720d8b835cdf242e5016eb5a49f /drm | |
parent | 74e58c55bc5259b957a51f1bb44a5911ad1f8400 (diff) | |
download | frameworks_av-0abeaca9d1b53ee40ce9c9d2ef543dd83b5a4cc2.zip frameworks_av-0abeaca9d1b53ee40ce9c9d2ef543dd83b5a4cc2.tar.gz frameworks_av-0abeaca9d1b53ee40ce9c9d2ef543dd83b5a4cc2.tar.bz2 |
Allow DRM client to pass the FD of an open file to the DRM server.
Part of CL https://googleplex-android-review.googlesource.com/#/c/222797/
This modifies the marshall/unmarshall of IDrmManagerService::
acquireDrmInfo() to watch for DrmInfoRequest tag "FileDescriptorKey".
If tag is present convert string to binary FD, then back to string
after passage through the interface's Binder.
Relevant bug reports:
bug: 6426185
Change-Id: I63748b7c986ca0a89613ed3f1c81f24cffb7a9b2
Diffstat (limited to 'drm')
-rw-r--r-- | drm/common/IDrmManagerService.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp index b76572c..0282036 100644 --- a/drm/common/IDrmManagerService.cpp +++ b/drm/common/IDrmManagerService.cpp @@ -310,7 +310,13 @@ DrmInfo* BpDrmManagerService::acquireDrmInfo(int uniqueId, const DrmInfoRequest* const String8 key = keyIt.next(); data.writeString8(key); const String8 value = drmInforequest->get(key); - data.writeString8((value == String8("")) ? String8("NULL") : value); + if (key == String8("FileDescriptorKey")) { + int fd = -1; + sscanf(value.string(), "FileDescriptor[%d]", &fd); + data.writeFileDescriptor(fd); + } else { + data.writeString8((value == String8("")) ? String8("NULL") : value); + } } remote()->transact(ACQUIRE_DRM_INFO, data, &reply); @@ -1002,8 +1008,15 @@ status_t BnDrmManagerService::onTransact( const int size = data.readInt32(); for (int index = 0; index < size; ++index) { const String8 key(data.readString8()); - const String8 value(data.readString8()); - drmInfoRequest->put(key, (value == String8("NULL")) ? String8("") : value); + if (key == String8("FileDescriptorKey")) { + char buffer[16]; + int fd = data.readFileDescriptor(); + sprintf(buffer, "%lu", (unsigned long)fd); + drmInfoRequest->put(key, String8(buffer)); + } else { + const String8 value(data.readString8()); + drmInfoRequest->put(key, (value == String8("NULL")) ? String8("") : value); + } } DrmInfo* drmInfo = acquireDrmInfo(uniqueId, drmInfoRequest); @@ -1505,4 +1518,3 @@ status_t BnDrmManagerService::onTransact( return BBinder::onTransact(code, data, reply, flags); } } - |