Add a sub-HAL implementation for testing multi-HAL
Creates a fake sub-HAL using the default implementation for sensors HAL
2.0 with some small modifications to support the multi-HAL interface.
This sub-HAL can be configured to support two different sets of sensors
making it easier to build and load two different sub-HAL implementations
onto device and verify the multihal implementation works.
Bug: 136511617
Test: compile only. Once multihal can load in sub-HALs, then this can be
accurately tested.
Change-Id: I9b136506bdbc8a3b196fd363748bddfcdd564daf
diff --git a/sensors/2.0/multihal/testing/Android.bp b/sensors/2.0/multihal/testing/Android.bp
new file mode 100644
index 0000000..3dedbd6
--- /dev/null
+++ b/sensors/2.0/multihal/testing/Android.bp
@@ -0,0 +1,55 @@
+//
+// Copyright (C) 2019 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+cc_defaults {
+ name: "android.hardware.sensors@2.0-fakesubhal-defaults",
+ vendor: true,
+ srcs: [
+ "Sensor.cpp",
+ "SensorsSubHal.cpp",
+ ],
+ header_libs: [
+ "android.hardware.sensors@2.0-subhal.header",
+ ],
+ shared_libs: [
+ "android.hardware.sensors@1.0",
+ "android.hardware.sensors@2.0",
+ "libcutils",
+ "libfmq",
+ "libhidlbase",
+ "libhidltransport",
+ "liblog",
+ "libpower",
+ "libutils",
+ ],
+}
+
+cc_library {
+ name: "android.hardware.sensors@2.0-fakesubhal-config1",
+ defaults: ["android.hardware.sensors@2.0-fakesubhal-defaults"],
+ cflags: [
+ "-DSUPPORT_CONTINUOUS_SENSORS",
+ "-DSUB_HAL_NAME=\"FakeSubHal-Continuous\"",
+ ],
+}
+
+cc_library {
+ name: "android.hardware.sensors@2.0-fakesubhal-config2",
+ defaults: ["android.hardware.sensors@2.0-fakesubhal-defaults"],
+ cflags: [
+ "-DSUPPORT_ON_CHANGE_SENSORS",
+ "-DSUB_HAL_NAME=\"FakeSubHal-OnChange\"",
+ ],
+}
\ No newline at end of file