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

Commit dc549d60 authored by Takeshi Aimi's avatar Takeshi Aimi
Browse files

Update of DRM framework.

  - Change "void" type of return value to "int" for returning status.
  - Add some of overloaded Java APIs which accept database Uri as input.
  - Add asynchronous APIs
  - Add OnEventListener and OnErrorListener for asynchronous APIs
  - Disable debug log
  - Change decrypt() API to accept an optional buffer needed by some of DRM schemes

Changes are incorporated by Sony Corporation.

Change-Id: I414a165e22cc79be6ea7cd28041788aa2b6b8f7c
parent 7d9c73fb
Loading
Loading
Loading
Loading
+462 −57
Original line number Diff line number Diff line
@@ -55630,6 +55630,161 @@
>
</field>
</class>
<class name="DrmErrorEvent"
 extends="android.drm.DrmEvent"
 abstract="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<constructor name="DrmErrorEvent"
 type="android.drm.DrmErrorEvent"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="uniqueId" type="int">
</parameter>
<parameter name="type" type="int">
</parameter>
<parameter name="message" type="java.lang.String">
</parameter>
</constructor>
<field name="TYPE_DRM_INFO_ACQUISITION_FAILED"
 type="int"
 transient="false"
 volatile="false"
 value="2012"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_FINALIZE_FAILED"
 type="int"
 transient="false"
 volatile="false"
 value="2010"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_INITIALIZE_FAILED"
 type="int"
 transient="false"
 volatile="false"
 value="2009"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_NOT_SUPPORTED"
 type="int"
 transient="false"
 volatile="false"
 value="2003"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_NO_INTERNET_CONNECTION"
 type="int"
 transient="false"
 volatile="false"
 value="2005"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_OUT_OF_MEMORY"
 type="int"
 transient="false"
 volatile="false"
 value="2004"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_REGISTRATION_FAILED"
 type="int"
 transient="false"
 volatile="false"
 value="2006"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_REMOVE_ALL_RIGHTS_FAILED"
 type="int"
 transient="false"
 volatile="false"
 value="2011"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_RIGHTS_ACQUISITION_FAILED"
 type="int"
 transient="false"
 volatile="false"
 value="2008"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_RIGHTS_NOT_INSTALLED"
 type="int"
 transient="false"
 volatile="false"
 value="2001"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_RIGHTS_RENEWAL_NOT_ALLOWED"
 type="int"
 transient="false"
 volatile="false"
 value="2002"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_UNREGISTRATION_FAILED"
 type="int"
 transient="false"
 volatile="false"
 value="2007"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="DrmEvent"
 extends="java.lang.Object"
 abstract="false"
@@ -55685,6 +55840,105 @@
 visibility="public"
>
</method>
<field name="DRM_INFO_OBJECT"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;drm_info_object&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="DRM_INFO_STATUS_OBJECT"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;drm_info_status_object&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_ALL_RIGHTS_REMOVED"
 type="int"
 transient="false"
 volatile="false"
 value="1006"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_DRM_INFO_ACQUIRED"
 type="int"
 transient="false"
 volatile="false"
 value="1007"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_FINALIZED"
 type="int"
 transient="false"
 volatile="false"
 value="1001"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_INITIALIZED"
 type="int"
 transient="false"
 volatile="false"
 value="1003"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_REGISTERED"
 type="int"
 transient="false"
 volatile="false"
 value="1002"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_RIGHTS_ACQUIRED"
 type="int"
 transient="false"
 volatile="false"
 value="1005"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_UNREGISTERED"
 type="int"
 transient="false"
 volatile="false"
 value="1004"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="DrmInfo"
 extends="java.lang.Object"
@@ -55828,44 +56082,22 @@
<parameter name="message" type="java.lang.String">
</parameter>
</constructor>
<field name="TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT"
 type="int"
 transient="false"
 volatile="false"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_NOT_SUPPORTED"
 type="int"
 transient="false"
 volatile="false"
 value="6"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_NO_INTERNET_CONNECTION"
