summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorJeff Tinker <jtinker@google.com>2015-04-10 21:03:23 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-10 21:03:24 +0000
commit4c1efbc76f1dfeb9427617e451042a12bfb59ad3 (patch)
tree43c39c7172b3cfbbc26678a5233702a011ef27b3 /media/libmedia
parentc255757c795e5db87bafa6609c4ae052cf38b45b (diff)
parent1849570240443d1f75775c205fa658f7070849c6 (diff)
downloadframeworks_av-4c1efbc76f1dfeb9427617e451042a12bfb59ad3.zip
frameworks_av-4c1efbc76f1dfeb9427617e451042a12bfb59ad3.tar.gz
frameworks_av-4c1efbc76f1dfeb9427617e451042a12bfb59ad3.tar.bz2
Merge "Add a method to associate MediaDrm session with MediaCrypto"
Diffstat (limited to 'media/libmedia')
-rw-r--r--media/libmedia/ICrypto.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/media/libmedia/ICrypto.cpp b/media/libmedia/ICrypto.cpp
index 23308c1..9246a7c 100644
--- a/media/libmedia/ICrypto.cpp
+++ b/media/libmedia/ICrypto.cpp
@@ -35,6 +35,7 @@ enum {
REQUIRES_SECURE_COMPONENT,
DECRYPT,
NOTIFY_RESOLUTION,
+ SET_MEDIADRM_SESSION,
};
struct BpCrypto : public BpInterface<ICrypto> {
@@ -161,7 +162,28 @@ struct BpCrypto : public BpInterface<ICrypto> {
remote()->transact(NOTIFY_RESOLUTION, data, &reply);
}
+ virtual status_t setMediaDrmSession(const Vector<uint8_t> &sessionId) {
+ Parcel data, reply;
+ data.writeInterfaceToken(ICrypto::getInterfaceDescriptor());
+
+ writeVector(data, sessionId);
+ remote()->transact(SET_MEDIADRM_SESSION, data, &reply);
+
+ return reply.readInt32();
+ }
+
private:
+ void readVector(Parcel &reply, Vector<uint8_t> &vector) const {
+ uint32_t size = reply.readInt32();
+ vector.insertAt((size_t)0, size);
+ reply.read(vector.editArray(), size);
+ }
+
+ void writeVector(Parcel &data, Vector<uint8_t> const &vector) const {
+ data.writeInt32(vector.size());
+ data.write(vector.array(), vector.size());
+ }
+
DISALLOW_EVIL_CONSTRUCTORS(BpCrypto);
};
@@ -169,6 +191,17 @@ IMPLEMENT_META_INTERFACE(Crypto, "android.hardware.ICrypto");
////////////////////////////////////////////////////////////////////////////////
+void BnCrypto::readVector(const Parcel &data, Vector<uint8_t> &vector) const {
+ uint32_t size = data.readInt32();
+ vector.insertAt((size_t)0, size);
+ data.read(vector.editArray(), size);
+}
+
+void BnCrypto::writeVector(Parcel *reply, Vector<uint8_t> const &vector) const {
+ reply->writeInt32(vector.size());
+ reply->write(vector.array(), vector.size());
+}
+
status_t BnCrypto::onTransact(
uint32_t code, const Parcel &data, Parcel *reply, uint32_t flags) {
switch (code) {
@@ -317,6 +350,15 @@ status_t BnCrypto::onTransact(
return OK;
}
+ case SET_MEDIADRM_SESSION:
+ {
+ CHECK_INTERFACE(IDrm, data, reply);
+ Vector<uint8_t> sessionId;
+ readVector(data, sessionId);
+ reply->writeInt32(setMediaDrmSession(sessionId));
+ return OK;
+ }
+
default:
return BBinder::onTransact(code, data, reply, flags);
}