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

Commit 2352f485 authored by Gloria Wang's avatar Gloria Wang
Browse files

DO NOT MERGE

For bug 4422428
Squashed commit of the following:

commit ae2e13783db2284f40d3891e70e152dab941edfc
Author: Gloria Wang <gwang@google.com>
Date:   Fri May 13 11:43:11 2011 -0700

    Add one more DRM error code. For bug 4422428.

    Change-Id: I4e333f474c96c0e0f162dde4013ad32b336bebd6

commit 0f88249d0cb5221f622cf1d1ac3cdccefb8f58a2
Author: Gloria Wang <gwang@google.com>
Date:   Fri Apr 29 10:44:46 2011 -0700

    Add DRM errors in the DRM frameworks to MediaErrors also.
    For bug 4350156.

    Change-Id: Ib5711ec642178a49203a448b7f5114e675d49394

Change-Id: Ia02de462159400eef8c015d28531bf1dd6796a18
parent 1a65546a
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -30,14 +30,18 @@ namespace android {
 * Error code for DRM Frameowrk
 */
enum {
    DRM_ERROR_BASE = -2000,

    DRM_ERROR_UNKNOWN                       = DRM_ERROR_BASE,
    DRM_ERROR_LICENSE_EXPIRED               = DRM_ERROR_BASE - 1,
    DRM_ERROR_SESSION_NOT_OPENED            = DRM_ERROR_BASE - 2,
    DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED  = DRM_ERROR_BASE - 3,
    DRM_ERROR_DECRYPT                       = DRM_ERROR_BASE - 4,
    DRM_ERROR_CANNOT_HANDLE                 = DRM_ERROR_BASE - 5,
    // The following constant values should be in sync with
    // media/stagefright/MediaErrors.h
    ERROR_BASE = -2000,

    DRM_ERROR_UNKNOWN                       = ERROR_BASE,
    DRM_ERROR_NO_LICENSE                    = ERROR_BASE - 1,
    DRM_ERROR_LICENSE_EXPIRED               = ERROR_BASE - 2,
    DRM_ERROR_SESSION_NOT_OPENED            = ERROR_BASE - 3,
    DRM_ERROR_DECRYPT_UNIT_NOT_INITIALIZED  = ERROR_BASE - 4,
    DRM_ERROR_DECRYPT                       = ERROR_BASE - 5,
    DRM_ERROR_CANNOT_HANDLE                 = ERROR_BASE - 6,
    DRM_ERROR_TAMPER_DETECTED               = ERROR_BASE - 7,

    DRM_NO_ERROR                            = NO_ERROR
};
+12 −1
Original line number Diff line number Diff line
@@ -41,7 +41,18 @@ enum {
    INFO_FORMAT_CHANGED    = MEDIA_ERROR_BASE - 12,
    INFO_DISCONTINUITY     = MEDIA_ERROR_BASE - 13,

    ERROR_NO_LICENSE       = MEDIA_ERROR_BASE - 14,
    // The following constant values should be in sync with
    // drm/drm_framework_common.h
    DRM_ERROR_BASE = -2000,

    ERROR_DRM_UNKNOWN                       = DRM_ERROR_BASE,
    ERROR_DRM_NO_LICENSE                    = DRM_ERROR_BASE - 1,
    ERROR_DRM_LICENSE_EXPIRED               = DRM_ERROR_BASE - 2,
    ERROR_DRM_SESSION_NOT_OPENED            = DRM_ERROR_BASE - 3,
    ERROR_DRM_DECRYPT_UNIT_NOT_INITIALIZED  = DRM_ERROR_BASE - 4,
    ERROR_DRM_DECRYPT                       = DRM_ERROR_BASE - 5,
    ERROR_DRM_CANNOT_HANDLE                 = DRM_ERROR_BASE - 6,
    ERROR_DRM_TAMPER_DETECTED               = DRM_ERROR_BASE - 7,

    // Heartbeat Error Codes
    HEARTBEAT_ERROR_BASE = -3000,
+2 −2
Original line number Diff line number Diff line
@@ -312,7 +312,7 @@ status_t AwesomePlayer::setDataSource_l(
    if (mDecryptHandle != NULL) {
        CHECK(mDrmManagerClient);
        if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
            notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_NO_LICENSE);
            notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
        }
    }

@@ -1750,7 +1750,7 @@ status_t AwesomePlayer::finishSetDataSource_l() {
    if (mDecryptHandle != NULL) {
        CHECK(mDrmManagerClient);
        if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
            notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_NO_LICENSE);
            notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
        }
    }

+2 −6
Original line number Diff line number Diff line
@@ -146,18 +146,14 @@ status_t DRMSource::read(MediaBuffer **buffer, const ReadOptions *options) {
    DrmBuffer *pDecryptedDrmBuffer = &decryptedDrmBuffer;

    if ((err = mDrmManagerClient->decrypt(mDecryptHandle, mTrackId,
            &encryptedDrmBuffer, &pDecryptedDrmBuffer)) != DRM_NO_ERROR) {
            &encryptedDrmBuffer, &pDecryptedDrmBuffer)) != NO_ERROR) {

        if (decryptedDrmBuffer.data) {
            delete [] decryptedDrmBuffer.data;
            decryptedDrmBuffer.data = NULL;
        }

        if (err == DRM_ERROR_LICENSE_EXPIRED) {
            return ERROR_NO_LICENSE;
        } else {
            return ERROR_IO;
        }
        return err;
    }
    CHECK(pDecryptedDrmBuffer == &decryptedDrmBuffer);