diff options
author | Takeshi Aimi <aimitakeshi@gmail.com> | 2010-11-16 13:56:11 +0900 |
---|---|---|
committer | Takeshi Aimi <aimitakeshi@gmail.com> | 2010-11-19 22:02:51 +0900 |
commit | dc91865622e3cc9ff0bb33b83f1d3b38cd7a6d7a (patch) | |
tree | 910ec95f6e2716cf6911da7247eaee49dc149933 /drm/jni | |
parent | 14ac9546367d4df37eead55f6762b944b49f33b2 (diff) | |
download | frameworks_base-dc91865622e3cc9ff0bb33b83f1d3b38cd7a6d7a.zip frameworks_base-dc91865622e3cc9ff0bb33b83f1d3b38cd7a6d7a.tar.gz frameworks_base-dc91865622e3cc9ff0bb33b83f1d3b38cd7a6d7a.tar.bz2 |
Update of DRM Framework.
-Access permission handling
Introduce an internal function which allows the desired process to
access decryption flow. This new function is just for reference and
each OEM manufacturer should implement/replace with their solutions.
-New API, getMetadata()
This API is for retrieving media metadata from container-based DRM,
such as OMA forward-lock content. This API asks DRM agent to retrieve
media metadata hiddein inside of DRM special container.
-New API, acquireRights()
This API wraps acquireDrmInfo() and processDrmInfo().
If DRM agent has valid implementation of both APIs,
Application can acquire DrmRights only by calling this API.
-Bug fix in event loop of OnInfoListener.
Separate OnInfo event loop from mail thread loop so as to avoid
the issue that message is not dispatched when mail thread is busy.
Changes are made by SEMC and Sony.
Change-Id: I04ee3e0988152a71e221f2256d83253749a29da0
Diffstat (limited to 'drm/jni')
-rw-r--r-- | drm/jni/android_drm_DrmManagerClient.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/drm/jni/android_drm_DrmManagerClient.cpp b/drm/jni/android_drm_DrmManagerClient.cpp index e5e4547..e131839 100644 --- a/drm/jni/android_drm_DrmManagerClient.cpp +++ b/drm/jni/android_drm_DrmManagerClient.cpp @@ -29,6 +29,7 @@ #include <drm/DrmInfoRequest.h> #include <drm/DrmSupportInfo.h> #include <drm/DrmConstraints.h> +#include <drm/DrmMetadata.h> #include <drm/DrmConvertedStatus.h> #include <drm/drm_framework_common.h> @@ -298,6 +299,43 @@ static jobject android_drm_DrmManagerClient_getConstraintsFromContent( return constraints; } +static jobject android_drm_DrmManagerClient_getMetadataFromContent( + JNIEnv* env, jobject thiz, jint uniqueId, jstring jpath) { + LOGV("GetMetadata - Enter"); + const String8 pathString = Utility::getStringValue(env, jpath); + DrmMetadata* pMetadata = + getDrmManagerClientImpl(env, thiz)->getMetadata(uniqueId, &pathString); + + jobject metadata = NULL; + + jclass localRef = NULL; + localRef = env->FindClass("android/content/ContentValues"); + if (NULL != localRef && NULL != pMetadata) { + // Get the constructor id + jmethodID constructorId = NULL; + constructorId = env->GetMethodID(localRef, "<init>", "()V"); + if (NULL != constructorId) { + // create the java DrmMetadata object + metadata = env->NewObject(localRef, constructorId); + if (NULL != metadata) { + DrmMetadata::KeyIterator keyIt = pMetadata->keyIterator(); + while (keyIt.hasNext()) { + String8 key = keyIt.next(); + // insert the entry<constraintKey, constraintValue> + // to newly created java object + String8 value = pMetadata->get(key); + env->CallVoidMethod(metadata, env->GetMethodID(localRef, "put", + "(Ljava/lang/String;Ljava/lang/String;)V"), + env->NewStringUTF(key.string()), env->NewStringUTF(value.string())); + } + } + } + } + delete pMetadata; pMetadata = NULL; + LOGV("GetMetadata - Exit"); + return metadata; +} + static jobjectArray android_drm_DrmManagerClient_getAllSupportInfo( JNIEnv* env, jobject thiz, jint uniqueId) { LOGV("GetAllSupportInfo - Enter"); @@ -682,6 +720,9 @@ static JNINativeMethod nativeMethods[] = { {"_getConstraints", "(ILjava/lang/String;I)Landroid/content/ContentValues;", (void*)android_drm_DrmManagerClient_getConstraintsFromContent}, + {"_getMetadata", "(ILjava/lang/String;)Landroid/content/ContentValues;", + (void*)android_drm_DrmManagerClient_getMetadataFromContent}, + {"_getAllSupportInfo", "(I)[Landroid/drm/DrmSupportInfo;", (void*)android_drm_DrmManagerClient_getAllSupportInfo}, |