From b7e7bdfe784959ac8615851c2741eb9518a5afcf Mon Sep 17 00:00:00 2001 From: Gloria Wang Date: Wed, 22 Jun 2011 14:55:16 -0700 Subject: - Add two sanity checks. - Remove one unnecessary line. - Clear the extendedData vector in DecryptHandle. Change-Id: I2610c6d68f12d48cb69323a5eb2ae4b3b3e44dff --- drm/java/android/drm/DrmRights.java | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'drm/java') diff --git a/drm/java/android/drm/DrmRights.java b/drm/java/android/drm/DrmRights.java index 59079562b07d..ef9c21dc7dc4 100755 --- a/drm/java/android/drm/DrmRights.java +++ b/drm/java/android/drm/DrmRights.java @@ -107,31 +107,24 @@ public class DrmRights { /** * Creates a DrmRights object with the given parameters. - *

- * The application can pass the processed data as a String or as binary data. - *

- * The following code snippet shows how to pass the processed data as a String: - *

- * new DrmRights(data.getBytes(), mimeType) - *

- * The following code snippet shows how to pass the processed data as binary data: - *

- * 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; -- cgit v1.2.3-59-g8ed1b