summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-13 00:06:04 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-13 00:06:04 +0000
commitbdcf06af7d7258de94bf0107328f48ae1b927526 (patch)
treeab32f76c927461950bd65da692cfb5b794fe4830
parent4159586694ceb25208e8d12140c13e69761bd02f (diff)
parent2d9f4e0aef48ee7c65a671e799fe34dc22c9b4a0 (diff)
downloadtrout-android14-qpr2-s3-release.tar.gz
Change-Id: I646cbc824dbc84327c4748500fbba9dee23920e8
-rw-r--r--aosp_trout_arm64.mk8
-rw-r--r--hal/sensors/2.1/Android.bp (renamed from hal/sensors/2.0/Android.bp)11
-rw-r--r--hal/sensors/2.1/MultiPoll.cpp (renamed from hal/sensors/2.0/MultiPoll.cpp)4
-rw-r--r--hal/sensors/2.1/MultiPoll.h (renamed from hal/sensors/2.0/MultiPoll.h)4
-rw-r--r--hal/sensors/2.1/OWNERS (renamed from hal/sensors/2.0/OWNERS)1
-rw-r--r--hal/sensors/2.1/README (renamed from hal/sensors/2.0/README)2
-rw-r--r--hal/sensors/2.1/Sensor.cpp (renamed from hal/sensors/2.0/Sensor.cpp)14
-rw-r--r--hal/sensors/2.1/Sensor.h (renamed from hal/sensors/2.0/Sensor.h)23
-rw-r--r--hal/sensors/2.1/SensorThread.cpp (renamed from hal/sensors/2.0/SensorThread.cpp)4
-rw-r--r--hal/sensors/2.1/SensorThread.h (renamed from hal/sensors/2.0/SensorThread.h)4
-rw-r--r--hal/sensors/2.1/SensorsSubHal.cpp (renamed from hal/sensors/2.0/SensorsSubHal.cpp)32
-rw-r--r--hal/sensors/2.1/SensorsSubHal.h (renamed from hal/sensors/2.0/SensorsSubHal.h)28
-rw-r--r--hal/sensors/2.1/config/Android.bp (renamed from hal/sensors/2.0/config/Android.bp)0
-rw-r--r--hal/sensors/2.1/config/api/current.txt (renamed from hal/sensors/2.0/config/api/current.txt)0
-rw-r--r--hal/sensors/2.1/config/api/last_current.txt (renamed from hal/sensors/2.0/config/api/last_current.txt)0
-rw-r--r--hal/sensors/2.1/config/api/last_removed.txt (renamed from hal/sensors/2.0/config/api/last_removed.txt)0
-rw-r--r--hal/sensors/2.1/config/api/removed.txt (renamed from hal/sensors/2.0/config/api/removed.txt)0
-rw-r--r--hal/sensors/2.1/config/sensor_hal_configuration.xml (renamed from hal/sensors/2.0/config/sensor_hal_configuration.xml)2
-rw-r--r--hal/sensors/2.1/config/sensor_hal_configuration.xsd (renamed from hal/sensors/2.0/config/sensor_hal_configuration.xsd)4
-rw-r--r--hal/sensors/2.1/iio_utils.cpp (renamed from hal/sensors/2.0/iio_utils.cpp)4
-rw-r--r--hal/sensors/2.1/iio_utils.h (renamed from hal/sensors/2.0/iio_utils.h)8
-rw-r--r--hal/sensors/2.1/tests/IioUtilsTest.cpp (renamed from hal/sensors/2.0/tests/IioUtilsTest.cpp)10
-rw-r--r--hal/sensors/2.1/tests/MultiPoll.cpp (renamed from hal/sensors/2.0/tests/MultiPoll.cpp)2
-rw-r--r--product_files/vendor/etc/sensors/hals.conf2
24 files changed, 93 insertions, 74 deletions
diff --git a/aosp_trout_arm64.mk b/aosp_trout_arm64.mk
index 082d32e..9adf7a7 100644
--- a/aosp_trout_arm64.mk
+++ b/aosp_trout_arm64.mk
@@ -60,9 +60,9 @@ PRODUCT_PACKAGES += \
# Sensor HAL
# The implementations use SCMI, which only works on arm architecture
LOCAL_SENSOR_PRODUCT_PACKAGE ?= \
- android.hardware.sensors@2.0-service.multihal \
- android.hardware.sensors@2.0-service.multihal.rc \
- android.hardware.sensors@2.0-Google-IIO-Subhal \
+ android.hardware.sensors-service.multihal \
+ android.hardware.sensors-service.multihal.rc \
+ android.hardware.sensors@2.1-Google-IIO-Subhal \
LOCAL_SENSOR_FILE_OVERRIDES := true
@@ -72,7 +72,7 @@ UEVENTD_ODM_COPY_FILE ?= device/google/trout/product_files/odm/ueventd.rc
PRODUCT_COPY_FILES += \
$(UEVENTD_ODM_COPY_FILE):$(TARGET_COPY_OUT_ODM)/etc/ueventd.rc \
- device/google/trout/hal/sensors/2.0/config/sensor_hal_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/sensor_hal_configuration.xml \
+ device/google/trout/hal/sensors/2.1/config/sensor_hal_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/sensor_hal_configuration.xml \
device/google/trout/product_files/odm/usr/idc/Vendor_0fff_Product_0fff.idc:$(TARGET_COPY_OUT_ODM)/usr/idc/Vendor_0fff_Product_0fff.idc \
device/google/trout/product_files/vendor/etc/sensors/hals.conf:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/hals.conf \
frameworks/native/data/etc/android.hardware.sensor.gyroscope.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.gyroscope.xml \
diff --git a/hal/sensors/2.0/Android.bp b/hal/sensors/2.1/Android.bp
index e33e8ad..1243675 100644
--- a/hal/sensors/2.0/Android.bp
+++ b/hal/sensors/2.1/Android.bp
@@ -18,7 +18,7 @@ package {
}
cc_library {
- name: "android.hardware.sensors@2.0-Google-IIO-Subhal",
+ name: "android.hardware.sensors@2.1-Google-IIO-Subhal",
vendor: true,
srcs: [
"iio_utils.cpp",
@@ -28,11 +28,12 @@ cc_library {
"SensorThread.cpp",
],
header_libs: [
- "android.hardware.sensors@2.0-multihal.header",
+ "android.hardware.sensors@2.1-multihal.header",
],
shared_libs: [
"android.hardware.sensors@1.0",
"android.hardware.sensors@2.0",
+ "android.hardware.sensors@2.1",
"android.hardware.sensors@2.0-ScopedWakelock",
"libcutils",
"libfmq",
@@ -57,7 +58,7 @@ cc_library {
}
cc_test_host {
- name: "android.hardware.sensors@2.0-Google-IIO-Subhal_test",
+ name: "android.hardware.sensors@2.1-Google-IIO-Subhal_test",
srcs: [
"iio_utils.cpp",
"tests/IioUtilsTest.cpp",
@@ -66,6 +67,7 @@ cc_test_host {
"libgtest",
"android.hardware.sensors@1.0",
"android.hardware.sensors@2.0",
+ "android.hardware.sensors@2.1",
],
shared_libs: [
"libbase",
@@ -74,7 +76,7 @@ cc_test_host {
}
cc_test_host {
- name: "android.hardware.sensors@2.0-Google-IIO-Subhal_test-MultiPoll",
+ name: "android.hardware.sensors@2.1-Google-IIO-Subhal_test-MultiPoll",
srcs: [
"MultiPoll.cpp",
"tests/MultiPoll.cpp"
@@ -83,6 +85,7 @@ cc_test_host {
"libgtest",
"android.hardware.sensors@1.0",
"android.hardware.sensors@2.0",
+ "android.hardware.sensors@2.1",
],
shared_libs: [
"libbase",
diff --git a/hal/sensors/2.0/MultiPoll.cpp b/hal/sensors/2.1/MultiPoll.cpp
index 7014c98..65369c2 100644
--- a/hal/sensors/2.0/MultiPoll.cpp
+++ b/hal/sensors/2.1/MultiPoll.cpp
@@ -16,7 +16,7 @@
#include "MultiPoll.h"
-namespace android::hardware::sensors::V2_0::subhal::implementation {
+namespace android::hardware::sensors::V2_1::subhal::implementation {
MultiPoll::MultiPoll(uint64_t periodMs) : mSamplingPeriodMs(periodMs) {}
@@ -46,4 +46,4 @@ int MultiPoll::poll(OnPollIn in) {
return 0;
}
-} // namespace android::hardware::sensors::V2_0::subhal::implementation
+} // namespace android::hardware::sensors::V2_1::subhal::implementation
diff --git a/hal/sensors/2.0/MultiPoll.h b/hal/sensors/2.1/MultiPoll.h
index e6ee889..08994b7 100644
--- a/hal/sensors/2.0/MultiPoll.h
+++ b/hal/sensors/2.1/MultiPoll.h
@@ -21,7 +21,7 @@
#include <mutex>
#include <vector>
-namespace android::hardware::sensors::V2_0::subhal::implementation {
+namespace android::hardware::sensors::V2_1::subhal::implementation {
class MultiPoll {
public:
@@ -39,4 +39,4 @@ class MultiPoll {
std::vector<pollfd> mDescriptors;
};
-} // namespace android::hardware::sensors::V2_0::subhal::implementation
+} // namespace android::hardware::sensors::V2_1::subhal::implementation
diff --git a/hal/sensors/2.0/OWNERS b/hal/sensors/2.1/OWNERS
index 7644fa1..e51139a 100644
--- a/hal/sensors/2.0/OWNERS
+++ b/hal/sensors/2.1/OWNERS
@@ -1,3 +1,2 @@
ankitarora@google.com
egranata@google.com
-
diff --git a/hal/sensors/2.0/README b/hal/sensors/2.1/README
index dc813ff..9a0e6f9 100644
--- a/hal/sensors/2.0/README
+++ b/hal/sensors/2.1/README
@@ -1,5 +1,5 @@
This directory contains a reference implementation for sensors sub-HAL to be
-used by sensors Multi-Hal 2.0 service for Android Automotive OS with Android
+used by sensors Multi-Hal 2.1 service for Android Automotive OS with Android
running as a VM. This HAL accesses sensors exposed as IIO devices by the kernel.
This HAL is currently only supported for use with the IIO SCMI driver in the kernel
diff --git a/hal/sensors/2.0/Sensor.cpp b/hal/sensors/2.1/Sensor.cpp
index d53a11e..bfa1ca0 100644
--- a/hal/sensors/2.0/Sensor.cpp
+++ b/hal/sensors/2.1/Sensor.cpp
@@ -24,7 +24,7 @@
namespace android {
namespace hardware {
namespace sensors {
-namespace V2_0 {
+namespace V2_1 {
namespace subhal {
namespace implementation {
@@ -114,7 +114,9 @@ void HWSensorBase::sendAdditionalInfoReport() {
});
}
- if (!events.empty()) mCallback->postEvents(events, isWakeUpSensor());
+ if (!events.empty()) {
+ mCallback->postEvents(events, mCallback->createScopedWakelock(isWakeUpSensor()));
+ }
}
void HWSensorBase::activate(bool enable) {
@@ -141,7 +143,7 @@ Result SensorBase::flush() {
ev.sensorType = SensorType::META_DATA;
ev.u.meta.what = MetaDataEventType::META_DATA_FLUSH_COMPLETE;
std::vector<Event> evs{ev};
- mCallback->postEvents(evs, isWakeUpSensor());
+ mCallback->postEvents(evs, mCallback->createScopedWakelock(isWakeUpSensor()));
return Result::OK;
}
@@ -198,7 +200,7 @@ void HWSensorBase::pollForEvents() {
Event evt;
processScanData(&mSensorRawData[0], &evt);
- mCallback->postEvents({evt}, isWakeUpSensor());
+ mCallback->postEvents({evt}, mCallback->createScopedWakelock(isWakeUpSensor()));
}
}
@@ -240,7 +242,7 @@ Result SensorBase::injectEvent(const Event& event) {
} else if (!supportsDataInjection()) {
result = Result::INVALID_OPERATION;
} else if (mMode == OperationMode::DATA_INJECTION) {
- mCallback->postEvents(std::vector<Event>{event}, isWakeUpSensor());
+ mCallback->postEvents({event}, mCallback->createScopedWakelock(isWakeUpSensor()));
} else {
result = Result::BAD_VALUE;
}
@@ -488,7 +490,7 @@ HWSensorBase::HWSensorBase(int32_t sensorHandle, ISensorsEventCallback* callback
} // namespace implementation
} // namespace subhal
-} // namespace V2_0
+} // namespace V2_1
} // namespace sensors
} // namespace hardware
} // namespace android
diff --git a/hal/sensors/2.0/Sensor.h b/hal/sensors/2.1/Sensor.h
index 235a286..e45cdd9 100644
--- a/hal/sensors/2.0/Sensor.h
+++ b/hal/sensors/2.1/Sensor.h
@@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_SENSORS_V2_0_SENSOR_H
-#define ANDROID_HARDWARE_SENSORS_V2_0_SENSOR_H
+#ifndef ANDROID_HARDWARE_SENSORS_V2_1_SENSOR_H
+#define ANDROID_HARDWARE_SENSORS_V2_1_SENSOR_H
-#include <android/hardware/sensors/1.0/types.h>
+#include <android/hardware/sensors/2.1/types.h>
#include <poll.h>
#include <condition_variable>
#include <memory>
@@ -25,6 +25,7 @@
#include <vector>
#include "SensorThread.h"
+#include "V2_0/ScopedWakelock.h"
#include "iio_utils.h"
#include "sensor_hal_configuration_V1_0.h"
@@ -33,17 +34,18 @@
#define NUM_OF_DATA_CHANNELS NUM_OF_CHANNEL_SUPPORTED - 1
using ::android::hardware::sensors::V1_0::AdditionalInfo;
-using ::android::hardware::sensors::V1_0::Event;
using ::android::hardware::sensors::V1_0::OperationMode;
using ::android::hardware::sensors::V1_0::Result;
-using ::android::hardware::sensors::V1_0::SensorInfo;
-using ::android::hardware::sensors::V1_0::SensorType;
+using ::android::hardware::sensors::V2_0::implementation::ScopedWakelock;
+using ::android::hardware::sensors::V2_1::Event;
+using ::android::hardware::sensors::V2_1::SensorInfo;
+using ::android::hardware::sensors::V2_1::SensorType;
using ::sensor::hal::configuration::V1_0::Configuration;
namespace android {
namespace hardware {
namespace sensors {
-namespace V2_0 {
+namespace V2_1 {
namespace subhal {
namespace implementation {
@@ -63,7 +65,8 @@ constexpr auto SENSOR_VOLTAGE_DEFAULT = 3.6f;
class ISensorsEventCallback {
public:
virtual ~ISensorsEventCallback() = default;
- virtual void postEvents(const std::vector<Event>& events, bool wakeup) = 0;
+ virtual void postEvents(const std::vector<Event>& events, ScopedWakelock wakelock) = 0;
+ virtual ScopedWakelock createScopedWakelock(bool lock) = 0;
};
// Virtual Base Class for Sensor
@@ -147,8 +150,8 @@ class HWSensorBase : public SensorBase {
};
} // namespace implementation
} // namespace subhal
-} // namespace V2_0
+} // namespace V2_1
} // namespace sensors
} // namespace hardware
} // namespace android
-#endif // ANDROID_HARDWARE_SENSORS_V2_0_SENSOR_H
+#endif // ANDROID_HARDWARE_SENSORS_V2_1_SENSOR_H
diff --git a/hal/sensors/2.0/SensorThread.cpp b/hal/sensors/2.1/SensorThread.cpp
index 844c7db..6517769 100644
--- a/hal/sensors/2.0/SensorThread.cpp
+++ b/hal/sensors/2.1/SensorThread.cpp
@@ -17,7 +17,7 @@
#include "SensorThread.h"
#include "Sensor.h"
-namespace android::hardware::sensors::V2_0::subhal::implementation {
+namespace android::hardware::sensors::V2_1::subhal::implementation {
SensorThread::SensorThread(SensorBase* sensor)
: mSensor(sensor), mStopThread(false), mWaitCV(), mRunMutex() {}
@@ -61,4 +61,4 @@ std::unique_lock<std::mutex> SensorThread::lock() {
return std::move(std::unique_lock<std::mutex>(mRunMutex));
}
-} // namespace android::hardware::sensors::V2_0::subhal::implementation
+} // namespace android::hardware::sensors::V2_1::subhal::implementation
diff --git a/hal/sensors/2.0/SensorThread.h b/hal/sensors/2.1/SensorThread.h
index 058f148..e0cf3ce 100644
--- a/hal/sensors/2.0/SensorThread.h
+++ b/hal/sensors/2.1/SensorThread.h
@@ -21,7 +21,7 @@
#include <mutex>
#include <thread>
-namespace android::hardware::sensors::V2_0::subhal::implementation {
+namespace android::hardware::sensors::V2_1::subhal::implementation {
class SensorBase;
@@ -52,4 +52,4 @@ class SensorThread {
std::thread mThread;
};
-} // namespace android::hardware::sensors::V2_0::subhal::implementation
+} // namespace android::hardware::sensors::V2_1::subhal::implementation
diff --git a/hal/sensors/2.0/SensorsSubHal.cpp b/hal/sensors/2.1/SensorsSubHal.cpp
index 4a615af..6c61bc5 100644
--- a/hal/sensors/2.0/SensorsSubHal.cpp
+++ b/hal/sensors/2.1/SensorsSubHal.cpp
@@ -16,29 +16,31 @@
#define LOG_TAG "GoogleIIOSensorSubHal"
#include "SensorsSubHal.h"
-#include <android/hardware/sensors/2.0/types.h>
+#include <android/hardware/sensors/2.1/types.h>
#include <log/log.h>
-ISensorsSubHal* sensorsHalGetSubHal(uint32_t* version) {
- static ::android::hardware::sensors::V2_0::subhal::implementation::SensorsSubHal subHal;
- *version = SUB_HAL_2_0_VERSION;
+using ::android::hardware::sensors::V2_1::implementation::ISensorsSubHal;
+
+ISensorsSubHal* sensorsHalGetSubHal_2_1(uint32_t* version) {
+ static ::android::hardware::sensors::V2_1::subhal::implementation::SensorsSubHal subHal;
+ *version = SUB_HAL_2_1_VERSION;
return &subHal;
}
namespace android {
namespace hardware {
namespace sensors {
-namespace V2_0 {
+namespace V2_1 {
namespace subhal {
namespace implementation {
using ::android::hardware::Void;
-using ::android::hardware::sensors::V1_0::Event;
using ::android::hardware::sensors::V1_0::RateLevel;
using ::android::hardware::sensors::V1_0::SharedMemInfo;
using ::android::hardware::sensors::V2_0::SensorTimeout;
using ::android::hardware::sensors::V2_0::WakeLockQueueFlagBits;
using ::android::hardware::sensors::V2_0::implementation::ScopedWakelock;
+using ::android::hardware::sensors::V2_1::Event;
using ::sensor::hal::configuration::V1_0::Sensor;
using ::sensor::hal::configuration::V1_0::SensorHalConfiguration;
@@ -47,7 +49,7 @@ static const char* gSensorConfigLocationList[] = {"/odm/etc/sensors/", "/vendor/
static const int gSensorConfigLocationListSize =
(sizeof(gSensorConfigLocationList) / sizeof(gSensorConfigLocationList[0]));
-#define MODULE_NAME "android.hardware.sensors@2.0-Google-IIO-Subhal"
+#define MODULE_NAME "android.hardware.sensors@2.1-Google-IIO-Subhal"
static std::optional<std::vector<Sensor>> readSensorsConfigFromXml() {
for (int i = 0; i < gSensorConfigLocationListSize; i++) {
@@ -134,8 +136,8 @@ SensorsSubHal::SensorsSubHal() : mCallback(nullptr), mNextHandle(1) {
}
}
-// Methods from ::android::hardware::sensors::V2_0::ISensors follow.
-Return<void> SensorsSubHal::getSensorsList(getSensorsList_cb _hidl_cb) {
+// Methods from ::android::hardware::sensors::V2_1::ISensors follow.
+Return<void> SensorsSubHal::getSensorsList_2_1(getSensorsList_2_1_cb _hidl_cb) {
std::vector<SensorInfo> sensors;
for (const auto& sensor : mSensors) {
SensorInfo sensorInfo = sensor.second->getSensorInfo();
@@ -183,7 +185,7 @@ Return<Result> SensorsSubHal::flush(int32_t sensorHandle) {
return Result::BAD_VALUE;
}
-Return<Result> SensorsSubHal::injectSensorData(const Event& /* event */) {
+Return<Result> SensorsSubHal::injectSensorData_2_1(const Event& /* event */) {
return Result::INVALID_OPERATION;
}
@@ -244,10 +246,14 @@ Return<Result> SensorsSubHal::initialize(const sp<IHalProxyCallback>& halProxyCa
return Result::OK;
}
-void SensorsSubHal::postEvents(const std::vector<Event>& events, bool wakeup) {
- ScopedWakelock wakelock = mCallback->createScopedWakelock(wakeup);
+void SensorsSubHal::postEvents(const std::vector<Event>& events, ScopedWakelock wakelock) {
mCallback->postEvents(events, std::move(wakelock));
}
+
+ScopedWakelock SensorsSubHal::createScopedWakelock(bool lock) {
+ return mCallback->createScopedWakelock(lock);
+}
+
void SensorsSubHal::AddSensor(const struct iio_device_data& iio_data,
const std::optional<std::vector<Configuration>>& config) {
HWSensorBase* sensor = HWSensorBase::buildSensor(mNextHandle++ /* sensorHandle */,
@@ -260,7 +266,7 @@ void SensorsSubHal::AddSensor(const struct iio_device_data& iio_data,
} // namespace implementation
} // namespace subhal
-} // namespace V2_0
+} // namespace V2_1
} // namespace sensors
} // namespace hardware
} // namespace android
diff --git a/hal/sensors/2.0/SensorsSubHal.h b/hal/sensors/2.1/SensorsSubHal.h
index 26a5aad..0d5d82a 100644
--- a/hal/sensors/2.0/SensorsSubHal.h
+++ b/hal/sensors/2.1/SensorsSubHal.h
@@ -13,26 +13,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef ANDROID_HARDWARE_SENSORS_V2_0_SENSORS_SUBHAL_H
-#define ANDROID_HARDWARE_SENSORS_V2_0_SENSORS_SUBHAL_H
+#ifndef ANDROID_HARDWARE_SENSORS_V2_1_SENSORS_SUBHAL_H
+#define ANDROID_HARDWARE_SENSORS_V2_1_SENSORS_SUBHAL_H
#include <vector>
#include "Sensor.h"
#include "SubHal.h"
-using ::android::hardware::sensors::V1_0::SensorType;
+using ::android::hardware::sensors::V2_1::SensorType;
namespace android {
namespace hardware {
namespace sensors {
-namespace V2_0 {
+namespace V2_1 {
namespace subhal {
namespace implementation {
using ::android::hardware::sensors::V1_0::OperationMode;
using ::android::hardware::sensors::V1_0::Result;
-using ::android::hardware::sensors::V2_0::implementation::IHalProxyCallback;
-using ::android::hardware::sensors::V2_0::subhal::implementation::ISensorsEventCallback;
+using ::android::hardware::sensors::V2_1::implementation::IHalProxyCallback;
+using ::android::hardware::sensors::V2_1::implementation::ISensorsSubHal;
+using ::android::hardware::sensors::V2_1::subhal::implementation::ISensorsEventCallback;
using ::sensor::hal::configuration::V1_0::Configuration;
/**
@@ -40,15 +41,16 @@ using ::sensor::hal::configuration::V1_0::Configuration;
* multihal 2.0. See the README file for more details.
*/
class SensorsSubHal : public ISensorsSubHal, public ISensorsEventCallback {
- using Event = ::android::hardware::sensors::V1_0::Event;
+ using Event = ::android::hardware::sensors::V2_1::Event;
using RateLevel = ::android::hardware::sensors::V1_0::RateLevel;
using SharedMemInfo = ::android::hardware::sensors::V1_0::SharedMemInfo;
+ using ScopedWakelock = ::android::hardware::sensors::V2_0::implementation::ScopedWakelock;
public:
SensorsSubHal();
- // Methods from ::android::hardware::sensors::V2_0::ISensors follow.
- Return<void> getSensorsList(getSensorsList_cb _hidl_cb) override;
+ // Methods from ::android::hardware::sensors::V2_1::ISensors follow.
+ Return<void> getSensorsList_2_1(getSensorsList_2_1_cb _hidl_cb) override;
Return<Result> setOperationMode(OperationMode mode) override;
@@ -61,7 +63,7 @@ class SensorsSubHal : public ISensorsSubHal, public ISensorsEventCallback {
Return<Result> flush(int32_t sensorHandle) override;
- Return<Result> injectSensorData(const Event& event) override;
+ Return<Result> injectSensorData_2_1(const Event& event) override;
Return<void> registerDirectChannel(const SharedMemInfo& mem,
registerDirectChannel_cb _hidl_cb) override;
@@ -79,7 +81,9 @@ class SensorsSubHal : public ISensorsSubHal, public ISensorsEventCallback {
Return<Result> initialize(const sp<IHalProxyCallback>& halProxyCallback) override;
// Method from ISensorsEventCallback.
- void postEvents(const std::vector<Event>& events, bool wakeup) override;
+ void postEvents(const std::vector<Event>& events, ScopedWakelock wakelock) override;
+
+ ScopedWakelock createScopedWakelock(bool lock) override;
protected:
void AddSensor(const struct iio_device_data& iio_data,
@@ -112,7 +116,7 @@ class SensorsSubHal : public ISensorsSubHal, public ISensorsEventCallback {
} // namespace implementation
} // namespace subhal
-} // namespace V2_0
+} // namespace V2_1
} // namespace sensors
} // namespace hardware
} // namespace android
diff --git a/hal/sensors/2.0/config/Android.bp b/hal/sensors/2.1/config/Android.bp
index e2cfe70..e2cfe70 100644
--- a/hal/sensors/2.0/config/Android.bp
+++ b/hal/sensors/2.1/config/Android.bp
diff --git a/hal/sensors/2.0/config/api/current.txt b/hal/sensors/2.1/config/api/current.txt
index ef088c9..ef088c9 100644
--- a/hal/sensors/2.0/config/api/current.txt
+++ b/hal/sensors/2.1/config/api/current.txt
diff --git a/hal/sensors/2.0/config/api/last_current.txt b/hal/sensors/2.1/config/api/last_current.txt
index e69de29..e69de29 100644
--- a/hal/sensors/2.0/config/api/last_current.txt
+++ b/hal/sensors/2.1/config/api/last_current.txt
diff --git a/hal/sensors/2.0/config/api/last_removed.txt b/hal/sensors/2.1/config/api/last_removed.txt
index e69de29..e69de29 100644
--- a/hal/sensors/2.0/config/api/last_removed.txt
+++ b/hal/sensors/2.1/config/api/last_removed.txt
diff --git a/hal/sensors/2.0/config/api/removed.txt b/hal/sensors/2.1/config/api/removed.txt
index d802177..d802177 100644
--- a/hal/sensors/2.0/config/api/removed.txt
+++ b/hal/sensors/2.1/config/api/removed.txt
diff --git a/hal/sensors/2.0/config/sensor_hal_configuration.xml b/hal/sensors/2.1/config/sensor_hal_configuration.xml
index cdf8732..8985fe1 100644
--- a/hal/sensors/2.0/config/sensor_hal_configuration.xml
+++ b/hal/sensors/2.1/config/sensor_hal_configuration.xml
@@ -16,7 +16,7 @@
<sensorHalConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
<modules>
- <module halName="android.hardware.sensors@2.0-Google-IIO-Subhal" halVersion="2.0">
+ <module halName="android.hardware.sensors@2.1-Google-IIO-Subhal" halVersion="2.1">
<sensors>
<sensor name="scmi.iio.accel" type="1">
<configuration>
diff --git a/hal/sensors/2.0/config/sensor_hal_configuration.xsd b/hal/sensors/2.1/config/sensor_hal_configuration.xsd
index 78a42e6..a55eaf0 100644
--- a/hal/sensors/2.0/config/sensor_hal_configuration.xsd
+++ b/hal/sensors/2.1/config/sensor_hal_configuration.xsd
@@ -40,7 +40,9 @@
</xs:sequence>
</xs:complexType>
<!-- attribute type describes the sensor type. Possible values are the Enum
- values of SensorType specified in hardware/interfaces/sensors/1.0/types.hal
+ values of SensorType specified in hardware/interfaces/sensors/2.1/types.hal
+ (which inherits most of its values from SensorType in
+ hardware/interfaces/sensors/1.0/types.hal)
-->
<xs:complexType name="sensor">
<xs:sequence>
diff --git a/hal/sensors/2.0/iio_utils.cpp b/hal/sensors/2.1/iio_utils.cpp
index 84360b2..2b5abe9 100644
--- a/hal/sensors/2.0/iio_utils.cpp
+++ b/hal/sensors/2.1/iio_utils.cpp
@@ -40,7 +40,7 @@ static const char* IIO_RANGE_AVAIL_FILENAME = "raw_available";
namespace android {
namespace hardware {
namespace sensors {
-namespace V2_0 {
+namespace V2_1 {
namespace subhal {
namespace implementation {
@@ -413,7 +413,7 @@ int scan_elements(const std::string& device_dir, struct iio_device_data* iio_dat
}
} // namespace implementation
} // namespace subhal
-} // namespace V2_0
+} // namespace V2_1
} // namespace sensors
} // namespace hardware
} // namespace android
diff --git a/hal/sensors/2.0/iio_utils.h b/hal/sensors/2.1/iio_utils.h
index a84d369..9415e83 100644
--- a/hal/sensors/2.0/iio_utils.h
+++ b/hal/sensors/2.1/iio_utils.h
@@ -16,7 +16,7 @@
#ifndef ANDROID_SENSORS_IIO_UTILS_H
#define ANDROID_SENSORS_IIO_UTILS_H
-#include <android/hardware/sensors/1.0/types.h>
+#include <android/hardware/sensors/2.1/types.h>
#include <dirent.h>
#include <linux/ioctl.h>
#include <linux/types.h>
@@ -27,11 +27,11 @@
namespace android {
namespace hardware {
namespace sensors {
-namespace V2_0 {
+namespace V2_1 {
namespace subhal {
namespace implementation {
-using ::android::hardware::sensors::V1_0::SensorType;
+using ::android::hardware::sensors::V2_1::SensorType;
extern const char* DEFAULT_IIO_DIR;
@@ -75,7 +75,7 @@ int enable_sensor(const std::string& name, const bool flag);
int set_sampling_frequency(const std::string& name, const double frequency);
} // namespace implementation
} // namespace subhal
-} // namespace V2_0
+} // namespace V2_1
} // namespace sensors
} // namespace hardware
} // namespace android
diff --git a/hal/sensors/2.0/tests/IioUtilsTest.cpp b/hal/sensors/2.1/tests/IioUtilsTest.cpp
index 034a6b8..e953b37 100644
--- a/hal/sensors/2.0/tests/IioUtilsTest.cpp
+++ b/hal/sensors/2.1/tests/IioUtilsTest.cpp
@@ -15,7 +15,7 @@
*/
#include <android-base/file.h>
-#include <android/hardware/sensors/2.0/types.h>
+#include <android/hardware/sensors/2.1/types.h>
#include <gtest/gtest.h>
#include <sys/stat.h>
#include <fstream>
@@ -25,10 +25,10 @@
#include "iio_utils.h"
-using ::android::hardware::sensors::V1_0::SensorType;
-using android::hardware::sensors::V2_0::subhal::implementation::iio_device_data;
-using android::hardware::sensors::V2_0::subhal::implementation::load_iio_devices;
-using android::hardware::sensors::V2_0::subhal::implementation::sensors_supported_hal;
+using ::android::hardware::sensors::V2_1::SensorType;
+using android::hardware::sensors::V2_1::subhal::implementation::iio_device_data;
+using android::hardware::sensors::V2_1::subhal::implementation::load_iio_devices;
+using android::hardware::sensors::V2_1::subhal::implementation::sensors_supported_hal;
static bool sensorFilter(iio_device_data* dev) {
static std::map<std::string, SensorType> KNOWN_SENSORS = {
diff --git a/hal/sensors/2.0/tests/MultiPoll.cpp b/hal/sensors/2.1/tests/MultiPoll.cpp
index 5adef7e..86f5f6e 100644
--- a/hal/sensors/2.0/tests/MultiPoll.cpp
+++ b/hal/sensors/2.1/tests/MultiPoll.cpp
@@ -21,7 +21,7 @@
#include "MultiPoll.h"
-using android::hardware::sensors::V2_0::subhal::implementation::MultiPoll;
+using android::hardware::sensors::V2_1::subhal::implementation::MultiPoll;
// using namespace here is the sanctioned C++ way
// NOLINTNEXTLINE(build/namespaces)
diff --git a/product_files/vendor/etc/sensors/hals.conf b/product_files/vendor/etc/sensors/hals.conf
index e7c145b..98c3447 100644
--- a/product_files/vendor/etc/sensors/hals.conf
+++ b/product_files/vendor/etc/sensors/hals.conf
@@ -1 +1 @@
-/vendor/lib64/android.hardware.sensors@2.0-Google-IIO-Subhal.so
+/vendor/lib64/android.hardware.sensors@2.1-Google-IIO-Subhal.so