Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbf96b1a authored by Rahul Frias's avatar Rahul Frias Committed by Android (Google) Code Review
Browse files

Merge "Add new values to KeyRequestType"

parents 8df0200e 8f761ba1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -23240,8 +23240,10 @@ package android.media {
    method public java.lang.String getDefaultUrl();
    method public int getRequestType();
    field public static final int REQUEST_TYPE_INITIAL = 0; // 0x0
    field public static final int REQUEST_TYPE_NONE = 3; // 0x3
    field public static final int REQUEST_TYPE_RELEASE = 2; // 0x2
    field public static final int REQUEST_TYPE_RENEWAL = 1; // 0x1
    field public static final int REQUEST_TYPE_UPDATE = 4; // 0x4
  }
  public static final class MediaDrm.KeyStatus {
+20 −3
Original line number Diff line number Diff line
@@ -679,12 +679,14 @@ public final class MediaDrm implements AutoCloseable {
        private int mRequestType;

        /**
         * Key request type is initial license request
         * Key request type is initial license request. A license request
         * is necessary to load keys.
         */
        public static final int REQUEST_TYPE_INITIAL = 0;

        /**
         * Key request type is license renewal
         * Key request type is license renewal. A license request is
         * necessary to prevent the keys from expiring.
         */
        public static final int REQUEST_TYPE_RENEWAL = 1;

@@ -693,11 +695,25 @@ public final class MediaDrm implements AutoCloseable {
         */
        public static final int REQUEST_TYPE_RELEASE = 2;

        /**
         * Keys are already loaded. No license request is necessary, and no
         * key request data is returned.
         */
        public static final int REQUEST_TYPE_NONE = 3;

        /**
         * Keys have been loaded but an additional license request is needed
         * to update their values.
         */
        public static final int REQUEST_TYPE_UPDATE = 4;

        /** @hide */
        @IntDef({
            REQUEST_TYPE_INITIAL,
            REQUEST_TYPE_RENEWAL,
            REQUEST_TYPE_RELEASE,
            REQUEST_TYPE_NONE,
            REQUEST_TYPE_UPDATE,
        })
        @Retention(RetentionPolicy.SOURCE)
        public @interface RequestType {}
@@ -738,7 +754,8 @@ public final class MediaDrm implements AutoCloseable {
        /**
         * Get the type of the request
         * @return one of {@link #REQUEST_TYPE_INITIAL},
         * {@link #REQUEST_TYPE_RENEWAL} or {@link #REQUEST_TYPE_RELEASE}
         * {@link #REQUEST_TYPE_RENEWAL}, {@link #REQUEST_TYPE_RELEASE},
         * {@link #REQUEST_TYPE_NONE} or {@link #REQUEST_TYPE_UPDATE}
         */
        @RequestType
        public int getRequestType() { return mRequestType; }
+15 −0
Original line number Diff line number Diff line
@@ -114,6 +114,8 @@ struct KeyRequestTypes {
    jint kKeyRequestTypeInitial;
    jint kKeyRequestTypeRenewal;
    jint kKeyRequestTypeRelease;
    jint kKeyRequestTypeNone;
    jint kKeyRequestTypeUpdate;
} gKeyRequestTypes;

struct CertificateTypes {
@@ -692,6 +694,10 @@ static void android_media_MediaDrm_native_init(JNIEnv *env) {
    gKeyRequestTypes.kKeyRequestTypeRenewal = env->GetStaticIntField(clazz, field);
    GET_STATIC_FIELD_ID(field, clazz, "REQUEST_TYPE_RELEASE", "I");
    gKeyRequestTypes.kKeyRequestTypeRelease = env->GetStaticIntField(clazz, field);
    GET_STATIC_FIELD_ID(field, clazz, "REQUEST_TYPE_NONE", "I");
    gKeyRequestTypes.kKeyRequestTypeNone = env->GetStaticIntField(clazz, field);
    GET_STATIC_FIELD_ID(field, clazz, "REQUEST_TYPE_UPDATE", "I");
    gKeyRequestTypes.kKeyRequestTypeUpdate = env->GetStaticIntField(clazz, field);

    FIND_CLASS(clazz, "android/media/MediaDrm$ProvisionRequest");
    GET_FIELD_ID(gFields.provisionRequest.data, clazz, "mData", "[B");
@@ -922,6 +928,15 @@ static jobject android_media_MediaDrm_getKeyRequest(
                env->SetIntField(keyObj, gFields.keyRequest.requestType,
                        gKeyRequestTypes.kKeyRequestTypeRelease);
                break;
            case DrmPlugin::kKeyRequestType_None:
                env->SetIntField(keyObj, gFields.keyRequest.requestType,
                        gKeyRequestTypes.kKeyRequestTypeNone);
                break;
            case DrmPlugin::kKeyRequestType_Update:
                env->SetIntField(keyObj, gFields.keyRequest.requestType,
                        gKeyRequestTypes.kKeyRequestTypeUpdate);
                break;

            default:
                throwStateException(env, "DRM plugin failure: unknown key request type",
                        ERROR_DRM_UNKNOWN);