Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45548ea8 authored by Jeff Tinker's avatar Jeff Tinker
Browse files

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
parent 17c5206b
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -50,10 +50,12 @@ interface IDrmFactory {
     *
     * @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);
};
+6 −5
Original line number Diff line number Diff line
@@ -46,8 +46,8 @@ Return<bool> DrmFactory::isContentTypeSupported (
}

    Return<void> DrmFactory::createPlugin(const hidl_array<uint8_t, 16>& uuid,
        createPlugin_cb _hidl_cb) {
    sp<IDrmPlugin> plugin = createTreblePlugin(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> DrmFactory::createPlugin(const hidl_array<uint8_t, 16>& uuid,
    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;
                    }
+4 −2
Original line number Diff line number Diff line
@@ -49,7 +49,8 @@ struct DrmFactory : public IDrmFactory {
            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 @@ private:
        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;