summaryrefslogtreecommitdiffstats
path: root/drm
diff options
context:
space:
mode:
authorGloria Wang <gwang@google.com>2011-06-22 14:55:16 -0700
committerGloria Wang <gwang@google.com>2011-06-22 16:36:24 -0700
commitb7e7bdfe784959ac8615851c2741eb9518a5afcf (patch)
tree4111a7f161fc225c4396a62192828168bfa3833c /drm
parent8969d9924c662ab4cdacc342bbdc33756db730be (diff)
downloadframeworks_base-b7e7bdfe784959ac8615851c2741eb9518a5afcf.zip
frameworks_base-b7e7bdfe784959ac8615851c2741eb9518a5afcf.tar.gz
frameworks_base-b7e7bdfe784959ac8615851c2741eb9518a5afcf.tar.bz2
- Add two sanity checks.
- Remove one unnecessary line. - Clear the extendedData vector in DecryptHandle. Change-Id: I2610c6d68f12d48cb69323a5eb2ae4b3b3e44dff
Diffstat (limited to 'drm')
-rw-r--r--drm/common/DrmSupportInfo.cpp4
-rw-r--r--drm/common/IDrmManagerService.cpp1
-rwxr-xr-xdrm/java/android/drm/DrmRights.java35
-rw-r--r--drm/libdrmframework/DrmManagerClientImpl.cpp1
4 files changed, 19 insertions, 22 deletions
diff --git a/drm/common/DrmSupportInfo.cpp b/drm/common/DrmSupportInfo.cpp
index 3dee435..5400bdd 100644
--- a/drm/common/DrmSupportInfo.cpp
+++ b/drm/common/DrmSupportInfo.cpp
@@ -43,6 +43,10 @@ bool DrmSupportInfo::operator==(const DrmSupportInfo& drmSupportInfo) const {
}
bool DrmSupportInfo::isSupportedMimeType(const String8& mimeType) const {
+ if (String8("") == mimeType) {
+ return false;
+ }
+
for (unsigned int i = 0; i < mMimeTypeVector.size(); i++) {
const String8 item = mMimeTypeVector.itemAt(i);
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index 458f1b6..2d8e877 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -107,6 +107,7 @@ static void clearDecryptHandle(DecryptHandle* handle) {
handle->decryptInfo = NULL;
}
handle->copyControlVector.clear();
+ handle->extendedData.clear();
}
int BpDrmManagerService::addUniqueId(int uniqueId) {
diff --git a/drm/java/android/drm/DrmRights.java b/drm/java/android/drm/DrmRights.java
index 5907956..ef9c21d 100755
--- a/drm/java/android/drm/DrmRights.java
+++ b/drm/java/android/drm/DrmRights.java
@@ -107,31 +107,24 @@ public class DrmRights {
/**
* Creates a <code>DrmRights</code> object with the given parameters.
- *<p>
- * The application can pass the processed data as a <code>String</code> or as binary data.
- *<p>
- * The following code snippet shows how to pass the processed data as a <code>String</code>:
- *<p>
- * new DrmRights(data.getBytes(), mimeType)
- *<p>
- * The following code snippet shows how to pass the processed data as binary data:
- *<p>
- * new DrmRights(binaryData[], mimeType)
*
- * @param data A {@link ProcessedData} object.
+ * @param data A {@link ProcessedData} object containing rights information.
+ * data could be null because it's optional for some DRM schemes.
* @param mimeType The MIME type.
*/
public DrmRights(ProcessedData data, String mimeType) {
- mData = data.getData();
-
- String accountId = data.getAccountId();
- if (null != accountId && !accountId.equals("")) {
- mAccountId = accountId;
- }
-
- String subscriptionId = data.getSubscriptionId();
- if (null != subscriptionId && !subscriptionId.equals("")) {
- mSubscriptionId = subscriptionId;
+ if (data != null) {
+ mData = data.getData();
+
+ String accountId = data.getAccountId();
+ if (null != accountId && !accountId.equals("")) {
+ mAccountId = accountId;
+ }
+
+ String subscriptionId = data.getSubscriptionId();
+ if (null != subscriptionId && !subscriptionId.equals("")) {
+ mSubscriptionId = subscriptionId;
+ }
}
mMimeType = mimeType;
diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp
index a57dd98..a36bd4a 100644
--- a/drm/libdrmframework/DrmManagerClientImpl.cpp
+++ b/drm/libdrmframework/DrmManagerClientImpl.cpp
@@ -145,7 +145,6 @@ DrmInfo* DrmManagerClientImpl::acquireDrmInfo(
status_t DrmManagerClientImpl::saveRights(int uniqueId, const DrmRights& drmRights,
const String8& rightsPath, const String8& contentPath) {
- status_t status = DRM_ERROR_UNKNOWN;
return getDrmManagerService()->saveRights(
uniqueId, drmRights, rightsPath, contentPath);
}