summaryrefslogtreecommitdiffstats
path: root/drm
diff options
context:
space:
mode:
authorGloria Wang <gwang@google.com>2011-03-17 12:38:40 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-03-17 12:38:40 -0700
commit454b2d1c34238ba33d8f6861971a74c80c3e302a (patch)
treeff078839aaf33111641bad0c51337a27e2d15849 /drm
parent08aa2cbd5e62e7ca140f78f8bea0477a19880fd9 (diff)
parent2c3257b21ddf2a3da843f11d1bb3b4fa8e912707 (diff)
downloadframeworks_base-454b2d1c34238ba33d8f6861971a74c80c3e302a.zip
frameworks_base-454b2d1c34238ba33d8f6861971a74c80c3e302a.tar.gz
frameworks_base-454b2d1c34238ba33d8f6861971a74c80c3e302a.tar.bz2
am 2c3257b2: am 9940c8b6: am def35f7a: Merge "Fix for 4089881. - Add one more parameter in the interface of DrmEvent and its subclasses DrmInfoEvent and DrmErrorEvent - Send back DrmInfo in the response of async processDrmInfo calls" into honeycomb-mr1
* commit '2c3257b21ddf2a3da843f11d1bb3b4fa8e912707': Fix for 4089881. - Add one more parameter in the interface of DrmEvent and its subclasses DrmInfoEvent and DrmErrorEvent - Send back DrmInfo in the response of async processDrmInfo calls
Diffstat (limited to 'drm')
-rw-r--r--drm/java/android/drm/DrmErrorEvent.java18
-rw-r--r--drm/java/android/drm/DrmEvent.java37
-rw-r--r--drm/java/android/drm/DrmInfoEvent.java18
-rw-r--r--drm/java/android/drm/DrmManagerClient.java17
4 files changed, 81 insertions, 9 deletions
diff --git a/drm/java/android/drm/DrmErrorEvent.java b/drm/java/android/drm/DrmErrorEvent.java
index 90adb47f..7cc9a87 100644
--- a/drm/java/android/drm/DrmErrorEvent.java
+++ b/drm/java/android/drm/DrmErrorEvent.java
@@ -16,6 +16,8 @@
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)}
@@ -62,11 +64,25 @@ public class DrmErrorEvent extends DrmEvent {
* constructor to create DrmErrorEvent object with given parameters
*
* @param uniqueId Unique session identifier
- * @param type Type of information
+ * @param type Type of the event. It could be one of the 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
+ *
+ * @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 attributes Attributes for extensible information. Could be any
+ * information provided by the plugin
+ */
+ public DrmErrorEvent(int uniqueId, int type, String message,
+ HashMap<String, Object> attributes) {
+ super(uniqueId, type, message, attributes);
+ }
}
diff --git a/drm/java/android/drm/DrmEvent.java b/drm/java/android/drm/DrmEvent.java
index f7bc5cd..eba458b 100644
--- a/drm/java/android/drm/DrmEvent.java
+++ b/drm/java/android/drm/DrmEvent.java
@@ -16,6 +16,8 @@
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.
@@ -33,11 +35,36 @@ public class DrmEvent {
public static final int TYPE_DRM_INFO_PROCESSED = 1002;
public static final String DRM_INFO_STATUS_OBJECT = "drm_info_status_object";
+ public static final String DRM_INFO_OBJECT = "drm_info_object";
private final int mUniqueId;
private final int mType;
private String mMessage = "";
+ private HashMap<String, Object> mAttributes = new HashMap<String, Object>();
+
+ /**
+ * constructor for DrmEvent class
+ *
+ * @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) {
+ mUniqueId = uniqueId;
+ mType = type;
+
+ if (null != message) {
+ mMessage = message;
+ }
+
+ if (null != attributes) {
+ mAttributes = attributes;
+ }
+ }
+
/**
* constructor for DrmEvent class
*
@@ -80,5 +107,15 @@ public class DrmEvent {
public String getMessage() {
return mMessage;
}
+
+ /**
+ * Returns the attribute corresponding to the specified key
+ *
+ * @return one of the attributes or null if no mapping for
+ * the key is found
+ */
+ public Object getAttribute(String key) {
+ return mAttributes.get(key);
+ }
}
diff --git a/drm/java/android/drm/DrmInfoEvent.java b/drm/java/android/drm/DrmInfoEvent.java
index 72f37ea..190199a 100644
--- a/drm/java/android/drm/DrmInfoEvent.java
+++ b/drm/java/android/drm/DrmInfoEvent.java
@@ -16,6 +16,8 @@
package android.drm;
+import java.util.HashMap;
+
/**
* This is an entity class which would be passed to caller in
* {@link DrmManagerClient.OnInfoListener#onInfo(DrmManagerClient, DrmInfoEvent)}
@@ -54,11 +56,25 @@ public class DrmInfoEvent extends DrmEvent {
* constructor to create DrmInfoEvent object with given parameters
*
* @param uniqueId Unique session identifier
- * @param type Type of information
+ * @param type Type of the event. It could be one of the types defined above
* @param message Message description
*/
public DrmInfoEvent(int uniqueId, int type, String message) {
super(uniqueId, type, message);
}
+
+ /**
+ * constructor to create DrmInfoEvent object with given 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 attributes Attributes for extensible information. Could be any
+ * information provided by the plugin
+ */
+ public DrmInfoEvent(int uniqueId, int type, String message,
+ HashMap<String, Object> attributes) {
+ super(uniqueId, type, message, attributes);
+ }
}
diff --git a/drm/java/android/drm/DrmManagerClient.java b/drm/java/android/drm/DrmManagerClient.java
index aa56159..f7479b5 100644
--- a/drm/java/android/drm/DrmManagerClient.java
+++ b/drm/java/android/drm/DrmManagerClient.java
@@ -81,10 +81,8 @@ public class DrmManagerClient {
*
* @param client DrmManagerClient instance
* @param event instance which wraps type and message
- * @param attributes resultant values in key and value pair.
*/
- public void onEvent(DrmManagerClient client, DrmEvent event,
- HashMap<String, Object> attributes);
+ public void onEvent(DrmManagerClient client, DrmEvent event);
}
/**
@@ -128,12 +126,17 @@ public class DrmManagerClient {
case ACTION_PROCESS_DRM_INFO: {
final DrmInfo drmInfo = (DrmInfo) msg.obj;
DrmInfoStatus status = _processDrmInfo(mUniqueId, drmInfo);
+
+ attributes.put(DrmEvent.DRM_INFO_STATUS_OBJECT, status);
+ attributes.put(DrmEvent.DRM_INFO_OBJECT, drmInfo);
+
if (null != status && DrmInfoStatus.STATUS_OK == status.statusCode) {
- attributes.put(DrmEvent.DRM_INFO_STATUS_OBJECT, status);
- event = new DrmEvent(mUniqueId, getEventType(status.infoType), null);
+ event = new DrmEvent(mUniqueId,
+ getEventType(status.infoType), null, attributes);
} else {
int infoType = (null != status) ? status.infoType : drmInfo.getInfoType();
- error = new DrmErrorEvent(mUniqueId, getErrorType(infoType), null);
+ error = new DrmErrorEvent(mUniqueId,
+ getErrorType(infoType), null, attributes);
}
break;
}
@@ -151,7 +154,7 @@ public class DrmManagerClient {
return;
}
if (null != mOnEventListener && null != event) {
- mOnEventListener.onEvent(DrmManagerClient.this, event, attributes);
+ mOnEventListener.onEvent(DrmManagerClient.this, event);
}
if (null != mOnErrorListener && null != error) {
mOnErrorListener.onError(DrmManagerClient.this, error);