Some input build rule fixes
Small fixes in this CL:
* build for host by default
* fix sp::make usage
* add more warnings as errors to match inputflinger
Bug: 271455682
Test: m checkinput
Change-Id: Ib296589b2b2c7c3f5ab178f3b6677be5a6ce1ac1
diff --git a/libs/input/Android.bp b/libs/input/Android.bp
index 6db7b47..769677c 100644
--- a/libs/input/Android.bp
+++ b/libs/input/Android.bp
@@ -118,6 +118,11 @@
"-Wextra",
"-Werror",
"-Wno-unused-parameter",
+ "-Wthread-safety",
+ "-Wshadow",
+ "-Wshadow-field-in-constructor-modified",
+ "-Wshadow-uncaptured-local",
+ "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
],
srcs: [
"android/os/IInputFlinger.aidl",
@@ -160,6 +165,7 @@
"liblog",
"libPlatformProperties",
"libtinyxml2",
+ "libutils",
"libvintf",
],
@@ -196,12 +202,6 @@
target: {
android: {
- export_shared_lib_headers: ["libbinder"],
-
- shared_libs: [
- "libutils",
- ],
-
required: [
"motion_predictor_model_prebuilt",
"motion_predictor_model_config",
@@ -211,7 +211,6 @@
include_dirs: [
"bionic/libc/kernel/android/uapi/",
"bionic/libc/kernel/uapi",
- "frameworks/native/libs/arect/include",
],
},
},
diff --git a/libs/input/InputTransport.cpp b/libs/input/InputTransport.cpp
index 4d3d8bc..0b0309e 100644
--- a/libs/input/InputTransport.cpp
+++ b/libs/input/InputTransport.cpp
@@ -409,7 +409,7 @@
setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize));
setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize));
- sp<IBinder> token = new BBinder();
+ sp<IBinder> token = sp<BBinder>::make();
std::string serverChannelName = name + " (server)";
android::base::unique_fd serverFd(sockets[0]);
diff --git a/services/inputflinger/Android.bp b/services/inputflinger/Android.bp
index f4aab3b..ee03d94 100644
--- a/services/inputflinger/Android.bp
+++ b/services/inputflinger/Android.bp
@@ -28,6 +28,7 @@
cc_defaults {
name: "inputflinger_defaults",
+ host_supported: true,
cpp_std: "c++20",
cflags: [
"-Wall",
@@ -50,6 +51,20 @@
"-*", // Disable all checks not explicitly enabled for now
] + inputflinger_tidy_checks,
tidy_checks_as_errors: inputflinger_tidy_checks,
+ target: {
+ host: {
+ sanitize: {
+ address: true,
+ },
+ include_dirs: [
+ "bionic/libc/kernel/android/uapi/",
+ "bionic/libc/kernel/uapi",
+ ],
+ cflags: [
+ "-D__ANDROID_HOST__",
+ ],
+ },
+ },
}
/////////////////////////////////////////////////
@@ -105,13 +120,6 @@
"libstatspull",
"libstatssocket",
],
- include_dirs: [
- "bionic/libc/kernel/android/uapi/",
- "bionic/libc/kernel/uapi",
- ],
- cflags: [
- "-D__ANDROID_HOST__",
- ],
},
},
}
@@ -212,6 +220,7 @@
// native targets
"libgui_test",
"libinput",
+ "libinputreader_static",
"libinputflinger",
"inputflinger_tests",
"inputflinger_benchmarks",
diff --git a/services/inputflinger/benchmarks/Android.bp b/services/inputflinger/benchmarks/Android.bp
index 4e2a6fb..e200f8b 100644
--- a/services/inputflinger/benchmarks/Android.bp
+++ b/services/inputflinger/benchmarks/Android.bp
@@ -19,6 +19,7 @@
shared_libs: [
"libbase",
"libbinder",
+ "libbinder_ndk",
"libcrypto",
"libcutils",
"libinputflinger_base",
diff --git a/services/inputflinger/tests/Android.bp b/services/inputflinger/tests/Android.bp
index 187bc0a..38640b3 100644
--- a/services/inputflinger/tests/Android.bp
+++ b/services/inputflinger/tests/Android.bp
@@ -78,18 +78,6 @@
"libvintf",
],
},
- host: {
- sanitize: {
- address: true,
- },
- include_dirs: [
- "bionic/libc/kernel/android/uapi/",
- "bionic/libc/kernel/uapi",
- ],
- cflags: [
- "-D__ANDROID_HOST__",
- ],
- },
},
sanitize: {
hwaddress: true,