FileDocCategorySizeDatePackage
DrmInfoRequest.javaAPI DocAndroid 5.1 API4832Thu Mar 12 22:22:30 GMT 2015android.drm

DrmInfoRequest

public class DrmInfoRequest extends Object
An entity class that is used to pass information to an online DRM server. An instance of this class is passed to the {@link DrmManagerClient#acquireDrmInfo acquireDrmInfo()} method to get an instance of a {@link DrmInfo}.

Fields Summary
public static final int
TYPE_REGISTRATION_INFO
Acquires DRM server registration information.
public static final int
TYPE_UNREGISTRATION_INFO
Acquires information for unregistering the DRM server.
public static final int
TYPE_RIGHTS_ACQUISITION_INFO
Acquires rights information.
public static final int
TYPE_RIGHTS_ACQUISITION_PROGRESS_INFO
Acquires the progress of the rights acquisition.
public static final String
ACCOUNT_ID
Key that is used to pass the unique session ID for the account or the user.
public static final String
SUBSCRIPTION_ID
Key that is used to pass the unique session ID for the subscription.
private final int
mInfoType
private final String
mMimeType
private final HashMap
mRequestInformation
Constructors Summary
public DrmInfoRequest(int infoType, String mimeType)
Creates a DrmInfoRequest object with type and MIME type.

param
infoType Type of information.
param
mimeType MIME type.


                           
         
        mInfoType = infoType;
        mMimeType = mimeType;
        if (!isValid()) {
            final String msg = "infoType: " + infoType + "," +
                               "mimeType: " + mimeType;
            throw new IllegalArgumentException(msg);
        }
    
Methods Summary
public java.lang.Objectget(java.lang.String key)
Retrieves the value of a given key.

param
key The key whose value is being retrieved.
return
The value of the key that is being retrieved. Returns null if the key cannot be found.

        return mRequestInformation.get(key);
    
public intgetInfoType()
Retrieves the information type associated with this object.

return
The information type.

        return mInfoType;
    
public java.lang.StringgetMimeType()
Retrieves the MIME type associated with this object.

return
The MIME type.

        return mMimeType;
    
booleanisValid()
Returns whether this instance is valid or not

return
true if valid false if invalid

        return (null != mMimeType && !mMimeType.equals("")
                && null != mRequestInformation && isValidType(mInfoType));
    
static booleanisValidType(int infoType)

        boolean isValid = false;

        switch (infoType) {
        case TYPE_REGISTRATION_INFO:
        case TYPE_UNREGISTRATION_INFO:
        case TYPE_RIGHTS_ACQUISITION_INFO:
        case TYPE_RIGHTS_ACQUISITION_PROGRESS_INFO:
            isValid = true;
            break;
        }
        return isValid;
    
public java.util.Iteratoriterator()
Retrieves an iterator object that you can use to iterate over the values associated with this DrmInfoRequest object.

return
The iterator object.

        return mRequestInformation.values().iterator();
    
public java.util.IteratorkeyIterator()
Retrieves an iterator object that you can use to iterate over the keys associated with this DrmInfoRequest object.

return
The iterator object.

        return mRequestInformation.keySet().iterator();
    
public voidput(java.lang.String key, java.lang.Object value)
Adds optional information as key-value pairs to this object.

param
key The key to add.
param
value The value to add.

        mRequestInformation.put(key, value);