summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Tinker <jtinker@google.com>2013-08-30 23:04:34 +0000
committerJeff Tinker <jtinker@google.com>2013-09-03 10:13:17 -0700
commit490dd056bd2fdfc630cd43b3fc1c90baf509bffe (patch)
tree6acdce26ed26a33c7277cf828b4129cbf7fe5ff6
parent7f60dc57780281030f26a2109a64d0260e976af7 (diff)
downloadframeworks_base-490dd056bd2fdfc630cd43b3fc1c90baf509bffe.zip
frameworks_base-490dd056bd2fdfc630cd43b3fc1c90baf509bffe.tar.gz
frameworks_base-490dd056bd2fdfc630cd43b3fc1c90baf509bffe.tar.bz2
Revert "Enhancement for OnInfo callback on DRM Framework"
This reverts commit 6fd97b7d93c5eeaefb2695786b35d1672c88b0cf. Fixes Fatal signal 6 (SIGABRT)" when playing or downloading a video bug: 10542864 Change-Id: I85b84d6b602079571be1a7237c907716db9cdf54
-rw-r--r--drm/java/android/drm/DrmManagerClient.java36
-rw-r--r--drm/jni/android_drm_DrmManagerClient.cpp48
2 files changed, 14 insertions, 70 deletions
diff --git a/drm/java/android/drm/DrmManagerClient.java b/drm/java/android/drm/DrmManagerClient.java
index e2606d6..10cdab0 100644
--- a/drm/java/android/drm/DrmManagerClient.java
+++ b/drm/java/android/drm/DrmManagerClient.java
@@ -63,8 +63,6 @@ public class DrmManagerClient {
private final CloseGuard mCloseGuard = CloseGuard.get();
- private static final String EXTENDED_INFO_DATA = "extended_info_data";
-
static {
// Load the respective library
System.loadLibrary("drmframework_jni");
@@ -186,22 +184,8 @@ public class DrmManagerClient {
DrmManagerClient instance = (DrmManagerClient)((WeakReference)thisReference).get();
if (null != instance && null != instance.mInfoHandler) {
- DrmInfoEvent event = new DrmInfoEvent(uniqueId, infoType, message);
- Message m = instance.mInfoHandler.obtainMessage(
- InfoHandler.INFO_EVENT_TYPE, event);
- instance.mInfoHandler.sendMessage(m);
- }
- }
-
- private static void notify(
- Object thisReference, int uniqueId, int infoType, String message,
- HashMap<String, Object> attributes) {
- DrmManagerClient instance = (DrmManagerClient)((WeakReference)thisReference).get();
-
- if (null != instance && null != instance.mInfoHandler) {
- DrmInfoEvent event = new DrmInfoEvent(uniqueId, infoType, message, attributes);
Message m = instance.mInfoHandler.obtainMessage(
- InfoHandler.INFO_EVENT_TYPE, event);
+ InfoHandler.INFO_EVENT_TYPE, uniqueId, infoType, message);
instance.mInfoHandler.sendMessage(m);
}
}
@@ -214,25 +198,23 @@ public class DrmManagerClient {
}
public void handleMessage(Message msg) {
- DrmInfoEvent info = (DrmInfoEvent) msg.obj;
+ DrmInfoEvent info = null;
DrmErrorEvent error = null;
- int uniqueId;
- int eventType;
- String message;
switch (msg.what) {
case InfoHandler.INFO_EVENT_TYPE:
- uniqueId = info.getUniqueId();
- eventType = info.getType();
- message = info.getMessage();
+ int uniqueId = msg.arg1;
+ int infoType = msg.arg2;
+ String message = msg.obj.toString();
- switch (eventType) {
+ switch (infoType) {
case DrmInfoEvent.TYPE_REMOVE_RIGHTS: {
try {
DrmUtils.removeFile(message);
} catch (IOException e) {
e.printStackTrace();
}
+ info = new DrmInfoEvent(uniqueId, infoType, message);
break;
}
case DrmInfoEvent.TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT:
@@ -240,11 +222,11 @@ public class DrmManagerClient {
case DrmInfoEvent.TYPE_WAIT_FOR_RIGHTS:
case DrmInfoEvent.TYPE_ACCOUNT_ALREADY_REGISTERED:
case DrmInfoEvent.TYPE_RIGHTS_REMOVED: {
+ info = new DrmInfoEvent(uniqueId, infoType, message);
break;
}
default:
- info = null;
- error = new DrmErrorEvent(uniqueId, eventType, message);
+ error = new DrmErrorEvent(uniqueId, infoType, message);
break;
}
diff --git a/drm/jni/android_drm_DrmManagerClient.cpp b/drm/jni/android_drm_DrmManagerClient.cpp
index 7fce3d0..baddf62 100644
--- a/drm/jni/android_drm_DrmManagerClient.cpp
+++ b/drm/jni/android_drm_DrmManagerClient.cpp
@@ -169,49 +169,11 @@ void JNIOnInfoListener::onInfo(const DrmInfoEvent& event) {
JNIEnv *env = AndroidRuntime::getJNIEnv();
jstring message = env->NewStringUTF(event.getMessage().string());
ALOGV("JNIOnInfoListener::onInfo => %d | %d | %s", uniqueId, type, event.getMessage().string());
- const DrmBuffer& drmBuffer = event.getData();
- if (event.getCount() > 0 || drmBuffer.length > 0) {
- jclass hashMapClazz = env->FindClass("java/util/HashMap");
- jmethodID hashMapInitId = env->GetMethodID(hashMapClazz, "<init>", "()V");
- jmethodID hashMapPutId = env->GetMethodID(hashMapClazz, "put",
- "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
- jobject hashMapObject = env->NewObject(hashMapClazz, hashMapInitId);
- env->DeleteLocalRef(hashMapClazz);
-
- if (0 < drmBuffer.length) {
- jfieldID fid = env->GetStaticFieldID(
- mClass, "EXTENDED_INFO_DATA", "Ljava/lang/String;");
- jstring key = (jstring) env->GetStaticObjectField(mClass, fid);
-
- jbyteArray valueByte = env->NewByteArray(drmBuffer.length);
- env->SetByteArrayRegion(valueByte, 0, drmBuffer.length, (jbyte*) drmBuffer.data);
- env->CallObjectMethod(hashMapObject, hashMapPutId, key, valueByte);
- env->DeleteLocalRef(valueByte);
- env->DeleteLocalRef(key);
- }
- DrmInfoEvent::KeyIterator keyIt = event.keyIterator();
- while (keyIt.hasNext()) {
- String8 mapKey = keyIt.next();
- jstring key = env->NewStringUTF(mapKey.string());
- jstring value = env->NewStringUTF(event.get(mapKey).string());
- env->CallObjectMethod(hashMapObject, hashMapPutId, key, value);
- env->DeleteLocalRef(value);
- env->DeleteLocalRef(key);
- }
- env->CallStaticVoidMethod(
- mClass,
- env->GetStaticMethodID(mClass, "notify",
- "(Ljava/lang/Object;IILjava/lang/String;Ljava/util/HashMap;)V"),
- mObject, uniqueId, type, message, hashMapObject);
- env->DeleteLocalRef(hashMapObject);
- } else {
- env->CallStaticVoidMethod(
- mClass,
- env->GetStaticMethodID(mClass, "notify",
- "(Ljava/lang/Object;IILjava/lang/String;)V"),
- mObject, uniqueId, type, message);
- }
- env->DeleteLocalRef(message);
+
+ env->CallStaticVoidMethod(
+ mClass,
+ env->GetStaticMethodID(mClass, "notify", "(Ljava/lang/Object;IILjava/lang/String;)V"),
+ mObject, uniqueId, type, message);
}
static Mutex sLock;