<field name="TYPE_ACCOUNT_ALREADY_REGISTERED"
 type="int"
 transient="false"
 volatile="false"
 value="9"
 value="5"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_OUT_OF_MEMORY"
<field name="TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT"
 type="int"
 transient="false"
 volatile="false"
 value="8"
 value="1"
 static="true"
 final="true"
 deprecated="not deprecated"
@@ -55894,33 +56126,11 @@
 visibility="public"
>
</field>
<field name="TYPE_RIGHTS_NOT_INSTALLED"
 type="int"
 transient="false"
 volatile="false"
 value="4"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_RIGHTS_RENEWAL_NOT_ALLOWED"
 type="int"
 transient="false"
 volatile="false"
 value="5"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="TYPE_WAIT_FOR_RIGHTS"
 type="int"
 transient="false"
 volatile="false"
 value="7"
 value="4"
 static="true"
 final="true"
 deprecated="not deprecated"
@@ -56181,7 +56391,7 @@
</parameter>
</constructor>
<method name="acquireDrmInfo"
 return="android.drm.DrmInfo"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
@@ -56208,6 +56418,21 @@
<parameter name="mimeType" type="java.lang.String">
</parameter>
</method>
<method name="canHandle"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="mimeType" type="java.lang.String">
</parameter>
</method>
<method name="checkRightsStatus"
 return="int"
 abstract="false"
@@ -56231,11 +56456,39 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
</method>
<method name="checkRightsStatus"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="path" type="java.lang.String">
</parameter>
<parameter name="action" type="int">
</parameter>
</method>
<method name="checkRightsStatus"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="action" type="int">
</parameter>
</method>
<method name="closeConvertSession"
 return="android.drm.DrmConvertedStatus"
 abstract="false"
@@ -56290,6 +56543,21 @@
<parameter name="action" type="int">
</parameter>
</method>
<method name="getConstraints"
 return="android.content.ContentValues"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="action" type="int">
</parameter>
</method>
<method name="getDrmObjectType"
 return="int"
 abstract="false"
@@ -56305,6 +56573,21 @@
<parameter name="mimeType" type="java.lang.String">
</parameter>
</method>
<method name="getDrmObjectType"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
<parameter name="mimeType" type="java.lang.String">
</parameter>
</method>
<method name="getOriginalMimeType"
 return="java.lang.String"
 abstract="false"
@@ -56318,8 +56601,21 @@
<parameter name="path" type="java.lang.String">
</parameter>
</method>
<method name="getOriginalMimeType"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
</method>
<method name="loadPlugIns"
 return="void"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
@@ -56343,7 +56639,7 @@
</parameter>
</method>
<method name="processDrmInfo"
 return="android.drm.DrmInfoStatus"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
@@ -56356,7 +56652,7 @@
</parameter>
</method>
<method name="removeAllRights"
 return="void"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
@@ -56367,7 +56663,7 @@
>
</method>
<method name="removeRights"
 return="void"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
@@ -56379,8 +56675,21 @@
<parameter name="path" type="java.lang.String">
</parameter>
</method>
<method name="removeRights"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="uri" type="android.net.Uri">
</parameter>
</method>
<method name="saveRights"
 return="void"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
@@ -56398,11 +56707,37 @@
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="setOnErrorListener"
 return="void"
 abstract="false"
 native="false"
 synchronized="true"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="errorListener" type="android.drm.DrmManagerClient.OnErrorListener">
</parameter>
</method>
<method name="setOnEventListener"
 return="void"
 abstract="false"
 native="false"
 synchronized="true"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="eventListener" type="android.drm.DrmManagerClient.OnEventListener">
</parameter>
</method>
<method name="setOnInfoListener"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 synchronized="true"
 static="false"
 final="false"
 deprecated="not deprecated"
@@ -56412,7 +56747,7 @@
</parameter>
</method>
<method name="unloadPlugIns"
 return="void"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
@@ -56422,7 +56757,77 @@
 visibility="public"
