Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bde4594 authored by Bill Gruber's avatar Bill Gruber Committed by Android Git Automerger
Browse files

am 0357ec78: Merge "DRM API doc scrub This change contains information...

am 0357ec78: Merge "DRM API doc scrub This change contains information contributed by Sony Corporation. Bug: 4119363" into honeycomb-mr1

* commit '0357ec78':
  DRM API doc scrub This change contains information contributed by Sony Corporation. Bug: 4119363
parents ee7cfaf2 0357ec78
Loading
Loading
Loading
Loading
+23.5 KiB
Loading image diff...
+12 −11
Original line number Diff line number Diff line
@@ -17,13 +17,11 @@
package android.drm;

/**
 * This is an entity class which wraps the status of the conversion, the converted
 * data/checksum data and the offset. Offset is going to be used in the case of close
 * session where the agent will inform where the header and body signature should be added
 *
 * As a result of {@link DrmManagerClient#convertData(int, byte [])} and
 * {@link DrmManagerClient#closeConvertSession(int)} an instance of DrmConvertedStatus
 * would be returned.
 * An entity class that wraps converted data, conversion status, and the
 * offset for appending the header and body signature to the converted data. An instance of this
 * class is returned by the {@link DrmManagerClient#convertData convertData()} and
 * {@link DrmManagerClient#closeConvertSession closeConvertSession()} methods. The offset is provided only when a
 * conversion session is closed by calling {@link DrmManagerClient#closeConvertSession closeConvertSession()}.
 *
 */
