From 1d53f9563b924b8b8d17e3c3ad90c26a48c4c315 Mon Sep 17 00:00:00 2001 From: Stan Rokita Date: Thu, 21 Nov 2019 13:23:55 -0800 Subject: [PATCH] Make ScopedWakelock a shared library Change the build configuration of multihal and its tests to make the ScopedWakelock.cpp file and its associated headers available as a library to be included by the fake subhals and the multihal binary seperately. Bug: 144722764 Test: Compiled and loaded onto device without issue Change-Id: Ide83b6761302c5df6c72bc3202727341361b36ed --- sensors/2.0/multihal/Android.bp | 27 ++++++++++++++++++++++++--- sensors/2.0/multihal/tests/Android.bp | 2 ++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/sensors/2.0/multihal/Android.bp b/sensors/2.0/multihal/Android.bp index c13eaf2e92..811c455d2b 100644 --- a/sensors/2.0/multihal/Android.bp +++ b/sensors/2.0/multihal/Android.bp @@ -43,10 +43,10 @@ cc_binary { srcs: [ "service.cpp", "HalProxy.cpp", - "ScopedWakelock.cpp", ], init_rc: ["android.hardware.sensors@2.0-service-multihal.rc"], vintf_fragments: ["android.hardware.sensors@2.0-multihal.xml"], + shared_libs: ["android.hardware.sensors@2.0-ScopedWakelock"] } cc_library_headers { @@ -55,19 +55,40 @@ cc_library_headers { export_include_dirs: ["include"], } +cc_library_shared { + name: "android.hardware.sensors@2.0-ScopedWakelock", + defaults: [ + "hidl_defaults", + "android.hardware.sensors@2.0-multihal-defaults", + ], + srcs: [ + "ScopedWakelock.cpp", + ], + vendor_available: true, + export_header_lib_headers: [ + "android.hardware.sensors@2.0-multihal.header" + ] +} + // The below targets should only be used for testing. cc_test_library { name: "android.hardware.sensors@2.0-HalProxy", - defaults: ["android.hardware.sensors@2.0-multihal-defaults"], + defaults: [ + "hidl_defaults", + "android.hardware.sensors@2.0-multihal-defaults", + ], vendor_available: true, srcs: [ "HalProxy.cpp", - "ScopedWakelock.cpp", ], export_header_lib_headers: [ "android.hardware.sensors@2.0-multihal.header", ], + export_shared_lib_headers: [ + "android.hardware.sensors@2.0-ScopedWakelock", + ], shared_libs: [ "libutils", + "android.hardware.sensors@2.0-ScopedWakelock", ], } diff --git a/sensors/2.0/multihal/tests/Android.bp b/sensors/2.0/multihal/tests/Android.bp index e7f9499db0..1637312274 100644 --- a/sensors/2.0/multihal/tests/Android.bp +++ b/sensors/2.0/multihal/tests/Android.bp @@ -25,6 +25,7 @@ cc_defaults { shared_libs: [ "android.hardware.sensors@1.0", "android.hardware.sensors@2.0", + "android.hardware.sensors@2.0-ScopedWakelock", "libcutils", "libfmq", "libhardware", @@ -83,6 +84,7 @@ cc_test { shared_libs: [ "android.hardware.sensors@1.0", "android.hardware.sensors@2.0", + "android.hardware.sensors@2.0-ScopedWakelock", "libbase", "libcutils", "libfmq",