Throw exception on mismatched system vs vendor
When the system partition is a later version than vendor,
new MediaDrm APIs will not have HAL implementations. In
this case throw java.lang.UnsupportedOperationException.
bug:110701831
bug:123375769
test: cts media test cases, gts media tests
Change-Id: Ib631bf4d4d245d857e61bd3fe0e5808e430a034d
diff --git a/drm/libmediadrm/IDrm.cpp b/drm/libmediadrm/IDrm.cpp
index 0f34315..51274d1 100644
--- a/drm/libmediadrm/IDrm.cpp
+++ b/drm/libmediadrm/IDrm.cpp
@@ -83,8 +83,8 @@
return reply.readInt32();
}
- virtual bool isCryptoSchemeSupported(const uint8_t uuid[16], const String8 &mimeType,
- DrmPlugin::SecurityLevel level) {
+ virtual status_t isCryptoSchemeSupported(const uint8_t uuid[16], const String8 &mimeType,
+ DrmPlugin::SecurityLevel level, bool *isSupported) {
Parcel data, reply;
data.writeInterfaceToken(IDrm::getInterfaceDescriptor());
data.write(uuid, 16);
@@ -94,10 +94,11 @@
status_t status = remote()->transact(IS_CRYPTO_SUPPORTED, data, &reply);
if (status != OK) {
ALOGE("isCryptoSchemeSupported: binder call failed: %d", status);
- return false;
+ return status;
}
+ *isSupported = static_cast<bool>(reply.readInt32());
- return reply.readInt32() != 0;
+ return reply.readInt32();
}
virtual status_t createPlugin(const uint8_t uuid[16],
@@ -773,7 +774,10 @@
String8 mimeType = data.readString8();
DrmPlugin::SecurityLevel level =
static_cast<DrmPlugin::SecurityLevel>(data.readInt32());
- reply->writeInt32(isCryptoSchemeSupported(uuid, mimeType, level));
+ bool isSupported = false;
+ status_t result = isCryptoSchemeSupported(uuid, mimeType, level, &isSupported);
+ reply->writeInt32(isSupported);
+ reply->writeInt32(result);
return OK;
}