From 3f669216c6c484c559ea9699e67864fddf8c31dc Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Tue, 5 Dec 2023 14:18:19 +0900 Subject: libinput: use libkernelconfigs insteadof libvintf We'd like to limit the direct usage of libvintf. Bug: 270169217 Test: atest libinput_tests Change-Id: I7630116345e1db736a8173467fc865cea6ec4e96 --- libs/input/KeyLayoutMap.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'libs/input/KeyLayoutMap.cpp') diff --git a/libs/input/KeyLayoutMap.cpp b/libs/input/KeyLayoutMap.cpp index 3c1ae3e41b..ab8c341b15 100644 --- a/libs/input/KeyLayoutMap.cpp +++ b/libs/input/KeyLayoutMap.cpp @@ -27,8 +27,7 @@ #include #include #if defined(__ANDROID__) -#include -#include +#include #endif #include @@ -98,12 +97,10 @@ static const std::unordered_map SENSOR_ bool kernelConfigsArePresent(const std::set& configs) { #if defined(__ANDROID__) - std::shared_ptr runtimeInfo = - android::vintf::VintfObject::GetInstance()->getRuntimeInfo( - vintf::RuntimeInfo::FetchFlag::CONFIG_GZ); - LOG_ALWAYS_FATAL_IF(runtimeInfo == nullptr, "Kernel configs could not be fetched"); + std::map kernelConfigs; + const status_t result = android::kernelconfigs::LoadKernelConfigs(&kernelConfigs); + LOG_ALWAYS_FATAL_IF(result != OK, "Kernel configs could not be fetched"); - const std::map& kernelConfigs = runtimeInfo->kernelConfigs(); for (const std::string& requiredConfig : configs) { const auto configIt = kernelConfigs.find(requiredConfig); if (configIt == kernelConfigs.end()) { -- cgit v1.2.3-59-g8ed1b From a50396ac3902482580eb59e259de1a6203cfc9e4 Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Wed, 17 Jan 2024 18:00:58 +0900 Subject: Skip loading kernel configs unless needed Loading kernel configs is needed when the specified layout has "requires_kernel_config". Otherwise, we don't need to load kernel configs. Bug: 320198280 Test: presubmit Change-Id: I7955d65d804ed4965235a1649c5f5f53996f4d3b --- libs/input/KeyLayoutMap.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libs/input/KeyLayoutMap.cpp') diff --git a/libs/input/KeyLayoutMap.cpp b/libs/input/KeyLayoutMap.cpp index ab8c341b15..508818852e 100644 --- a/libs/input/KeyLayoutMap.cpp +++ b/libs/input/KeyLayoutMap.cpp @@ -97,6 +97,10 @@ static const std::unordered_map SENSOR_ bool kernelConfigsArePresent(const std::set& configs) { #if defined(__ANDROID__) + if (configs.empty()) { + return true; + } + std::map kernelConfigs; const status_t result = android::kernelconfigs::LoadKernelConfigs(&kernelConfigs); LOG_ALWAYS_FATAL_IF(result != OK, "Kernel configs could not be fetched"); -- cgit v1.2.3-59-g8ed1b