summaryrefslogtreecommitdiffstats
path: root/media/libmedia/ICrypto.cpp
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2012-04-19 12:52:20 -0700
committerAndreas Huber <andih@google.com>2012-04-19 12:53:59 -0700
commit5b8987e7de9d04b09153f329c680d2316cdb44ec (patch)
tree2b08e1f8abd0d4b869ce8923b1462530b916a7eb /media/libmedia/ICrypto.cpp
parentfd9e14bc28f377065e43ec6833d754ca151b3941 (diff)
downloadframeworks_av-5b8987e7de9d04b09153f329c680d2316cdb44ec.zip
frameworks_av-5b8987e7de9d04b09153f329c680d2316cdb44ec.tar.gz
frameworks_av-5b8987e7de9d04b09153f329c680d2316cdb44ec.tar.bz2
Allow propagation of error information and description from the CryptoPlugin to
the higher layers. Change-Id: I9f434ad55cdf575803c208bedf47b607baff2330 related-to-bug: 6365261
Diffstat (limited to 'media/libmedia/ICrypto.cpp')
-rw-r--r--media/libmedia/ICrypto.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp
index d51fe01..3452e5c 100644
--- a/media/libmedia/ICrypto.cpp
+++ b/media/libmedia/ICrypto.cpp
@@ -20,7 +20,9 @@
#include <binder/Parcel.h>
#include <media/ICrypto.h>
+#include <media/stagefright/MediaErrors.h>
#include <media/stagefright/foundation/ADebug.h>
+#include <media/stagefright/foundation/AString.h>
namespace android {
@@ -96,7 +98,8 @@ struct BpCrypto : public BpInterface<ICrypto> {
CryptoPlugin::Mode mode,
const void *srcPtr,
const CryptoPlugin::SubSample *subSamples, size_t numSubSamples,
- void *dstPtr) {
+ void *dstPtr,
+ AString *errorDetailMsg) {
Parcel data, reply;
data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
data.writeInt32(secure);
@@ -135,6 +138,10 @@ struct BpCrypto : public BpInterface<ICrypto> {
status_t result = reply.readInt32();
+ if (result >= ERROR_DRM_VENDOR_MIN && result <= ERROR_DRM_VENDOR_MAX) {
+ errorDetailMsg->setTo(reply.readCString());
+ }
+
if (result != OK) {
return result;
}
@@ -251,6 +258,8 @@ status_t BnCrypto::onTransact(
dstPtr = malloc(totalSize);
}
+ AString errorDetailMsg;
+
status_t err = decrypt(
secure,
key,
@@ -258,10 +267,16 @@ status_t BnCrypto::onTransact(
mode,
srcData,
subSamples, numSubSamples,
- dstPtr);
+ dstPtr,
+ &errorDetailMsg);
reply->writeInt32(err);
+ if (err >= ERROR_DRM_VENDOR_MIN
+ && err <= ERROR_DRM_VENDOR_MAX) {
+ reply->writeCString(errorDetailMsg.c_str());
+ }
+
if (!secure) {
if (err == OK) {
reply->write(dstPtr, totalSize);