Skip to content

Commit 336a87e

Browse files
author
Jooyung Han
committed
libinput: use libkernelconfigs insteadof libvintf
We'd like to limit the direct usage of libvintf. Bug: 270169217 Test: atest libinput_tests Merged-In: I7630116345e1db736a8173467fc865cea6ec4e96 Change-Id: I7630116345e1db736a8173467fc865cea6ec4e96 (cherry picked from commit 29db97cfa1e3347dc94db36fbba76384eed7f9aa)
1 parent 72d92ef commit 336a87e

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

libs/input/Android.bp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ cc_library {
221221
"liblog",
222222
"libPlatformProperties",
223223
"libtinyxml2",
224-
"libvintf",
224+
"libz", // needed by libkernelconfigs
225225
],
226226

227227
ldflags: [
@@ -238,6 +238,7 @@ cc_library {
238238
"inputconstants-cpp",
239239
"libui-types",
240240
"libtflite_static",
241+
"libkernelconfigs",
241242
],
242243

243244
whole_static_libs: [

libs/input/KeyLayoutMap.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
#include <utils/Timers.h>
2828
#include <utils/Tokenizer.h>
2929
#if defined(__ANDROID__)
30-
#include <vintf/RuntimeInfo.h>
31-
#include <vintf/VintfObject.h>
30+
#include <vintf/KernelConfigs.h>
3231
#endif
3332

3433
#include <cstdlib>
@@ -98,12 +97,10 @@ static const std::unordered_map<std::string_view, InputDeviceSensorType> SENSOR_
9897

9998
bool kernelConfigsArePresent(const std::set<std::string>& configs) {
10099
#if defined(__ANDROID__)
101-
std::shared_ptr<const android::vintf::RuntimeInfo> runtimeInfo =
102-
android::vintf::VintfObject::GetInstance()->getRuntimeInfo(
103-
vintf::RuntimeInfo::FetchFlag::CONFIG_GZ);
104-
LOG_ALWAYS_FATAL_IF(runtimeInfo == nullptr, "Kernel configs could not be fetched");
100+
std::map<std::string, std::string> kernelConfigs;
101+
const status_t result = android::kernelconfigs::LoadKernelConfigs(&kernelConfigs);
102+
LOG_ALWAYS_FATAL_IF(result != OK, "Kernel configs could not be fetched");
105103

106-
const std::map<std::string, std::string>& kernelConfigs = runtimeInfo->kernelConfigs();
107104
for (const std::string& requiredConfig : configs) {
108105
const auto configIt = kernelConfigs.find(requiredConfig);
109106
if (configIt == kernelConfigs.end()) {

libs/input/tests/Android.bp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ cc_test {
3636
"libgmock",
3737
"libgui_window_info_static",
3838
"libinput",
39+
"libkernelconfigs",
3940
"libtflite_static",
4041
"libui-types",
42+
"libz", // needed by libkernelconfigs
4143
],
4244
cflags: [
4345
"-Wall",
@@ -61,7 +63,6 @@ cc_test {
6163
"libPlatformProperties",
6264
"libtinyxml2",
6365
"libutils",
64-
"libvintf",
6566
],
6667
data: [
6768
"data/*",

0 commit comments

Comments
 (0)