public class DrmConvertedStatus {
@@ -32,16 +30,19 @@ public class DrmConvertedStatus {
    public static final int STATUS_INPUTDATA_ERROR = 2;
    public static final int STATUS_ERROR = 3;

    /** Status code for the conversion.*/
    public final int statusCode;
    /** Converted data.*/
    public final byte[] convertedData;
    /** Offset value for the body and header signature.*/
    public final int offset;

    /**
     * constructor to create DrmConvertedStatus object with given parameters
     * Creates a <code>DrmConvertedStatus</code> object with the specified parameters.
     *
     * @param _statusCode Status of the conversion
     * @param _convertedData Converted data/checksum data
     * @param _offset Offset value
     * @param _statusCode Conversion status.
     * @param _convertedData Converted data.
     * @param _offset Offset value for appending the header and body signature.
     */
    public DrmConvertedStatus(int _statusCode, byte[] _convertedData, int _offset) {
        statusCode = _statusCode;
+22 −23
Original line number Diff line number Diff line
@@ -19,70 +19,69 @@ package android.drm;
import java.util.HashMap;

/**
 * This is an entity class which would be passed to caller in
 * {@link DrmManagerClient.OnErrorListener#onError(DrmManagerClient, DrmErrorEvent)}
 * An entity class that is passed to the
 * {@link DrmManagerClient.OnErrorListener#onError onError()} callback.
 *
 */
public class DrmErrorEvent extends DrmEvent {
    /**
     * TYPE_RIGHTS_NOT_INSTALLED, when something went wrong installing the rights.
     * Something went wrong installing the rights.
     */
    public static final int TYPE_RIGHTS_NOT_INSTALLED = 2001;
    /**
     * TYPE_RIGHTS_RENEWAL_NOT_ALLOWED, when the server rejects renewal of rights.
     * The server rejected the renewal of rights.
     */
    public static final int TYPE_RIGHTS_RENEWAL_NOT_ALLOWED = 2002;
    /**
     * TYPE_NOT_SUPPORTED, when answer from server can not be handled by the native agent.
     * Response from the server cannot be handled by the DRM plug-in (agent).
     */
    public static final int TYPE_NOT_SUPPORTED = 2003;
    /**
     * TYPE_OUT_OF_MEMORY, when memory allocation fail during renewal.
     * Can in the future perhaps be used to trigger garbage collector.
     * Memory allocation failed during renewal. Can in the future perhaps be used to trigger 
     * garbage collector.
     */
    public static final int TYPE_OUT_OF_MEMORY = 2004;
    /**
     * TYPE_NO_INTERNET_CONNECTION, when the Internet connection is missing and no attempt
     * can be made to renew rights.
     * An Internet connection is not available and no attempt can be made to renew rights.
     */
    public static final int TYPE_NO_INTERNET_CONNECTION = 2005;
    /**
     * TYPE_PROCESS_DRM_INFO_FAILED, when failed to process DrmInfo.
     * Failed to process {@link DrmInfo}. This error event is sent when a
     * {@link DrmManagerClient#processDrmInfo processDrmInfo()} call fails.
     */
    public static final int TYPE_PROCESS_DRM_INFO_FAILED = 2006;
    /**
     * TYPE_REMOVE_ALL_RIGHTS_FAILED, when failed to remove all the rights objects
     * associated with all DRM schemes.
     * Failed to remove all the rights objects associated with all DRM schemes.
     */
    public static final int TYPE_REMOVE_ALL_RIGHTS_FAILED = 2007;
    /**
     * TYPE_ACQUIRE_DRM_INFO_FAILED, when failed to acquire DrmInfo.
     * Failed to acquire {@link DrmInfo}. This error event is sent when an
     * {@link DrmManagerClient#acquireDrmInfo acquireDrmInfo()} call fails.
     */
    public static final int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008;

    /**
     * constructor to create DrmErrorEvent object with given parameters
     * Creates a <code>DrmErrorEvent</code> object with the specified parameters.
     *
     * @param uniqueId Unique session identifier
     * @param type Type of the event. It could be one of the types defined above
     * @param message Message description
     * @param uniqueId Unique session identifier.
     * @param type Type of the event. Could be any of the event types defined above.
     * @param message Message description.
     */
    public DrmErrorEvent(int uniqueId, int type, String message) {
        super(uniqueId, type, message);
    }

    /**
     * constructor to create DrmErrorEvent object with given parameters
     * Creates a <code>DrmErrorEvent</code> object with the specified parameters.
     *
     * @param uniqueId Unique session identifier
     * @param type Type of the event. It could be one of the types defined above
     * @param message Message description
     * @param uniqueId Unique session identifier.
     * @param type Type of the event. Could be any of the event types defined above.
     * @param message Message description.
     * @param attributes Attributes for extensible information. Could be any
     * information provided by the plugin
     * information provided by the plug-in.
     */
    public DrmErrorEvent(int uniqueId, int type, String message,
                            HashMap<String, Object> attributes) {
        super(uniqueId, type, message, attributes);
    }
}
+28 −25
Original line number Diff line number Diff line
@@ -19,22 +19,26 @@ package android.drm;
import java.util.HashMap;

/**
 * This is the base class which would be used to notify the caller
 * about any event occurred in DRM framework.
 * A base class that is used to send asynchronous event information from the DRM framework.
 *
 */
public class DrmEvent {
    /**
     * Constant field signifies that all the rights information associated with
     * all DRM schemes are removed successfully
     * All of the rights information associated with all DRM schemes have been successfully removed.
     */
    public static final int TYPE_ALL_RIGHTS_REMOVED = 1001;
    /**
     * Constant field signifies that given information is processed successfully
     * The given DRM information has been successfully processed.
     */
    public static final int TYPE_DRM_INFO_PROCESSED = 1002;

    /**
     * The key that is used in the <code>attributes</code> HashMap to pass the return status.
     */
    public static final String DRM_INFO_STATUS_OBJECT = "drm_info_status_object";
    /**
     * The key that is used in the <code>attributes</code> HashMap to pass the
     * {@link DrmInfo} object.
     */
    public static final String DRM_INFO_OBJECT = "drm_info_object";

    private final int mUniqueId;
@@ -44,12 +48,12 @@ public class DrmEvent {
    private HashMap<String, Object> mAttributes = new HashMap<String, Object>();

    /**
     * constructor for DrmEvent class
     * Creates a <code>DrmEvent</code> object with the specified parameters.
     *
     * @param uniqueId Unique session identifier
     * @param type Type of information
     * @param message Message description
     * @param attributes Attributes for extensible information
     * @param uniqueId Unique session identifier.
     * @param type Type of information.
     * @param message Message description.
     * @param attributes Attributes for extensible information.
     */
    protected DrmEvent(int uniqueId, int type, String message,
                            HashMap<String, Object> attributes) {
@@ -66,11 +70,11 @@ public class DrmEvent {
    }

    /**
     * constructor for DrmEvent class
     * Creates a <code>DrmEvent</code> object with the specified parameters.
     *
     * @param uniqueId Unique session identifier
     * @param type Type of information
     * @param message Message description
     * @param uniqueId Unique session identifier.
     * @param type Type of information.
     * @param message Message description.
     */
    protected DrmEvent(int uniqueId, int type, String message) {
        mUniqueId = uniqueId;
@@ -82,40 +86,39 @@ public class DrmEvent {
    }

    /**
     * Returns the Unique Id associated with this object
     * Retrieves the unique session identifier associated with this object.
     *
     * @return Unique Id
     * @return The unique session identifier.
     */
    public int getUniqueId() {
        return mUniqueId;
    }

    /**
     * Returns the Type of information associated with this object
     * Retrieves the type of information that is associated with this object.
     *
     * @return Type of information
     * @return The type of information.
     */
    public int getType() {
        return mType;
    }

    /**
     * Returns the message description associated with this object
     * Retrieves the message description associated with this object.
     *
     * @return message description
     * @return The message description.
     */
    public String getMessage() {
        return mMessage;
    }

    /**
     * Returns the attribute corresponding to the specified key
     * Retrieves the attribute associated with the specified key.
     *
     * @return one of the attributes or null if no mapping for
     * the key is found
     * @return One of the attributes or null if no mapping for
     * the key is found.
     */
    public Object getAttribute(String key) {
        return mAttributes.get(key);
    }
}
+36 −34
Original line number Diff line number Diff line
@@ -21,14 +21,13 @@ import java.util.HashMap;
import java.util.Iterator;

/**
 * This is an entity class in which necessary information required to transact
 * between device and online DRM server is described. DRM Framework achieves
 * server registration, license acquisition and any other server related transaction
 * by passing an instance of this class to {@link DrmManagerClient#processDrmInfo(DrmInfo)}.
 *
 * Caller can retrieve the {@link DrmInfo} instance by using
 * {@link DrmManagerClient#acquireDrmInfo(DrmInfoRequest)}
 * by passing {@link DrmInfoRequest} instance.
 * An entity class that describes the information required to send transactions
 * between a device and an online DRM server. The DRM framework achieves
 * server registration, license acquisition, and any other server-related transactions
 * by passing an instance of this class to {@link DrmManagerClient#processDrmInfo}.
 *<p>
 * The caller can retrieve the {@link DrmInfo} instance by passing a {@link DrmInfoRequest}
 * instance to {@link DrmManagerClient#acquireDrmInfo}.
 *
 */
public class DrmInfo {
@@ -40,11 +39,11 @@ public class DrmInfo {
    private final HashMap<String, Object> mAttributes = new HashMap<String, Object>();

    /**
     * constructor to create DrmInfo object with given parameters
     * Creates a <code>DrmInfo</code> object with the given parameters.
     *
     * @param infoType Type of information
     * @param data Trigger data
     * @param mimeType MIME type
     * @param infoType The type of information.
     * @param data The trigger data.
     * @param mimeType The MIME type.
     */
    public DrmInfo(int infoType, byte[] data, String mimeType) {
        mInfoType = infoType;
@@ -53,11 +52,11 @@ public class DrmInfo {
    }

    /**
     * constructor to create DrmInfo object with given parameters
     * Creates a <code>DrmInfo</code> object with the given parameters.
     *
     * @param infoType Type of information
     * @param path Trigger data
     * @param mimeType MIME type
     * @param infoType The type of information.
     * @param path The trigger data.
     * @param mimeType The MIME type.
     */
    public DrmInfo(int infoType, String path, String mimeType) {
        mInfoType = infoType;
@@ -73,67 +72,70 @@ public class DrmInfo {
    }

    /**
     * Adds optional information as <key, value> pair to this object
     * Adds optional information as key-value pairs to this object. To add a custom object
     * to the <code>DrmInfo</code> object, you must override the {@link #toString} implementation.
     *
     * @param key Key to add.
     * @param value Value to add.
     *
     * @param key Key to add
     * @param value Value to add
     *     To put custom object into DrmInfo, custom object has to
     *     override toString() implementation.
     */
    public void put(String key, Object value) {
        mAttributes.put(key, value);
    }

    /**
     * Retrieves the value of given key, if not found returns null
     * Retrieves the value of a given key.
     *
     * @param key The key whose value is being retrieved.
     *
     * @param key Key whose value to be retrieved
     * @return The value or null
     * @return The value of the key being retrieved. Returns null if the key cannot be found.
     */
    public Object get(String key) {
        return mAttributes.get(key);
    }

    /**
     * Returns Iterator object to walk through the keys associated with this instance
     * Retrieves an iterator object that you can use to iterate over the keys associated with
     * this <code>DrmInfo</code> object.
     *
     * @return Iterator object
     * @return The iterator object.
     */
    public Iterator<String> keyIterator() {
        return mAttributes.keySet().iterator();
    }

    /**
     * Returns Iterator object to walk through the values associated with this instance
     * Retrieves an iterator object that you can use to iterate over the values associated with
     * this <code>DrmInfo</code> object.
     *
     * @return Iterator object
     * @return The iterator object.
     */
    public Iterator<Object> iterator() {
        return mAttributes.values().iterator();
    }

    /**
     * Returns the trigger data associated with this object
     * Retrieves the trigger data associated with this object.
     *
     * @return Trigger data
     * @return The trigger data.
     */
    public byte[] getData() {
        return mData;
    }

    /**
     * Returns the mimetype associated with this object
     * Retrieves the MIME type associated with this object.
     *
     * @return MIME type
     * @return The MIME type.
     */
    public String getMimeType() {
        return mMimeType;
    }

    /**
     * Returns information type associated with this instance
     * Retrieves the information type associated with this object.
     *
     * @return Information type
     * @return The information type.
     */
    public int getInfoType() {
        return mInfoType;
Loading