Loading drm/java/android/drm/DrmRights.java +22 −33 Original line number Diff line number Diff line Loading @@ -30,19 +30,24 @@ import java.io.IOException; * A caller can also instantiate a {@link DrmRights} object by using the * {@link DrmRights#DrmRights(String, String)} constructor, which takes a path to a file * containing rights information instead of a <code>ProcessedData</code>. *<p> * Please note that the account id and subscription id is not mandatory by all DRM agents * or plugins. When account id or subscription id is not required by the specific DRM * agent or plugin, they can be either null, or an empty string, or any other don't-care * string value. * */ public class DrmRights { private byte[] mData; private String mMimeType; private String mAccountId = "_NO_USER"; private String mSubscriptionId = ""; private String mAccountId; private String mSubscriptionId; /** * Creates a <code>DrmRights</code> object with the given parameters. * * @param rightsFilePath Path to the file containing rights information. * @param mimeType MIME type. * @param mimeType MIME type. Must not be null or an empty string. */ public DrmRights(String rightsFilePath, String mimeType) { File file = new File(rightsFilePath); Loading @@ -53,22 +58,20 @@ public class DrmRights { * Creates a <code>DrmRights</code> object with the given parameters. * * @param rightsFilePath Path to the file containing rights information. * @param mimeType MIME type. * @param mimeType MIME type. Must not be null or an empty string. * @param accountId Account ID of the user. */ public DrmRights(String rightsFilePath, String mimeType, String accountId) { this(rightsFilePath, mimeType); if (null != accountId && !accountId.equals("")) { mAccountId = accountId; } } /** * Creates a <code>DrmRights</code> object with the given parameters. * * @param rightsFilePath Path to the file containing rights information. * @param mimeType MIME type. * @param mimeType MIME type. Must not be null or an empty string. * @param accountId Account ID of the user. * @param subscriptionId Subscription ID of the user. */ Loading @@ -76,20 +79,15 @@ public class DrmRights { String rightsFilePath, String mimeType, String accountId, String subscriptionId) { this(rightsFilePath, mimeType); if (null != accountId && !accountId.equals("")) { mAccountId = accountId; } if (null != subscriptionId && !subscriptionId.equals("")) { mSubscriptionId = subscriptionId; } } /** * Creates a <code>DrmRights</code> object with the given parameters. * * @param rightsFile File containing rights information. * @param mimeType MIME type. * @param mimeType MIME type. Must not be null or an empty string. */ public DrmRights(File rightsFile, String mimeType) { instantiate(rightsFile, mimeType); Loading @@ -114,28 +112,19 @@ public class DrmRights { * Creates a <code>DrmRights</code> object with the given parameters. * * @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. * Must not be null. * @param mimeType The MIME type. It must not be null or an empty string. */ public DrmRights(ProcessedData data, String mimeType) { if (data != null) { mData = data.getData(); String accountId = data.getAccountId(); if (null == accountId || !accountId.equals("")) { throw new IllegalArgumentException("accountId: " + accountId); } mAccountId = accountId; String subscriptionId = data.getSubscriptionId(); if (null == subscriptionId || !subscriptionId.equals("")) { throw new IllegalArgumentException( "subscriptionId: " + subscriptionId); } mSubscriptionId = subscriptionId; if (data == null) { throw new IllegalArgumentException("data is null"); } mData = data.getData(); mAccountId = data.getAccountId(); mSubscriptionId = data.getSubscriptionId(); mMimeType = mimeType; if (!isValid()) { final String msg = "mimeType: " + mMimeType + "," + "data: " + mData; Loading Loading
drm/java/android/drm/DrmRights.java +22 −33 Original line number Diff line number Diff line Loading @@ -30,19 +30,24 @@ import java.io.IOException; * A caller can also instantiate a {@link DrmRights} object by using the * {@link DrmRights#DrmRights(String, String)} constructor, which takes a path to a file * containing rights information instead of a <code>ProcessedData</code>. *<p> * Please note that the account id and subscription id is not mandatory by all DRM agents * or plugins. When account id or subscription id is not required by the specific DRM * agent or plugin, they can be either null, or an empty string, or any other don't-care * string value. * */ public class DrmRights { private byte[] mData; private String mMimeType; private String mAccountId = "_NO_USER"; private String mSubscriptionId = ""; private String mAccountId; private String mSubscriptionId; /** * Creates a <code>DrmRights</code> object with the given parameters. * * @param rightsFilePath Path to the file containing rights information. * @param mimeType MIME type. * @param mimeType MIME type. Must not be null or an empty string. */ public DrmRights(String rightsFilePath, String mimeType) { File file = new File(rightsFilePath); Loading @@ -53,22 +58,20 @@ public class DrmRights { * Creates a <code>DrmRights</code> object with the given parameters. * * @param rightsFilePath Path to the file containing rights information. * @param mimeType MIME type. * @param mimeType MIME type. Must not be null or an empty string. * @param accountId Account ID of the user. */ public DrmRights(String rightsFilePath, String mimeType, String accountId) { this(rightsFilePath, mimeType); if (null != accountId && !accountId.equals("")) { mAccountId = accountId; } } /** * Creates a <code>DrmRights</code> object with the given parameters. * * @param rightsFilePath Path to the file containing rights information. * @param mimeType MIME type. * @param mimeType MIME type. Must not be null or an empty string. * @param accountId Account ID of the user. * @param subscriptionId Subscription ID of the user. */ Loading @@ -76,20 +79,15 @@ public class DrmRights { String rightsFilePath, String mimeType, String accountId, String subscriptionId) { this(rightsFilePath, mimeType); if (null != accountId && !accountId.equals("")) { mAccountId = accountId; } if (null != subscriptionId && !subscriptionId.equals("")) { mSubscriptionId = subscriptionId; } } /** * Creates a <code>DrmRights</code> object with the given parameters. * * @param rightsFile File containing rights information. * @param mimeType MIME type. * @param mimeType MIME type. Must not be null or an empty string. */ public DrmRights(File rightsFile, String mimeType) { instantiate(rightsFile, mimeType); Loading @@ -114,28 +112,19 @@ public class DrmRights { * Creates a <code>DrmRights</code> object with the given parameters. * * @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. * Must not be null. * @param mimeType The MIME type. It must not be null or an empty string. */ public DrmRights(ProcessedData data, String mimeType) { if (data != null) { mData = data.getData(); String accountId = data.getAccountId(); if (null == accountId || !accountId.equals("")) { throw new IllegalArgumentException("accountId: " + accountId); } mAccountId = accountId; String subscriptionId = data.getSubscriptionId(); if (null == subscriptionId || !subscriptionId.equals("")) { throw new IllegalArgumentException( "subscriptionId: " + subscriptionId); } mSubscriptionId = subscriptionId; if (data == null) { throw new IllegalArgumentException("data is null"); } mData = data.getData(); mAccountId = data.getAccountId(); mSubscriptionId = data.getSubscriptionId(); mMimeType = mimeType; if (!isValid()) { final String msg = "mimeType: " + mMimeType + "," + "data: " + mData; Loading