Loading drm/libmediadrm/DrmHal.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -338,7 +338,7 @@ void DrmHal::cleanup() { } } std::vector<sp<IDrmFactory>> DrmHal::makeDrmFactories() { std::vector<sp<IDrmFactory>> DrmHal::makeDrmFactories() { std::vector<sp<IDrmFactory>> factories(DrmUtils::MakeDrmFactories()); static std::vector<sp<IDrmFactory>> factories(DrmUtils::MakeDrmFactories()); if (factories.size() == 0) { if (factories.size() == 0) { // must be in passthrough mode, load the default passthrough service // must be in passthrough mode, load the default passthrough service auto passthrough = IDrmFactory::getService(); auto passthrough = IDrmFactory::getService(); Loading drm/libmediadrm/DrmUtils.cpp +21 −8 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,9 @@ #include <mediadrm/ICrypto.h> #include <mediadrm/ICrypto.h> #include <mediadrm/IDrm.h> #include <mediadrm/IDrm.h> #include <map> #include <string> using HServiceManager = ::android::hidl::manager::V1_2::IServiceManager; using HServiceManager = ::android::hidl::manager::V1_2::IServiceManager; using ::android::hardware::hidl_array; using ::android::hardware::hidl_array; using ::android::hardware::hidl_string; using ::android::hardware::hidl_string; Loading @@ -66,8 +69,8 @@ Hal *MakeObject(status_t *pstatus) { return obj; return obj; } } template <typename Hal, typename V> template <typename Hal, typename V, typename M> void MakeHidlFactories(const uint8_t uuid[16], V &factories) { void MakeHidlFactories(const uint8_t uuid[16], V &factories, M& instances) { sp<HServiceManager> serviceManager = HServiceManager::getService(); sp<HServiceManager> serviceManager = HServiceManager::getService(); if (serviceManager == nullptr) { if (serviceManager == nullptr) { LOG2BE("Failed to get service manager"); LOG2BE("Failed to get service manager"); Loading @@ -78,7 +81,7 @@ void MakeHidlFactories(const uint8_t uuid[16], V &factories) { for (const auto &instance : registered) { for (const auto &instance : registered) { auto factory = Hal::getService(instance); auto factory = Hal::getService(instance); if (factory != nullptr) { if (factory != nullptr) { LOG2BI("found %s %s", Hal::descriptor, instance.c_str()); instances[instance.c_str()] = Hal::descriptor; if (!uuid || factory->isCryptoSchemeSupported(uuid)) { if (!uuid || factory->isCryptoSchemeSupported(uuid)) { factories.push_back(factory); factories.push_back(factory); } } Loading @@ -87,6 +90,12 @@ void MakeHidlFactories(const uint8_t uuid[16], V &factories) { }); }); } } template <typename Hal, typename V> void MakeHidlFactories(const uint8_t uuid[16], V &factories) { std::map<std::string, std::string> instances; MakeHidlFactories<Hal>(uuid, factories, instances); } hidl_vec<uint8_t> toHidlVec(const void *ptr, size_t size) { hidl_vec<uint8_t> toHidlVec(const void *ptr, size_t size) { hidl_vec<uint8_t> vec(size); hidl_vec<uint8_t> vec(size); if (ptr != nullptr) { if (ptr != nullptr) { Loading Loading @@ -147,11 +156,15 @@ sp<ICrypto> MakeCrypto(status_t *pstatus) { std::vector<sp<::V1_0::IDrmFactory>> MakeDrmFactories(const uint8_t uuid[16]) { std::vector<sp<::V1_0::IDrmFactory>> MakeDrmFactories(const uint8_t uuid[16]) { std::vector<sp<::V1_0::IDrmFactory>> drmFactories; std::vector<sp<::V1_0::IDrmFactory>> drmFactories; MakeHidlFactories<::V1_0::IDrmFactory>(uuid, drmFactories); std::map<std::string, std::string> instances; MakeHidlFactories<::V1_1::IDrmFactory>(uuid, drmFactories); MakeHidlFactories<::V1_0::IDrmFactory>(uuid, drmFactories, instances); MakeHidlFactories<::V1_2::IDrmFactory>(uuid, drmFactories); MakeHidlFactories<::V1_1::IDrmFactory>(uuid, drmFactories, instances); MakeHidlFactories<::V1_3::IDrmFactory>(uuid, drmFactories); MakeHidlFactories<::V1_2::IDrmFactory>(uuid, drmFactories, instances); MakeHidlFactories<::V1_4::IDrmFactory>(uuid, drmFactories); MakeHidlFactories<::V1_3::IDrmFactory>(uuid, drmFactories, instances); MakeHidlFactories<::V1_4::IDrmFactory>(uuid, drmFactories, instances); for (auto const& entry : instances) { LOG2BI("found instance=%s version=%s", entry.first.c_str(), entry.second.c_str()); } return drmFactories; return drmFactories; } } Loading Loading
drm/libmediadrm/DrmHal.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -338,7 +338,7 @@ void DrmHal::cleanup() { } } std::vector<sp<IDrmFactory>> DrmHal::makeDrmFactories() { std::vector<sp<IDrmFactory>> DrmHal::makeDrmFactories() { std::vector<sp<IDrmFactory>> factories(DrmUtils::MakeDrmFactories()); static std::vector<sp<IDrmFactory>> factories(DrmUtils::MakeDrmFactories()); if (factories.size() == 0) { if (factories.size() == 0) { // must be in passthrough mode, load the default passthrough service // must be in passthrough mode, load the default passthrough service auto passthrough = IDrmFactory::getService(); auto passthrough = IDrmFactory::getService(); Loading
drm/libmediadrm/DrmUtils.cpp +21 −8 Original line number Original line Diff line number Diff line Loading @@ -43,6 +43,9 @@ #include <mediadrm/ICrypto.h> #include <mediadrm/ICrypto.h> #include <mediadrm/IDrm.h> #include <mediadrm/IDrm.h> #include <map> #include <string> using HServiceManager = ::android::hidl::manager::V1_2::IServiceManager; using HServiceManager = ::android::hidl::manager::V1_2::IServiceManager; using ::android::hardware::hidl_array; using ::android::hardware::hidl_array; using ::android::hardware::hidl_string; using ::android::hardware::hidl_string; Loading @@ -66,8 +69,8 @@ Hal *MakeObject(status_t *pstatus) { return obj; return obj; } } template <typename Hal, typename V> template <typename Hal, typename V, typename M> void MakeHidlFactories(const uint8_t uuid[16], V &factories) { void MakeHidlFactories(const uint8_t uuid[16], V &factories, M& instances) { sp<HServiceManager> serviceManager = HServiceManager::getService(); sp<HServiceManager> serviceManager = HServiceManager::getService(); if (serviceManager == nullptr) { if (serviceManager == nullptr) { LOG2BE("Failed to get service manager"); LOG2BE("Failed to get service manager"); Loading @@ -78,7 +81,7 @@ void MakeHidlFactories(const uint8_t uuid[16], V &factories) { for (const auto &instance : registered) { for (const auto &instance : registered) { auto factory = Hal::getService(instance); auto factory = Hal::getService(instance); if (factory != nullptr) { if (factory != nullptr) { LOG2BI("found %s %s", Hal::descriptor, instance.c_str()); instances[instance.c_str()] = Hal::descriptor; if (!uuid || factory->isCryptoSchemeSupported(uuid)) { if (!uuid || factory->isCryptoSchemeSupported(uuid)) { factories.push_back(factory); factories.push_back(factory); } } Loading @@ -87,6 +90,12 @@ void MakeHidlFactories(const uint8_t uuid[16], V &factories) { }); }); } } template <typename Hal, typename V> void MakeHidlFactories(const uint8_t uuid[16], V &factories) { std::map<std::string, std::string> instances; MakeHidlFactories<Hal>(uuid, factories, instances); } hidl_vec<uint8_t> toHidlVec(const void *ptr, size_t size) { hidl_vec<uint8_t> toHidlVec(const void *ptr, size_t size) { hidl_vec<uint8_t> vec(size); hidl_vec<uint8_t> vec(size); if (ptr != nullptr) { if (ptr != nullptr) { Loading Loading @@ -147,11 +156,15 @@ sp<ICrypto> MakeCrypto(status_t *pstatus) { std::vector<sp<::V1_0::IDrmFactory>> MakeDrmFactories(const uint8_t uuid[16]) { std::vector<sp<::V1_0::IDrmFactory>> MakeDrmFactories(const uint8_t uuid[16]) { std::vector<sp<::V1_0::IDrmFactory>> drmFactories; std::vector<sp<::V1_0::IDrmFactory>> drmFactories; MakeHidlFactories<::V1_0::IDrmFactory>(uuid, drmFactories); std::map<std::string, std::string> instances; MakeHidlFactories<::V1_1::IDrmFactory>(uuid, drmFactories); MakeHidlFactories<::V1_0::IDrmFactory>(uuid, drmFactories, instances); MakeHidlFactories<::V1_2::IDrmFactory>(uuid, drmFactories); MakeHidlFactories<::V1_1::IDrmFactory>(uuid, drmFactories, instances); MakeHidlFactories<::V1_3::IDrmFactory>(uuid, drmFactories); MakeHidlFactories<::V1_2::IDrmFactory>(uuid, drmFactories, instances); MakeHidlFactories<::V1_4::IDrmFactory>(uuid, drmFactories); MakeHidlFactories<::V1_3::IDrmFactory>(uuid, drmFactories, instances); MakeHidlFactories<::V1_4::IDrmFactory>(uuid, drmFactories, instances); for (auto const& entry : instances) { LOG2BI("found instance=%s version=%s", entry.first.c_str(), entry.second.c_str()); } return drmFactories; return drmFactories; } } Loading