Fields Summary |
---|
public static final String | DRM_MIMETYPE_RIGHTS_XML_STRINGThe "application/vnd.oma.drm.rights+xml" mime type. |
public static final String | DRM_MIMETYPE_RIGHTS_WBXML_STRINGThe "application/vnd.oma.drm.rights+wbxml" mime type. |
private static final int | DRM_MIMETYPE_RIGHTS_XMLThe id of "application/vnd.oma.drm.rights+xml" mime type. |
private static final int | DRM_MIMETYPE_RIGHTS_WBXMLThe id of "application/vnd.oma.drm.rights+wbxml" mime type. |
private static final int | DRM_MIMETYPE_MESSAGEThe id of "application/vnd.oma.drm.message" mime type. |
private static final int | JNI_DRM_SUCCESSSuccessful operation. |
private static final int | JNI_DRM_FAILUREGeneral failure. |
private static DrmRightsManager | singletonThe instance of the rights manager. |
Methods Summary |
---|
public synchronized void | deleteRights(DrmRights rights)Delete the specified DRM rights object.
/* call native method to delete the specified rights object */
int res = nativeDeleteRights(rights);
if (JNI_DRM_FAILURE == res)
return;
|
public static synchronized android.drm.mobile1.DrmRightsManager | getInstance()Get the DrmRightsManager instance.
if (singleton == null) {
singleton = new DrmRightsManager();
}
return singleton;
|
public synchronized java.util.List | getRightsList()Get the list of all DRM rights saved in local client.
List rightsList = new ArrayList();
/* call native method to get how many rights object in current agent */
int num = nativeGetNumOfRights();
if (JNI_DRM_FAILURE == num)
return null;
if (num > 0) {
DrmRights[] rightsArray = new DrmRights[num];
int i;
for (i = 0; i < num; i++)
rightsArray[i] = new DrmRights();
/* call native method to get all the rights information */
num = nativeGetRightsList(rightsArray, num);
if (JNI_DRM_FAILURE == num)
return null;
/* add all rights informations to ArrayList */
for (i = 0; i < num; i++)
rightsList.add(rightsArray[i]);
}
return rightsList;
|
public synchronized DrmRights | installRights(java.io.InputStream rightsData, int len, java.lang.String mimeTypeStr)Install one DRM rights and return one instance of DrmRights.
int mimeType = 0;
if (DRM_MIMETYPE_RIGHTS_XML_STRING.equals(mimeTypeStr))
mimeType = DRM_MIMETYPE_RIGHTS_XML;
else if (DRM_MIMETYPE_RIGHTS_WBXML_STRING.equals(mimeTypeStr))
mimeType = DRM_MIMETYPE_RIGHTS_WBXML;
else if (DrmRawContent.DRM_MIMETYPE_MESSAGE_STRING.equals(mimeTypeStr))
mimeType = DRM_MIMETYPE_MESSAGE;
else
throw new IllegalArgumentException("mimeType must be DRM_MIMETYPE_RIGHTS_XML or DRM_MIMETYPE_RIGHTS_WBXML or DRM_MIMETYPE_MESSAGE");
if (len <= 0)
return null;
DrmRights rights = new DrmRights();
/* call native method to install this rights object. */
int res = nativeInstallDrmRights(rightsData, len, mimeType, rights);
if (JNI_DRM_FAILURE == res)
throw new DrmException("nativeInstallDrmRights() returned JNI_DRM_FAILURE");
return rights;
|
private native int | nativeDeleteRights(DrmRights rights)native method: delete a specified rights object.
|
private native int | nativeGetNumOfRights()native method: get how many rights object in current DRM agent.
|
private native int | nativeGetRightsList(DrmRights[] rights, int numRights)native method: get all the rights object in current local agent.
|
private native int | nativeInstallDrmRights(java.io.InputStream data, int len, int mimeType, DrmRights rights)native method: install rights object to local client.
|
private native int | nativeQueryRights(DrmRawContent content, DrmRights rights)native method: query the given DRM content's rights object.
|
public synchronized DrmRights | queryRights(DrmRawContent content)Query DRM rights of specified DRM raw content.
DrmRights rights = new DrmRights();
/* call native method to query the rights */
int res = nativeQueryRights(content, rights);
if (JNI_DRM_FAILURE == res)
return null;
return rights;
|