Add vendor-requested parameter to createPlugin
A feature in O requires a small change to the
drm HAL: adding a parameter to the createPlugin
method in the DrmFactory.
bug:31306973
Change-Id: Iab0f7ee58103b357f10cf05ea7986a8fc01eebf6
diff --git a/drm/1.0/IDrmFactory.hal b/drm/1.0/IDrmFactory.hal
index de53929..f8e4779 100644
--- a/drm/1.0/IDrmFactory.hal
+++ b/drm/1.0/IDrmFactory.hal
@@ -50,10 +50,12 @@
*
* @param uuid uniquely identifies the drm scheme. See
* http://dashif.org/identifiers/protection for uuid assignments
+ * @param appPackageName identifies the package name of the calling
+ * application.
* @return status the status of the call. The HAL implementation must return
* OK if the plugin is created and ERROR_DRM_CANNOT_HANDLE if the plugin
* cannot be created.
*/
- createPlugin(uint8_t[16] uuid) generates (Status status,
- IDrmPlugin drmPlugin);
+ createPlugin(uint8_t[16] uuid, string appPackageName)
+ generates (Status status, IDrmPlugin drmPlugin);
};
diff --git a/drm/1.0/default/DrmFactory.cpp b/drm/1.0/default/DrmFactory.cpp
index d7a7c6d..c98c1da 100644
--- a/drm/1.0/default/DrmFactory.cpp
+++ b/drm/1.0/default/DrmFactory.cpp
@@ -45,9 +45,9 @@
isContentTypeSupported<LegacyLoader, String8>(legacyLoader, mimeType);
}
-Return<void> DrmFactory::createPlugin(const hidl_array<uint8_t, 16>& uuid,
- createPlugin_cb _hidl_cb) {
- sp<IDrmPlugin> plugin = createTreblePlugin(uuid);
+ Return<void> DrmFactory::createPlugin(const hidl_array<uint8_t, 16>& uuid,
+ const hidl_string& appPackageName, createPlugin_cb _hidl_cb) {
+ sp<IDrmPlugin> plugin = createTreblePlugin(uuid, appPackageName);
if (plugin == nullptr) {
plugin = createLegacyPlugin(uuid);
}
@@ -55,11 +55,12 @@
return Void();
}
-sp<IDrmPlugin> DrmFactory::createTreblePlugin(const hidl_array<uint8_t, 16>& uuid) {
+sp<IDrmPlugin> DrmFactory::createTreblePlugin(const hidl_array<uint8_t, 16>& uuid,
+ const hidl_string& appPackageName) {
sp<IDrmPlugin> plugin;
for (size_t i = 0; i < trebleLoader.factoryCount(); i++) {
Return<void> hResult = trebleLoader.getFactory(i)->createPlugin(uuid,
- [&](Status status, const sp<IDrmPlugin>& hPlugin) {
+ appPackageName, [&](Status status, const sp<IDrmPlugin>& hPlugin) {
if (status == Status::OK) {
plugin = hPlugin;
}
diff --git a/drm/1.0/default/DrmFactory.h b/drm/1.0/default/DrmFactory.h
index 3291ea2..2e71624 100644
--- a/drm/1.0/default/DrmFactory.h
+++ b/drm/1.0/default/DrmFactory.h
@@ -49,7 +49,8 @@
override;
Return<void> createPlugin(const hidl_array<uint8_t, 16>& uuid,
- createPlugin_cb _hidl_cb) override;
+ const hidl_string& appPackageName, createPlugin_cb _hidl_cb) override;
+
private:
template <typename L> Return<bool> isCryptoSchemeSupported(
const L& loader, const hidl_array<uint8_t, 16>& uuid) {
@@ -71,7 +72,8 @@
return false;
}
- sp<IDrmPlugin> createTreblePlugin(const hidl_array<uint8_t, 16>& uuid);
+ sp<IDrmPlugin> createTreblePlugin(const hidl_array<uint8_t, 16>& uuid,
+ const hidl_string& appPackageName);
sp<IDrmPlugin> createLegacyPlugin(const hidl_array<uint8_t, 16>& uuid);
typedef android::PluginLoader<IDrmFactory> PluginLoader;