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

@@ -5,7 +5,7 @@
package com.widevine.demo;
import java.util.EventListener;
import java.io.FileInputStream;
//import java.util.HashMap;
import java.util.Set;
@@ -122,6 +122,15 @@ public class WidevineDrm {
rightsAcquisitionInfo = new DrmInfoRequest(DrmInfoRequest.TYPE_RIGHTS_ACQUISITION_INFO,
Settings.WIDEVINE_MIME_TYPE);
if (assetUri.startsWith("/sdcard")) {
try {
FileInputStream fis = new FileInputStream(assetUri);
rightsAcquisitionInfo.put("FileDescriptorKey", fis.getFD().toString());
}
catch (java.io.IOException e) {
logMessage("Unable to get fd for '" + assetUri + "'\n");
}
}
rightsAcquisitionInfo.put("WVDRMServerKey", Settings.DRM_SERVER_URI);
rightsAcquisitionInfo.put("WVAssetURIKey", assetUri);
rightsAcquisitionInfo.put("WVDeviceIDKey", Settings.DEVICE_ID);