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

Commit 3717431b authored by Robert Shih's avatar Robert Shih Committed by Android (Google) Code Review
Browse files

Merge "DrmHal: use DrmUtils to create IDrmFactories"

parents 69061a28 c0d1d0ee
Loading
Loading
Loading
Loading
+3 −38
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
#include <mediadrm/DrmSessionClientInterface.h>
#include <mediadrm/DrmSessionManager.h>
#include <mediadrm/IDrmMetricsConsumer.h>
#include <mediadrm/DrmUtils.h>

#include <vector>

@@ -388,44 +389,8 @@ void DrmHal::cleanup() {
    mPluginV1_2.clear();
}

Vector<sp<IDrmFactory>> DrmHal::makeDrmFactories() {
    Vector<sp<IDrmFactory>> factories;

    auto manager = hardware::defaultServiceManager1_2();

    if (manager != NULL) {
        manager->listManifestByInterface(drm::V1_0::IDrmFactory::descriptor,
                [&factories](const hidl_vec<hidl_string> &registered) {
                    for (const auto &instance : registered) {
                        auto factory = drm::V1_0::IDrmFactory::getService(instance);
                        if (factory != NULL) {
                            factories.push_back(factory);
                        }
                    }
                }
            );
        manager->listManifestByInterface(drm::V1_1::IDrmFactory::descriptor,
                [&factories](const hidl_vec<hidl_string> &registered) {
                    for (const auto &instance : registered) {
                        auto factory = drm::V1_1::IDrmFactory::getService(instance);
                        if (factory != NULL) {
                            factories.push_back(factory);
                        }
                    }
                }
            );
        manager->listManifestByInterface(drm::V1_2::IDrmFactory::descriptor,
                [&factories](const hidl_vec<hidl_string> &registered) {
                    for (const auto &instance : registered) {
                        auto factory = drm::V1_2::IDrmFactory::getService(instance);
                        if (factory != NULL) {
                            factories.push_back(factory);
                        }
                    }
                }
            );
    }

std::vector<sp<IDrmFactory>> DrmHal::makeDrmFactories() {
    std::vector<sp<IDrmFactory>> factories(DrmUtils::MakeDrmFactories());
    if (factories.size() == 0) {
        // must be in passthrough mode, load the default passthrough service
        auto passthrough = IDrmFactory::getService();
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ void MakeHidlFactories(const uint8_t uuid[16], V &factories) {
            auto factory = Hal::getService(instance);
            if (factory != nullptr) {
                ALOGI("found %s %s", Hal::descriptor, instance.c_str());
                if (factory->isCryptoSchemeSupported(uuid)) {
                if (!uuid || factory->isCryptoSchemeSupported(uuid)) {
                    factories.push_back(factory);
                }
            }
+2 −2
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ private:
    mutable Mutex mEventLock;
    mutable Mutex mNotifyLock;

    const Vector<sp<IDrmFactory>> mFactories;
    const std::vector<sp<IDrmFactory>> mFactories;
    sp<IDrmPlugin> mPlugin;
    sp<drm::V1_1::IDrmPlugin> mPluginV1_1;
    sp<drm::V1_2::IDrmPlugin> mPluginV1_2;
@@ -219,7 +219,7 @@ private:
     */
    status_t mInitCheck;

    Vector<sp<IDrmFactory>> makeDrmFactories();
    std::vector<sp<IDrmFactory>> makeDrmFactories();
    sp<IDrmPlugin> makeDrmPlugin(const sp<IDrmFactory>& factory,
            const uint8_t uuid[16], const String8& appPackageName);

+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ void WriteKeysChange(
    obj.writeInt32(hasNewUsableKey);
}

std::vector<sp<::V1_0::IDrmFactory>> MakeDrmFactories(const uint8_t uuid[16]);
std::vector<sp<::V1_0::IDrmFactory>> MakeDrmFactories(const uint8_t uuid[16] = nullptr);

std::vector<sp<::V1_0::IDrmPlugin>> MakeDrmPlugins(const uint8_t uuid[16],
                                                   const char *appPackageName);