FileDocCategorySizeDatePackage
DrmRights.javaAPI DocAndroid 1.5 API3506Wed May 06 22:42:00 BST 2009android.drm.mobile1

DrmRights

public class DrmRights extends Object
This class provides interfaces to access the DRM rights.

Fields Summary
public static final int
DRM_PERMISSION_PLAY
The DRM permission of play.
public static final int
DRM_PERMISSION_DISPLAY
The DRM permission of display.
public static final int
DRM_PERMISSION_EXECUTE
The DRM permission of execute.
public static final int
DRM_PERMISSION_PRINT
The DRM permission of print.
private static final int
JNI_DRM_SUCCESS
Successful operation.
private static final int
JNI_DRM_FAILURE
General failure.
private String
roId
The uid of this rights object.
Constructors Summary
public DrmRights()
Construct the DrmRights.



            
      
    
Methods Summary
public booleanconsumeRights(int permission)
Consume the rights of the given permission.

param
permission the given permission.
return
true if consume success. false if consume failure.

        /* call native method to consume and update rights */
        int res = nativeConsumeRights(permission);

        if (JNI_DRM_FAILURE == res)
            return false;

        return true;
    
public DrmConstraintInfogetConstraint(int permission)
Get the constraint of the given permission on this rights object.

param
permission the given permission.
return
a DrmConstraint instance.

        DrmConstraintInfo c = new DrmConstraintInfo();

        /* call native method to get latest constraint information */
        int res = nativeGetConstraintInfo(permission, c);

        if (JNI_DRM_FAILURE == res)
            return null;

        return c;
    
private native intnativeConsumeRights(int permission)
native method: consume the rights of the given permission.

param
permission the given permission.
return
#JNI_DRM_SUCCESS if succeed. #JNI_DRM_FAILURE if fail.

private native intnativeGetConstraintInfo(int permission, DrmConstraintInfo constraint)
native method: get the constraint information of the given permission.

param
permission the given permission.
param
constraint the instance of constraint.
return
#JNI_DRM_SUCCESS if succeed. #JNI_DRM_FAILURE if fail.