Improve Error Reporting

Adds more meaningful error reporting where possible to the DrmEngine.  Adds
translation of CDM and OEMCrypto errors to Android errors.

Bug: 8621516
Change-Id: Ibab8a8711c3929ed72870ec7e138cd42358d9fb3
This commit is contained in:
Jeff Tinker
2013-04-17 19:02:54 -07:00
parent 40abceaaed
commit ded298688c
9 changed files with 218 additions and 120 deletions

View File

@@ -0,0 +1,23 @@
//
// Copyright 2013 Google Inc. All Rights Reserved.
//
#ifndef WV_ERRORS_H_
#define WV_ERRORS_H_
#include "media/stagefright/MediaErrors.h"
namespace wvdrm {
using android::ERROR_DRM_VENDOR_MIN;
enum {
kErrorNeedProvisioning = ERROR_DRM_VENDOR_MIN,
kErrorDeviceRevoked = ERROR_DRM_VENDOR_MIN + 1,
kErrorIncorrectBufferSize = ERROR_DRM_VENDOR_MIN + 2,
kErrorCDMGeneric = ERROR_DRM_VENDOR_MIN + 3,
};
} // namespace wvdrm
#endif // WV_ERRORS_H_

View File

@@ -0,0 +1,49 @@
//
// Copyright 2013 Google Inc. All Rights Reserved.
//
#ifndef WV_MAP_ERRORS_H_
#define WV_MAP_ERRORS_H_
#include "media/stagefright/MediaErrors.h"
#include "utils/Errors.h"
#include "wv_cdm_types.h"
#include "WVErrors.h"
namespace wvdrm {
static android::status_t mapCdmResponseType(wvcdm::CdmResponseType res) {
switch (res) {
case wvcdm::NO_ERROR:
case wvcdm::KEY_ADDED:
case wvcdm::KEY_MESSAGE:
case wvcdm::KEY_CANCELED:
// KEY_ADDED, KEY_MESSAGE, and KEY_CANCELLED are all alternative
// success messages for certain CDM methods instead of NO_ERROR.
return android::OK;
case wvcdm::NEED_KEY:
return android::ERROR_DRM_NO_LICENSE;
case wvcdm::NEED_PROVISIONING:
return kErrorNeedProvisioning;
case wvcdm::DEVICE_REVOKED:
return kErrorDeviceRevoked;
case wvcdm::KEY_ERROR:
// KEY_ERROR is used by the CDM to mean just about any kind of error, not
// just license errors, so it is mapped to the generic response.
return kErrorCDMGeneric;
case wvcdm::UNKNOWN_ERROR:
return android::ERROR_DRM_UNKNOWN;
}
// Return here instead of as a default case so that the compiler will warn
// us if we forget to include an enum member in the switch statement.
return android::UNKNOWN_ERROR;
}
static inline bool isCdmResponseTypeSuccess(wvcdm::CdmResponseType res) {
return mapCdmResponseType(res) == android::OK;
}
} // namespace wvdrm
#endif // WV_MAP_ERRORS_H_