>
</method>
<field name="ERROR_NONE"
 type="int"
 transient="false"
 volatile="false"
 value="0"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="ERROR_UNKNOWN"
 type="int"
 transient="false"
 volatile="false"
 value="-2000"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<interface name="DrmManagerClient.OnErrorListener"
 abstract="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<method name="onError"
 return="void"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="client" type="android.drm.DrmManagerClient">
</parameter>
<parameter name="event" type="android.drm.DrmErrorEvent">
</parameter>
</method>
</interface>
<interface name="DrmManagerClient.OnEventListener"
 abstract="true"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<method name="onEvent"
 return="void"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="client" type="android.drm.DrmManagerClient">
</parameter>
<parameter name="event" type="android.drm.DrmEvent">
</parameter>
<parameter name="attributes" type="java.util.HashMap&lt;java.lang.String, java.lang.Object&gt;">
</parameter>
</method>
</interface>
<interface name="DrmManagerClient.OnInfoListener"
 abstract="true"
 static="true"
+0 −4
Original line number Diff line number Diff line
@@ -75,12 +75,10 @@ DrmConstraints::KeyIterator DrmConstraints::keyIterator() {
DrmConstraints::KeyIterator::KeyIterator(const DrmConstraints::KeyIterator& keyIterator)
    : mDrmConstraints(keyIterator.mDrmConstraints),
      mIndex(keyIterator.mIndex) {
    LOGV("DrmConstraints::KeyIterator::KeyIterator");
}

DrmConstraints::KeyIterator& DrmConstraints::KeyIterator::operator=(
    const DrmConstraints::KeyIterator& keyIterator) {
    LOGV("DrmConstraints::KeyIterator::operator=");
    mDrmConstraints = keyIterator.mDrmConstraints;
    mIndex = keyIterator.mIndex;
    return *this;
@@ -94,12 +92,10 @@ DrmConstraints::Iterator DrmConstraints::iterator() {
DrmConstraints::Iterator::Iterator(const DrmConstraints::Iterator& iterator) :
    mDrmConstraints(iterator.mDrmConstraints),
    mIndex(iterator.mIndex) {
    LOGV("DrmConstraints::Iterator::Iterator");
}

DrmConstraints::Iterator& DrmConstraints::Iterator::operator=(
    const DrmConstraints::Iterator& iterator) {
    LOGV("DrmConstraints::Iterator::operator=");
    mDrmConstraints = iterator.mDrmConstraints;
    mIndex = iterator.mIndex;
    return *this;
+19 −19
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ DrmInfoStatus* DrmEngineBase::processDrmInfo(int uniqueId, const DrmInfo* drmInf
    return onProcessDrmInfo(uniqueId, drmInfo);
}

void DrmEngineBase::saveRights(
status_t DrmEngineBase::saveRights(
            int uniqueId, const DrmRights& drmRights,
            const String8& rightsPath, const String8& contentPath) {
    return onSaveRights(uniqueId, drmRights, rightsPath, contentPath);
@@ -74,14 +74,14 @@ int DrmEngineBase::checkRightsStatus(int uniqueId, const String8& path, int acti
    return onCheckRightsStatus(uniqueId, path, action);
}

void DrmEngineBase::consumeRights(
status_t DrmEngineBase::consumeRights(
    int uniqueId, DecryptHandle* decryptHandle, int action, bool reserve) {
    onConsumeRights(uniqueId, decryptHandle, action, reserve);
    return onConsumeRights(uniqueId, decryptHandle, action, reserve);
}

void DrmEngineBase::setPlaybackStatus(
status_t DrmEngineBase::setPlaybackStatus(
    int uniqueId, DecryptHandle* decryptHandle, int playbackStatus, int position) {
    onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
    return onSetPlaybackStatus(uniqueId, decryptHandle, playbackStatus, position);
}

bool DrmEngineBase::validateAction(
@@ -90,16 +90,16 @@ bool DrmEngineBase::validateAction(
    return onValidateAction(uniqueId, path, action, description);
}

void DrmEngineBase::removeRights(int uniqueId, const String8& path) {
    onRemoveRights(uniqueId, path);
status_t DrmEngineBase::removeRights(int uniqueId, const String8& path) {
    return onRemoveRights(uniqueId, path);
}

void DrmEngineBase::removeAllRights(int uniqueId) {
    onRemoveAllRights(uniqueId);
status_t DrmEngineBase::removeAllRights(int uniqueId) {
    return onRemoveAllRights(uniqueId);
}

void DrmEngineBase::openConvertSession(int uniqueId, int convertId) {
    onOpenConvertSession(uniqueId, convertId);
status_t DrmEngineBase::openConvertSession(int uniqueId, int convertId) {
    return onOpenConvertSession(uniqueId, convertId);
}

DrmConvertedStatus* DrmEngineBase::convertData(
@@ -120,24 +120,24 @@ status_t DrmEngineBase::openDecryptSession(
    return onOpenDecryptSession(uniqueId, decryptHandle, fd, offset, length);
}

void DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
    onCloseDecryptSession(uniqueId, decryptHandle);
status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
    return onCloseDecryptSession(uniqueId, decryptHandle);
}

void DrmEngineBase::initializeDecryptUnit(
status_t DrmEngineBase::initializeDecryptUnit(
    int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId, const DrmBuffer* headerInfo) {
    onInitializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo);
    return onInitializeDecryptUnit(uniqueId, decryptHandle, decryptUnitId, headerInfo);
}

status_t DrmEngineBase::decrypt(
    int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId,
    const DrmBuffer* encBuffer, DrmBuffer** decBuffer) {
    return onDecrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer);
    const DrmBuffer* encBuffer, DrmBuffer** decBuffer, DrmBuffer* IV) {
    return onDecrypt(uniqueId, decryptHandle, decryptUnitId, encBuffer, decBuffer, IV);
}

void DrmEngineBase::finalizeDecryptUnit(
status_t DrmEngineBase::finalizeDecryptUnit(
    int uniqueId, DecryptHandle* decryptHandle, int decryptUnitId) {
    onFinalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
    return onFinalizeDecryptUnit(uniqueId, decryptHandle, decryptUnitId);
}

ssize_t DrmEngineBase::pread(
+0 −4
Original line number Diff line number Diff line
@@ -14,10 +14,6 @@
 * limitations under the License.
 */

#define LOG_NDEBUG 0
#define LOG_TAG "DrmInfoEvent"
#include "utils/Log.h"

#include <utils/String8.h>
#include <drm/DrmInfoEvent.h>

+17 −5
Original line number Diff line number Diff line
@@ -15,14 +15,21 @@
 */

#include <drm/DrmRights.h>
#include <ReadWriteUtils.h>

using namespace android;

DrmRights::DrmRights(const String8& rightsFilePath, const String8& mimeType,
            const String8& accountId, const String8& subscriptionId) {
    /**
     * TODO Read DrmRights from rights file
     */
            const String8& accountId, const String8& subscriptionId) :
    mMimeType(mimeType),
    mAccountId(accountId),
    mSubscriptionId(subscriptionId),
    mRightsFromFile(NULL) {
    int rightsLength = 0;
    if (String8("") != rightsFilePath) {
        rightsLength = ReadWriteUtils::readBytes(rightsFilePath, &mRightsFromFile);
    }
    mData = DrmBuffer(mRightsFromFile, rightsLength);
}

DrmRights::DrmRights(const DrmBuffer& rightsData, const String8& mimeType,
@@ -30,7 +37,12 @@ DrmRights::DrmRights(const DrmBuffer& rightsData, const String8& mimeType,
    mData(rightsData),
    mMimeType(mimeType),
    mAccountId(accountId),
    mSubscriptionId(subscriptionId) {
    mSubscriptionId(subscriptionId),
    mRightsFromFile(NULL) {
}

DrmRights::~DrmRights() {
    delete[] mRightsFromFile; mRightsFromFile = NULL;
}

const DrmBuffer& DrmRights::getData(void) const {
Loading