Allow DRM client to pass the FD of an open file to the DRM server.

This allows a DRM client to open a locally-cached file on behalf of the
DRM server so the DRM server no longer requires the sdcard_r permission
to access the file's metadata.  Specifically, this adds an optional
attribute FileDescriptorKey to the DrmInfoRequest.

This change is dependent on this Widevine CL:
https://widevine-internal-review.googlesource.com/#/c/1330/

Relevant bug reports:
bug: 6426185

Change-Id: Ia7bcb2455c7a55fa4c7c7061de4d672957c7ac0a
This commit is contained in:
Gene Morgan
2012-09-04 15:52:32 -07:00
committed by Jeff Tinker
parent b092b158d2
commit 8cd5d09119
5 changed files with 114 additions and 20 deletions

View File

@@ -247,6 +247,9 @@ DrmInfo* WVMDrmPlugin::onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmI
return NULL;
}
// for local files, app may provide the FD of the open file.
int assetOpenFd = atol(drmInfoRequest->get(String8("FileDescriptorKey")).string());
std::string assetDbPath = drmInfoRequest->get(String8("WVAssetDBPathKey")).string();
//ALOGV("onAcquireDrmInfo: portal=%s, dsPath=%s", credentials.portal.c_str(), assetDbPath.c_str());
@@ -262,7 +265,7 @@ DrmInfo* WVMDrmPlugin::onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmI
uint32_t systemId, assetId, keyId;
if (!mDrmPluginImpl->AcquireDrmInfo(assetPath, credentials, assetDbPath,
if (!mDrmPluginImpl->AcquireDrmInfo(assetPath, assetOpenFd, credentials, assetDbPath,
systemIdStr, assetIdStr, keyIdStr,
&systemId, &assetId, &keyId))
return NULL;
@@ -277,6 +280,7 @@ DrmInfo* WVMDrmPlugin::onAcquireDrmInfo(int uniqueId, const DrmInfoRequest* drmI
DrmBuffer(data, length), drmInfoRequest->getMimeType());
// Sets additional drmInfo attributes
// Do not propagate FileDescriptorKey into the newDrmInfo object
drmInfo->put(String8("WVAssetURIKey"), String8(assetPath.c_str()));
drmInfo->put(String8("WVDRMServerKey"), String8(credentials.drmServerURL.c_str()));
drmInfo->put(String8("WVAssetDbPathKey"), String8(assetDbPath.c_str()));