Allow libhwbinder to be combined into libhidlbase.
am: 09a8725d56
Change-Id: Ia50e4991902950dfa8841d2b5618dccac517014d
diff --git a/Android.bp b/Android.bp
index f372618..a5901e0 100644
--- a/Android.bp
+++ b/Android.bp
@@ -18,27 +18,10 @@
cc_defaults {
name: "libhwbinder_defaults",
- shared_libs: [
- "libbase",
- "liblog",
- "libcutils",
- "libutils",
- "libbinderthreadstate",
- ],
- export_shared_lib_headers: [
- "libbase",
- "libutils",
- ],
+
export_include_dirs: ["include"],
include_dirs: ["frameworks/native/include"],
- recovery_available: true,
- vendor_available: true,
- vndk: {
- enabled: true,
- support_system_process: true,
- },
- clang: true,
sanitize: {
misc_undefined: ["integer"],
},
@@ -67,22 +50,87 @@
],
}
+cc_defaults {
+ name: "libhwbinder-impl-shared-libs",
+ defaults: ["libhwbinder-impl-shared-libs-no-vndk-private"],
+ shared_libs: [
+ "libbinderthreadstate",
+ ],
+}
+
+cc_defaults {
+ name: "libhwbinder-impl-shared-libs-no-vndk-private",
+ shared_libs: [
+ "libbase",
+ "liblog",
+ "libcutils",
+ "libutils",
+ ],
+ export_shared_lib_headers: [
+ "libbase",
+ "libutils",
+ ],
+}
+
+// WARNING: this should no longer be used
cc_library {
name: "libhwbinder",
+ recovery_available: true,
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
+
+ export_include_dirs: ["include"],
+}
+
+// Combined into libhidlbase for efficiency.
+// Used as shared library to provide headers for libhidltransport-impl-internal.
+cc_library_static {
+ name: "libhwbinder-impl-internal",
+ // TODO(b/135299443): allow this library to link against vndk-private libs
+ // and instead rely on the fact that users of this static library must be
+ // vndk (since they must use libbinderthreadstate).
+ include_dirs: ["frameworks/native/libs/binderthreadstate/include/"],
defaults: [
"libhwbinder_defaults",
+ "libhwbinder-impl-shared-libs-no-vndk-private",
"hwbinder_pgo",
"hwbinder_lto",
],
+ recovery_available: true,
+ vendor_available: true,
}
// Explicitly provide a no lto, no PGO variant, to workaround the issue that we
// can't detect non-lto users of the module in Android.mk.
-// http://b/77320844
+// TODO(b/135558503): remove
cc_library {
name: "libhwbinder_noltopgo",
defaults: [
"libhwbinder_defaults",
+ "libhwbinder-impl-shared-libs",
+ ],
+ recovery_available: true,
+ vendor_available: true,
+ vndk: {
+ enabled: true,
+ support_system_process: true,
+ },
+}
+
+// Only libhwbinder_benchmark needs to have pgo enabled. When all places
+// support having PGO selectively enabled, all places can use libhwbinder.
+//
+// http://b/77320844
+cc_library_static {
+ name: "libhwbinder_pgo-impl-internal",
+ defaults: [
+ "libhwbinder_defaults",
+ "libhwbinder-impl-shared-libs",
+ "hwbinder_benchmark_pgo",
+ "hwbinder_lto",
],
}
@@ -97,6 +145,16 @@
},
}
+cc_defaults {
+ name: "hwbinder_benchmark_pgo",
+ pgo: {
+ instrumentation: true,
+ profile_file: "hwbinder/hwbinder.profdata",
+ benchmarks: ["hwbinder_benchmark"],
+ enable_profile_use: true,
+ },
+}
+
// Provide lto property to build hwbinder with LTO
cc_defaults {
name: "hwbinder_lto",
diff --git a/vts/performance/Android.bp b/vts/performance/Android.bp
index b5097df..38edce5 100644
--- a/vts/performance/Android.bp
+++ b/vts/performance/Android.bp
@@ -22,9 +22,7 @@
"-Werror",
],
shared_libs: [
- "libhidlbase",
- "libhidltransport",
- "libhwbinder",
+ "libhidlbase_pgo",
"liblog",
"libutils",
"libcutils",