summaryrefslogtreecommitdiffstats
path: root/drm/common
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-07-30 17:57:39 -0700
committerJames Dong <jdong@google.com>2012-08-10 17:38:19 -0700
commitbf5b3b29e31b293313788d7464cfb258ac0da803 (patch)
tree1e3e016a1f7268688be59047be835a17609977f8 /drm/common
parentb3e12a4d15a329821979bf287c49a9630486e23f (diff)
downloadframeworks_av-bf5b3b29e31b293313788d7464cfb258ac0da803.zip
frameworks_av-bf5b3b29e31b293313788d7464cfb258ac0da803.tar.gz
frameworks_av-bf5b3b29e31b293313788d7464cfb258ac0da803.tar.bz2
Let getOriginalMimeType() take a fd passed from drm java applications
This patch enables the drm framework to avoid opening files directly. As a result, the drm framework no longer needs the sdcard read permision. o related-to-bug: 6426185 Change-Id: Ib176c35ef4b1a1a405e8e954f19a7985266f2510
Diffstat (limited to 'drm/common')
-rw-r--r--drm/common/DrmEngineBase.cpp4
-rw-r--r--drm/common/IDrmManagerService.cpp14
2 files changed, 14 insertions, 4 deletions
diff --git a/drm/common/DrmEngineBase.cpp b/drm/common/DrmEngineBase.cpp
index a060f38..f734905 100644
--- a/drm/common/DrmEngineBase.cpp
+++ b/drm/common/DrmEngineBase.cpp
@@ -66,8 +66,8 @@ DrmInfo* DrmEngineBase::acquireDrmInfo(int uniqueId, const DrmInfoRequest* drmIn
return onAcquireDrmInfo(uniqueId, drmInfoRequest);
}
-String8 DrmEngineBase::getOriginalMimeType(int uniqueId, const String8& path) {
- return onGetOriginalMimeType(uniqueId, path);
+String8 DrmEngineBase::getOriginalMimeType(int uniqueId, const String8& path, int fd) {
+ return onGetOriginalMimeType(uniqueId, path, fd);
}
int DrmEngineBase::getDrmObjectType(int uniqueId, const String8& path, const String8& mimeType) {
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index ccff257..b76572c 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -368,13 +368,18 @@ status_t BpDrmManagerService::saveRights(
return reply.readInt32();
}
-String8 BpDrmManagerService::getOriginalMimeType(int uniqueId, const String8& path) {
+String8 BpDrmManagerService::getOriginalMimeType(int uniqueId, const String8& path, int fd) {
ALOGV("Get Original MimeType");
Parcel data, reply;
data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
data.writeInt32(uniqueId);
data.writeString8(path);
+ int32_t isFdValid = (fd >= 0);
+ data.writeInt32(isFdValid);
+ if (isFdValid) {
+ data.writeFileDescriptor(fd);
+ }
remote()->transact(GET_ORIGINAL_MIMETYPE, data, &reply);
return reply.readString8();
@@ -1067,7 +1072,12 @@ status_t BnDrmManagerService::onTransact(
const int uniqueId = data.readInt32();
const String8 path = data.readString8();
- const String8 originalMimeType = getOriginalMimeType(uniqueId, path);
+ const int32_t isFdValid = data.readInt32();
+ int fd = -1;
+ if (isFdValid) {
+ fd = data.readFileDescriptor();
+ }
+ const String8 originalMimeType = getOriginalMimeType(uniqueId, path, fd);
reply->writeString8(originalMimeType);
return DRM_NO_ERROR;