diff options
author | Xin Li <delphij@google.com> | 2024-03-06 09:29:51 -0800 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2024-03-06 09:29:51 -0800 |
commit | cb6e7452abf543a9f163c5e44ce1e5a403d9957a (patch) | |
tree | e895f5566687e4814976802ca327835082ecd2d3 | |
parent | 618d4bd06268a651a71d73a09382e8722162aa32 (diff) | |
parent | d80b6850c387e0ce4885c505f72325e00debe1ea (diff) | |
download | trout-cb6e7452abf543a9f163c5e44ce1e5a403d9957a.tar.gz |
Merge Android 14 QPR2 to AOSP main
Bug: 319669529
Merged-In: Ib3b0158c3e845c40619ffe4473051c4a0ed8aaf8
Change-Id: Ib152efce034548e90de1d82180a5d502d95095bf
-rw-r--r-- | OWNERS | 1 | ||||
-rw-r--r-- | agl_services_build/repo_manifest.xml | 2 | ||||
-rw-r--r-- | agl_services_build/yocto-layer/meta-google/recipes-trout/agl-services/sources.inc | 2 | ||||
-rw-r--r-- | aosp_trout_arm64.mk | 17 | ||||
-rw-r--r-- | aosp_trout_common.mk | 11 | ||||
-rw-r--r-- | hal/audiocontrol/aidl/1.0/audiocontrol-trout.rc | 2 | ||||
-rw-r--r-- | hal/dumpstate/1.1/Android.bp | 99 | ||||
-rw-r--r-- | hal/dumpstate/1.1/DumpstateDevice.cpp | 298 | ||||
-rw-r--r-- | hal/dumpstate/1.1/DumpstateDevice.h (renamed from hal/dumpstate/aidl/1.0/DumpstateDevice.h) | 30 | ||||
-rw-r--r-- | hal/dumpstate/1.1/DumpstateGrpcServer.cpp (renamed from hal/dumpstate/aidl/1.0/DumpstateGrpcServer.cpp) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/DumpstateGrpcServer.h (renamed from hal/dumpstate/aidl/1.0/DumpstateGrpcServer.h) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/DumpstateServer.cpp (renamed from hal/dumpstate/aidl/1.0/DumpstateServer.cpp) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/DumpstateServer.h (renamed from hal/dumpstate/aidl/1.0/DumpstateServer.h) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/ServiceDescriptor.cpp (renamed from hal/dumpstate/aidl/1.0/ServiceDescriptor.cpp) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/ServiceDescriptor.h (renamed from hal/dumpstate/aidl/1.0/ServiceDescriptor.h) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/ServiceSupplier.cpp (renamed from hal/dumpstate/aidl/1.0/ServiceSupplier.cpp) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/ServiceSupplier.h (renamed from hal/dumpstate/aidl/1.0/ServiceSupplier.h) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/WatchdogClient.cpp (renamed from hal/dumpstate/aidl/1.0/WatchdogClient.cpp) | 6 | ||||
-rw-r--r-- | hal/dumpstate/1.1/WatchdogClient.h (renamed from hal/dumpstate/aidl/1.0/WatchdogClient.h) | 7 | ||||
-rw-r--r-- | hal/dumpstate/1.1/agl_build/CMakeLists.txt (renamed from hal/dumpstate/aidl/1.0/agl_build/CMakeLists.txt) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/android.hardware.dumpstate@1.1-service.trout.rc | 4 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/Android.bp (renamed from hal/dumpstate/aidl/1.0/config/Android.bp) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/XmlServiceSupplier.cpp (renamed from hal/dumpstate/aidl/1.0/config/XmlServiceSupplier.cpp) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/XmlServiceSupplier.h (renamed from hal/dumpstate/aidl/1.0/config/XmlServiceSupplier.h) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/api/current.txt (renamed from hal/dumpstate/aidl/1.0/config/api/current.txt) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/api/last_current.txt (renamed from hal/dumpstate/aidl/1.0/config/api/last_current.txt) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/api/last_removed.txt (renamed from hal/dumpstate/aidl/1.0/config/api/last_removed.txt) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/api/removed.txt (renamed from hal/dumpstate/aidl/1.0/config/api/removed.txt) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/coqos_config.xml (renamed from hal/dumpstate/aidl/1.0/config/coqos_config.xml) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/dumpstate_hal_configuration.xsd (renamed from hal/dumpstate/aidl/1.0/config/dumpstate_hal_configuration.xsd) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/dumpstate_hal_configuration_V1_0.cpp (renamed from hal/dumpstate/aidl/1.0/config/dumpstate_hal_configuration_V1_0.cpp) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/config/dumpstate_hal_configuration_V1_0.h (renamed from hal/dumpstate/aidl/1.0/config/dumpstate_hal_configuration_V1_0.h) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/proto/DumpstateServer.proto (renamed from hal/dumpstate/aidl/1.0/proto/DumpstateServer.proto) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/server_main.cpp (renamed from hal/dumpstate/aidl/1.0/server_main.cpp) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/service.cpp (renamed from hal/dumpstate/aidl/1.0/service.cpp) | 51 | ||||
-rw-r--r-- | hal/dumpstate/1.1/tests/test_main.cpp (renamed from hal/dumpstate/aidl/1.0/tests/test_main.cpp) | 0 | ||||
-rw-r--r-- | hal/dumpstate/1.1/tests/tests.cpp (renamed from hal/dumpstate/aidl/1.0/tests/tests.cpp) | 0 | ||||
-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/car_audio_configuration.xml | 5 | ||||
-rw-r--r-- | product_files/vendor/etc/sensors/hals.conf | 2 | ||||
-rw-r--r-- | shared/BoardConfig.mk | 2 |
62 files changed, 569 insertions, 127 deletions
@@ -3,4 +3,5 @@ adelva@google.com # Automotive team ankitarora@google.com +chenhaosjtuacm@google.com egranata@google.com diff --git a/agl_services_build/repo_manifest.xml b/agl_services_build/repo_manifest.xml index d3c128d..f69d5ef 100644 --- a/agl_services_build/repo_manifest.xml +++ b/agl_services_build/repo_manifest.xml @@ -20,7 +20,7 @@ <linkfile src="agl_services_build/cmake" dest="cmake" /> <linkfile src="agl_services_build/toolchain" dest="toolchain" /> <linkfile src="hal/audiocontrol" dest="audiocontrol" /> - <linkfile src="hal/dumpstate/aidl/1.0" dest="dumpstate_server" /> + <linkfile src="hal/dumpstate/1.1" dest="dumpstate_server" /> <linkfile src="hal/vehicle/2.0" dest="vehicle_hal_server" /> <linkfile src="hal/common/agl/watchdog" dest="watchdog_test_server" /> </project> diff --git a/agl_services_build/yocto-layer/meta-google/recipes-trout/agl-services/sources.inc b/agl_services_build/yocto-layer/meta-google/recipes-trout/agl-services/sources.inc index 7bf8dd5..f4cd9b6 100644 --- a/agl_services_build/yocto-layer/meta-google/recipes-trout/agl-services/sources.inc +++ b/agl_services_build/yocto-layer/meta-google/recipes-trout/agl-services/sources.inc @@ -49,7 +49,7 @@ SRC_SYMLINKS = "\ device/google/trout/agl_services_build/cmake:cmake \ device/google/trout/agl_services_build/toolchain:toolchain \ device/google/trout/hal/audiocontrol:audiocontrol \ - device/google/trout/hal/dumpstate/aidl/1.0:dumpstate_server \ + device/google/trout/hal/dumpstate/1.1:dumpstate_server \ device/google/trout/hal/vehicle/2.0:vehicle_hal_server \ device/google/trout/hal/common/agl/watchdog:watchdog_test_server \ hardware/interfaces/automotive/vehicle/2.0/default:third_party/default_native_vehicle_hal \ diff --git a/aosp_trout_arm64.mk b/aosp_trout_arm64.mk index 6d452d1..e783a5f 100644 --- a/aosp_trout_arm64.mk +++ b/aosp_trout_arm64.mk @@ -17,7 +17,6 @@ #RBC# type_hint string TROUT_KERNEL_IMAGE TARGET_USES_CF_RILD ?= false - $(call inherit-product, device/google/cuttlefish/vsoc_arm64_only/auto/aosp_cf.mk) # Prefer ext4 for the system image @@ -41,10 +40,6 @@ LOCAL_TRACING_SERVER_PROPERTIES ?= \ include device/google/trout/aosp_trout_common.mk -ifeq ($(TARGET_VULKAN_SUPPORT),true) -$(call inherit-product, build/make/target/product/angle_supported.mk) -endif - DEVICE_MANIFEST_FILE += device/google/trout/trout_arm64/manifest.xml PRODUCT_PROPERTY_OVERRIDES += \ @@ -56,21 +51,19 @@ 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 LOCAL_ENABLE_OEMLOCK ?= false -LOCAL_ENABLE_LIGHT ?= false - UEVENTD_ODM_COPY_FILE ?= device/google/trout/product_files/odm/ueventd.rc PRODUCT_COPY_FILES += \ - $(UEVENTD_ODM_COPY_FILE):$(TARGET_COPY_OUT_ODM)/ueventd.rc \ - device/google/trout/hal/sensors/2.0/config/sensor_hal_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/sensors/sensor_hal_configuration.xml \ + $(UEVENTD_ODM_COPY_FILE):$(TARGET_COPY_OUT_ODM)/etc/ueventd.rc \ + 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/aosp_trout_common.mk b/aosp_trout_common.mk index 3e3828d..ab99d05 100644 --- a/aosp_trout_common.mk +++ b/aosp_trout_common.mk @@ -59,11 +59,12 @@ DEVICE_VIRTWIFI_PORT ?= eth0 PRODUCT_VENDOR_PROPERTIES += ro.vendor.disable_rename_eth0=true # Dumpstate HAL -LOCAL_DUMPSTATE_PRODUCT_PACKAGE ?= android.hardware.automotive.dumpstate-service.trout -LOCAL_DUMPSTATE_PROPERTIES ?= \ - ro.vendor.dumpstate.server.cid=2 \ - ro.vendor.dumpstate.server.port=9310 \ - ro.vendor.helpersystem.log_loc=/data/host_logs \ +# TODO(b/215200137): Re-enable once converted to AIDL +#LOCAL_DUMPSTATE_PRODUCT_PACKAGE ?= android.hardware.dumpstate@1.1-service.trout +#LOCAL_DUMPSTATE_PROPERTIES ?= \ +# ro.vendor.dumpstate.server.cid=2 \ +# ro.vendor.dumpstate.server.port=9310 \ +# ro.vendor.helpersystem.log_loc=/data/host_logs \ # Vehicle HAL ENABLE_VHAL_FAKE_GRPC_SERVER ?= false diff --git a/hal/audiocontrol/aidl/1.0/audiocontrol-trout.rc b/hal/audiocontrol/aidl/1.0/audiocontrol-trout.rc index 5ff59e1..53dda85 100644 --- a/hal/audiocontrol/aidl/1.0/audiocontrol-trout.rc +++ b/hal/audiocontrol/aidl/1.0/audiocontrol-trout.rc @@ -1,4 +1,4 @@ -service vendor.audiocontrol-trout /vendor/bin/hw/android.hardware.automotive.audiocontrol-service.trout +service vendor.audiocontrol-default /vendor/bin/hw/android.hardware.automotive.audiocontrol-service.trout class hal user audioserver group system diff --git a/hal/dumpstate/1.1/Android.bp b/hal/dumpstate/1.1/Android.bp new file mode 100644 index 0000000..e4713be --- /dev/null +++ b/hal/dumpstate/1.1/Android.bp @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2020 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. + */ + +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +genrule { + name: "DumpstateServerProtoStub_h", + tools: [ + "aprotoc", + "protoc-gen-grpc-cpp-plugin", + ], + cmd: "$(location aprotoc) -Idevice/google/trout/hal/dumpstate/1.1/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location proto/DumpstateServer.proto) --grpc_out=$(genDir) --cpp_out=$(genDir)", + srcs: [ + "proto/DumpstateServer.proto", + ":libprotobuf-internal-protos", + ], + out: [ + "DumpstateServer.pb.h", + "DumpstateServer.grpc.pb.h", + ], +} + +genrule { + name: "DumpstateServerProtoStub_cc", + tools: [ + "aprotoc", + "protoc-gen-grpc-cpp-plugin", + ], + cmd: "$(location aprotoc) -Idevice/google/trout/hal/dumpstate/1.1/proto -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(location proto/DumpstateServer.proto) --grpc_out=$(genDir) --cpp_out=$(genDir)", + srcs: [ + "proto/DumpstateServer.proto", + ":libprotobuf-internal-protos", + ], + out: [ + "DumpstateServer.pb.cc", + "DumpstateServer.grpc.pb.cc", + ], +} + +cc_binary { + name: "android.hardware.dumpstate@1.1-service.trout", + srcs: [ + "DumpstateDevice.cpp", + "service.cpp", + "WatchdogClient.cpp", + ], + generated_headers: [ + "dumpstate_hal_configuration_V1_0", + "DumpstateServerProtoStub_h", + ], + generated_sources: [ + "dumpstate_hal_configuration_V1_0", + "DumpstateServerProtoStub_cc", + ], + static_libs: [ + "android.hardware.automotive@libc++fs", + "android.hardware.automotive.utils.vsockinfo", + "libxml2", + ], + shared_libs: [ + "android.hardware.automotive.utils.watchdog", + "android.hardware.dumpstate@1.0", + "android.hardware.dumpstate@1.1", + "android.automotive.watchdog-V2-ndk", + "libbase", + "libbinder_ndk", + "libcutils", + "libdumpstateutil", + "libgrpc++", + "libhidlbase", + "liblog", + "libprotobuf-cpp-full", + "libutils", + ], + cflags: [ + "-Wno-unused-parameter", + ], + relative_install_path: "hw", + init_rc: [ + "android.hardware.dumpstate@1.1-service.trout.rc", + ], + defaults: ["cuttlefish_guest_only"], + vintf_fragments: ["manifest_android.hardware.dumpstate@1.1-service.trout.xml"], +} diff --git a/hal/dumpstate/1.1/DumpstateDevice.cpp b/hal/dumpstate/1.1/DumpstateDevice.cpp new file mode 100644 index 0000000..5b6bf92 --- /dev/null +++ b/hal/dumpstate/1.1/DumpstateDevice.cpp @@ -0,0 +1,298 @@ +/* + * Copyright (C) 2020 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. + */ + +#include "DumpstateDevice.h" + +#include <DumpstateUtil.h> +#include <android-base/file.h> +#include <android-base/logging.h> +#include <android-base/properties.h> + +#include <fstream> +#include <string> + +using android::base::GetProperty; +using android::os::dumpstate::CommandOptions; +using android::os::dumpstate::DumpFileToFd; +using std::chrono::duration_cast; +using std::chrono::seconds; +using std::literals::chrono_literals::operator""s; + +namespace fs = android::hardware::automotive::filesystem; + +static constexpr const char* VENDOR_VERBOSE_LOGGING_ENABLED_PROPERTY = + "persist.vendor.verbose_logging_enabled"; + +static constexpr const char* VENDOR_HELPER_SYSTEM_LOG_LOC_PROPERTY = + "ro.vendor.helpersystem.log_loc"; + +static constexpr const char* BOOT_HYPERVISOR_VERSION_PROPERTY = "ro.boot.hypervisor.version"; + +namespace android::hardware::dumpstate::V1_1::implementation { + +static std::shared_ptr<::grpc::ChannelCredentials> getChannelCredentials() { + // TODO(chenhaosjtuacm): get secured credentials here + return ::grpc::InsecureChannelCredentials(); +} + +static void dumpDirAsText(int textFd, const fs::path& dirToDump) { + for (const auto& fileEntry : fs::recursive_directory_iterator(dirToDump)) { + if (!fileEntry.is_regular_file()) { + continue; + } + + DumpFileToFd(textFd, "Helper System Log", fileEntry.path()); + } +} + +static void tryDumpDirAsTar(int textFd, int binFd, const fs::path& dirToDump) { + if (!fs::is_directory(dirToDump)) { + LOG(ERROR) << "'" << dirToDump << "'" + << " is not a valid directory to dump"; + return; + } + + if (binFd < 0) { + LOG(WARNING) << "No binary dumped file, fallback to text mode"; + return dumpDirAsText(textFd, dirToDump); + } + + TemporaryFile tempTarFile; + constexpr auto kTarTimeout = 20s; + + RunCommandToFd( + textFd, "TAR LOG", {"/vendor/bin/tar", "cvf", tempTarFile.path, dirToDump.c_str()}, + CommandOptions::WithTimeout(duration_cast<seconds>(kTarTimeout).count()).Build()); + + std::vector<uint8_t> buffer(65536); + while (true) { + ssize_t bytes_read = TEMP_FAILURE_RETRY(read(tempTarFile.fd, buffer.data(), buffer.size())); + + if (bytes_read == 0) { + break; + } else if (bytes_read < 0) { + PLOG(DEBUG) << "Error reading temporary tar file(" << tempTarFile.path << ")"; + break; + } + + ssize_t result = TEMP_FAILURE_RETRY(write(binFd, buffer.data(), bytes_read)); + + if (result != bytes_read) { + LOG(DEBUG) << "Failed to write " << bytes_read + << " bytes, actually written: " << result; + break; + } + } +} + +bool DumpstateDevice::dumpRemoteLogs( + ::grpc::ClientReaderInterface<dumpstate_proto::DumpstateBuffer>* grpcReader, + const fs::path& dumpPath) { + dumpstate_proto::DumpstateBuffer logStreamBuffer; + std::fstream logFile(dumpPath, std::fstream::out | std::fstream::binary); + + if (!logFile.is_open()) { + LOG(ERROR) << "Failed to open file " << dumpPath; + return false; + } + + while (grpcReader->Read(&logStreamBuffer)) { + const auto& writeBuffer = logStreamBuffer.buffer(); + logFile.write(writeBuffer.c_str(), writeBuffer.size()); + } + auto grpcStatus = grpcReader->Finish(); + if (!grpcStatus.ok()) { + LOG(ERROR) << __func__ << ": GRPC GetCommandOutput Failed: " << grpcStatus.error_message(); + return false; + } + + return true; +} + +bool DumpstateDevice::dumpString(const std::string& text, const fs::path& dumpPath) { + std::fstream logFile(dumpPath, std::fstream::out | std::fstream::binary); + + if (!logFile.is_open()) { + LOG(ERROR) << "Failed to open file " << dumpPath; + return false; + } + + logFile.write(text.c_str(), text.size()); + + return true; +} + +bool DumpstateDevice::dumpHelperSystem(int textFd, int binFd) { + std::string helperSystemLogDir = + android::base::GetProperty(VENDOR_HELPER_SYSTEM_LOG_LOC_PROPERTY, ""); + + if (helperSystemLogDir.empty()) { + LOG(ERROR) << "Helper system log location '" << VENDOR_HELPER_SYSTEM_LOG_LOC_PROPERTY + << "' not set"; + return false; + } + + std::error_code error; + + auto helperSysLogPath = fs::path(helperSystemLogDir); + if (!fs::create_directories(helperSysLogPath, error)) { + LOG(ERROR) << "Failed to create the dumping log directory " << helperSystemLogDir << ": " + << error; + return false; + } + + if (!fs::is_directory(helperSysLogPath)) { + LOG(ERROR) << helperSystemLogDir << " is not a directory"; + return false; + } + + if (!isHealthy()) { + LOG(ERROR) << "Failed to connect to the dumpstate server"; + return false; + } + + // When start dumping, we always return success to keep dumped logs + // even if some of them are failed + + { + // Dumping system logs + ::grpc::ClientContext context; + auto reader = mGrpcStub->GetSystemLogs(&context, ::google::protobuf::Empty()); + dumpRemoteLogs(reader.get(), helperSysLogPath / "system_log"); + } + + { + // Dumping host system info + const std::string hyp = + "Host version information: " + + GetProperty(BOOT_HYPERVISOR_VERSION_PROPERTY, "missing/unavailable"); + dumpString(hyp, helperSysLogPath / "host_info"); + } + + // Request for service list every time to allow the service list to change on the server side. + // Also the getAvailableServices() may fail and return an empty list (e.g., failure on the + // server side), and it should not affect the future queries + const auto availableServices = getAvailableServices(); + + // Dumping service logs + for (const auto& service : availableServices) { + ::grpc::ClientContext context; + dumpstate_proto::ServiceLogRequest request; + request.set_service_name(service); + auto reader = mGrpcStub->GetServiceLogs(&context, request); + dumpRemoteLogs(reader.get(), helperSysLogPath / service); + } + + tryDumpDirAsTar(textFd, binFd, helperSystemLogDir); + + if (fs::remove_all(helperSysLogPath, error) == static_cast<std::uintmax_t>(-1)) { + LOG(ERROR) << "Failed to clear the dumping log directory " << helperSystemLogDir << ": " + << error; + } + return true; +} + +bool DumpstateDevice::isHealthy() { + // Check that we can get services back from the remote end + // This check will not work if the server actually works but is + // not exporting any services. This seems like a corner case + // but it's worth pointing out. + return (getAvailableServices().size() > 0); +} + +std::vector<std::string> DumpstateDevice::getAvailableServices() { + ::grpc::ClientContext context; + dumpstate_proto::ServiceNameList servicesProto; + auto grpc_status = + mGrpcStub->GetAvailableServices(&context, ::google::protobuf::Empty(), &servicesProto); + if (!grpc_status.ok()) { + LOG(ERROR) << "Failed to get available services from the server: " + << grpc_status.error_message(); + return {}; + } + + std::vector<std::string> services; + for (auto& service : servicesProto.service_names()) { + services.emplace_back(service); + } + return services; +} + +DumpstateDevice::DumpstateDevice(const std::string& addr) + : mServiceAddr(addr), + mGrpcChannel(::grpc::CreateChannel(mServiceAddr, getChannelCredentials())), + mGrpcStub(dumpstate_proto::DumpstateServer::NewStub(mGrpcChannel)) {} + +// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow. +Return<void> DumpstateDevice::dumpstateBoard(const hidl_handle& handle) { + // Ignore return value, just return an empty status. + dumpstateBoard_1_1(handle, DumpstateMode::DEFAULT, 30 * 1000 /* timeoutMillis */); + return Void(); +} + +// Methods from ::android::hardware::dumpstate::V1_1::IDumpstateDevice follow. +Return<DumpstateStatus> DumpstateDevice::dumpstateBoard_1_1(const hidl_handle& handle, + const DumpstateMode /* mode */, + const uint64_t /* timeoutMillis */) { + if (handle == nullptr || handle->numFds < 1) { + LOG(ERROR) << "No FDs"; + return DumpstateStatus::ILLEGAL_ARGUMENT; + } + + const int textFd = handle->data[0]; + const int binFd = handle->numFds >= 2 ? handle->data[1] : -1; + + if (!dumpHelperSystem(textFd, binFd)) { + return DumpstateStatus::DEVICE_LOGGING_NOT_ENABLED; + } + + return DumpstateStatus::OK; +} + +Return<void> DumpstateDevice::setVerboseLoggingEnabled(const bool enable) { + android::base::SetProperty(VENDOR_VERBOSE_LOGGING_ENABLED_PROPERTY, enable ? "true" : "false"); + return Void(); +} + +Return<bool> DumpstateDevice::getVerboseLoggingEnabled() { + return android::base::GetBoolProperty(VENDOR_VERBOSE_LOGGING_ENABLED_PROPERTY, false); +} + +Return<void> DumpstateDevice::debug(const hidl_handle& h, const hidl_vec<hidl_string>& options) { + if (h.getNativeHandle() == nullptr || h->numFds == 0) { + LOG(ERROR) << "Invalid FD passed to debug() function"; + return Void(); + } + + const int fd = h->data[0]; + auto pf = [fd](std::string s) -> void { dprintf(fd, "%s\n", s.c_str()); }; + debugDumpServices(pf); + + return Void(); +} + +void DumpstateDevice::debugDumpServices(std::function<void(std::string)> f) { + f("Available services for Dumpstate:"); + for (const auto& svc : getAvailableServices()) { + f(" " + svc); + } +} + +sp<DumpstateDevice> makeVirtualizationDumpstateDevice(const std::string& addr) { + return new DumpstateDevice(addr); +} + +} // namespace android::hardware::dumpstate::V1_1::implementation diff --git a/hal/dumpstate/aidl/1.0/DumpstateDevice.h b/hal/dumpstate/1.1/DumpstateDevice.h index 2e7c97b..862e7b1 100644 --- a/hal/dumpstate/aidl/1.0/DumpstateDevice.h +++ b/hal/dumpstate/1.1/DumpstateDevice.h @@ -15,9 +15,7 @@ */ #pragma once -#include <aidl/android/hardware/dumpstate/BnDumpstateDevice.h> -#include <aidl/android/hardware/dumpstate/IDumpstateDevice.h> -#include <android/binder_status.h> +#include <android/hardware/dumpstate/1.1/IDumpstateDevice.h> #include <automotive/filesystem> #include <functional> @@ -27,23 +25,27 @@ #include "DumpstateServer.grpc.pb.h" #include "DumpstateServer.pb.h" -namespace aidl::android::hardware::dumpstate::implementation { +namespace android::hardware::dumpstate::V1_1::implementation { -namespace fs = ::android::hardware::automotive::filesystem; +namespace fs = android::hardware::automotive::filesystem; -class DumpstateDevice : public BnDumpstateDevice { +class DumpstateDevice : public IDumpstateDevice { public: explicit DumpstateDevice(const std::string& addr); - ::ndk::ScopedAStatus dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds, - IDumpstateDevice::DumpstateMode in_mode, - int64_t in_timeoutMillis) override; + // Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow. + Return<void> dumpstateBoard(const hidl_handle& h) override; - ::ndk::ScopedAStatus getVerboseLoggingEnabled(bool* _aidl_return) override; - ::ndk::ScopedAStatus setVerboseLoggingEnabled(bool in_enable) override; + // Methods from ::android::hardware::dumpstate::V1_1::IDumpstateDevice follow. + Return<DumpstateStatus> dumpstateBoard_1_1(const hidl_handle& h, const DumpstateMode mode, + const uint64_t timeoutMillis) override; + Return<void> setVerboseLoggingEnabled(const bool enable) override; + Return<bool> getVerboseLoggingEnabled() override; bool isHealthy(); + Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options); + private: bool dumpRemoteLogs(::grpc::ClientReaderInterface<dumpstate_proto::DumpstateBuffer>* reader, const fs::path& dumpPath); @@ -51,6 +53,8 @@ class DumpstateDevice : public BnDumpstateDevice { bool dumpHelperSystem(int textFd, int binFd); + void debugDumpServices(std::function<void(std::string)> f); + std::vector<std::string> getAvailableServices(); std::string mServiceAddr; @@ -58,4 +62,6 @@ class DumpstateDevice : public BnDumpstateDevice { std::unique_ptr<dumpstate_proto::DumpstateServer::Stub> mGrpcStub; }; -} // namespace aidl::android::hardware::dumpstate::implementation +sp<DumpstateDevice> makeVirtualizationDumpstateDevice(const std::string& addr); + +} // namespace android::hardware::dumpstate::V1_1::implementation diff --git a/hal/dumpstate/aidl/1.0/DumpstateGrpcServer.cpp b/hal/dumpstate/1.1/DumpstateGrpcServer.cpp index a7626aa..a7626aa 100644 --- a/hal/dumpstate/aidl/1.0/DumpstateGrpcServer.cpp +++ b/hal/dumpstate/1.1/DumpstateGrpcServer.cpp diff --git a/hal/dumpstate/aidl/1.0/DumpstateGrpcServer.h b/hal/dumpstate/1.1/DumpstateGrpcServer.h index 32d1a10..32d1a10 100644 --- a/hal/dumpstate/aidl/1.0/DumpstateGrpcServer.h +++ b/hal/dumpstate/1.1/DumpstateGrpcServer.h diff --git a/hal/dumpstate/aidl/1.0/DumpstateServer.cpp b/hal/dumpstate/1.1/DumpstateServer.cpp index 621a843..621a843 100644 --- a/hal/dumpstate/aidl/1.0/DumpstateServer.cpp +++ b/hal/dumpstate/1.1/DumpstateServer.cpp diff --git a/hal/dumpstate/aidl/1.0/DumpstateServer.h b/hal/dumpstate/1.1/DumpstateServer.h index 7e67067..7e67067 100644 --- a/hal/dumpstate/aidl/1.0/DumpstateServer.h +++ b/hal/dumpstate/1.1/DumpstateServer.h diff --git a/hal/dumpstate/aidl/1.0/ServiceDescriptor.cpp b/hal/dumpstate/1.1/ServiceDescriptor.cpp index e4689be..e4689be 100644 --- a/hal/dumpstate/aidl/1.0/ServiceDescriptor.cpp +++ b/hal/dumpstate/1.1/ServiceDescriptor.cpp diff --git a/hal/dumpstate/aidl/1.0/ServiceDescriptor.h b/hal/dumpstate/1.1/ServiceDescriptor.h index 74844d1..74844d1 100644 --- a/hal/dumpstate/aidl/1.0/ServiceDescriptor.h +++ b/hal/dumpstate/1.1/ServiceDescriptor.h diff --git a/hal/dumpstate/aidl/1.0/ServiceSupplier.cpp b/hal/dumpstate/1.1/ServiceSupplier.cpp index 39bfe2a..39bfe2a 100644 --- a/hal/dumpstate/aidl/1.0/ServiceSupplier.cpp +++ b/hal/dumpstate/1.1/ServiceSupplier.cpp diff --git a/hal/dumpstate/aidl/1.0/ServiceSupplier.h b/hal/dumpstate/1.1/ServiceSupplier.h index 011a878..011a878 100644 --- a/hal/dumpstate/aidl/1.0/ServiceSupplier.h +++ b/hal/dumpstate/1.1/ServiceSupplier.h diff --git a/hal/dumpstate/aidl/1.0/WatchdogClient.cpp b/hal/dumpstate/1.1/WatchdogClient.cpp index fe2b3b7..0d9d1f2 100644 --- a/hal/dumpstate/aidl/1.0/WatchdogClient.cpp +++ b/hal/dumpstate/1.1/WatchdogClient.cpp @@ -22,8 +22,6 @@ using aidl::android::automotive::watchdog::ICarWatchdog; using aidl::android::automotive::watchdog::TimeoutLength; -using ::android::Looper; -using ::android::sp; namespace { @@ -31,7 +29,7 @@ enum { WHAT_CHECK_ALIVE = 1 }; } // namespace -namespace aidl::android::hardware::dumpstate::implementation { +namespace android::hardware::dumpstate::V1_1::implementation { WatchdogClient::WatchdogClient(const sp<Looper>& handlerLooper, DumpstateDevice* ddh) : BaseWatchdogClient(handlerLooper), mDumpstateImpl(ddh) {} @@ -40,4 +38,4 @@ bool WatchdogClient::isClientHealthy() const { return mDumpstateImpl->isHealthy(); } -} // namespace aidl::android::hardware::dumpstate::implementation +} // namespace android::hardware::dumpstate::V1_1::implementation diff --git a/hal/dumpstate/aidl/1.0/WatchdogClient.h b/hal/dumpstate/1.1/WatchdogClient.h index 006d98e..08a93ea 100644 --- a/hal/dumpstate/aidl/1.0/WatchdogClient.h +++ b/hal/dumpstate/1.1/WatchdogClient.h @@ -16,6 +16,7 @@ #pragma once #include "BaseWatchdogClient.h" + #include "DumpstateDevice.h" #include <aidl/android/automotive/watchdog/BnCarWatchdog.h> @@ -23,9 +24,9 @@ #include <utils/Looper.h> #include <utils/Mutex.h> -namespace aidl::android::hardware::dumpstate::implementation { +namespace android::hardware::dumpstate::V1_1::implementation { -class WatchdogClient : public ::android::hardware::automotive::utils::BaseWatchdogClient { +class WatchdogClient : public android::hardware::automotive::utils::BaseWatchdogClient { public: WatchdogClient(const ::android::sp<::android::Looper>& handlerLooper, DumpstateDevice* ddh); @@ -36,4 +37,4 @@ class WatchdogClient : public ::android::hardware::automotive::utils::BaseWatchd DumpstateDevice* mDumpstateImpl; }; -} // namespace aidl::android::hardware::dumpstate::implementation +} // namespace android::hardware::dumpstate::V1_1::implementation diff --git a/hal/dumpstate/aidl/1.0/agl_build/CMakeLists.txt b/hal/dumpstate/1.1/agl_build/CMakeLists.txt index 0c0849d..0c0849d 100644 --- a/hal/dumpstate/aidl/1.0/agl_build/CMakeLists.txt +++ b/hal/dumpstate/1.1/agl_build/CMakeLists.txt diff --git a/hal/dumpstate/1.1/android.hardware.dumpstate@1.1-service.trout.rc b/hal/dumpstate/1.1/android.hardware.dumpstate@1.1-service.trout.rc new file mode 100644 index 0000000..cfa750f --- /dev/null +++ b/hal/dumpstate/1.1/android.hardware.dumpstate@1.1-service.trout.rc @@ -0,0 +1,4 @@ +service dumpstate-1-1 /vendor/bin/hw/android.hardware.dumpstate@1.1-service.trout + class hal + user system + group system shell diff --git a/hal/dumpstate/aidl/1.0/config/Android.bp b/hal/dumpstate/1.1/config/Android.bp index abd4ae7..abd4ae7 100644 --- a/hal/dumpstate/aidl/1.0/config/Android.bp +++ b/hal/dumpstate/1.1/config/Android.bp diff --git a/hal/dumpstate/aidl/1.0/config/XmlServiceSupplier.cpp b/hal/dumpstate/1.1/config/XmlServiceSupplier.cpp index 2161ecd..2161ecd 100644 --- a/hal/dumpstate/aidl/1.0/config/XmlServiceSupplier.cpp +++ b/hal/dumpstate/1.1/config/XmlServiceSupplier.cpp diff --git a/hal/dumpstate/aidl/1.0/config/XmlServiceSupplier.h b/hal/dumpstate/1.1/config/XmlServiceSupplier.h index b116ec5..b116ec5 100644 --- a/hal/dumpstate/aidl/1.0/config/XmlServiceSupplier.h +++ b/hal/dumpstate/1.1/config/XmlServiceSupplier.h diff --git a/hal/dumpstate/aidl/1.0/config/api/current.txt b/hal/dumpstate/1.1/config/api/current.txt index e714210..e714210 100644 --- a/hal/dumpstate/aidl/1.0/config/api/current.txt +++ b/hal/dumpstate/1.1/config/api/current.txt diff --git a/hal/dumpstate/aidl/1.0/config/api/last_current.txt b/hal/dumpstate/1.1/config/api/last_current.txt index e69de29..e69de29 100644 --- a/hal/dumpstate/aidl/1.0/config/api/last_current.txt +++ b/hal/dumpstate/1.1/config/api/last_current.txt diff --git a/hal/dumpstate/aidl/1.0/config/api/last_removed.txt b/hal/dumpstate/1.1/config/api/last_removed.txt index e69de29..e69de29 100644 --- a/hal/dumpstate/aidl/1.0/config/api/last_removed.txt +++ b/hal/dumpstate/1.1/config/api/last_removed.txt diff --git a/hal/dumpstate/aidl/1.0/config/api/removed.txt b/hal/dumpstate/1.1/config/api/removed.txt index d802177..d802177 100644 --- a/hal/dumpstate/aidl/1.0/config/api/removed.txt +++ b/hal/dumpstate/1.1/config/api/removed.txt diff --git a/hal/dumpstate/aidl/1.0/config/coqos_config.xml b/hal/dumpstate/1.1/config/coqos_config.xml index 84d613e..84d613e 100644 --- a/hal/dumpstate/aidl/1.0/config/coqos_config.xml +++ b/hal/dumpstate/1.1/config/coqos_config.xml diff --git a/hal/dumpstate/aidl/1.0/config/dumpstate_hal_configuration.xsd b/hal/dumpstate/1.1/config/dumpstate_hal_configuration.xsd index 0b9897e..0b9897e 100644 --- a/hal/dumpstate/aidl/1.0/config/dumpstate_hal_configuration.xsd +++ b/hal/dumpstate/1.1/config/dumpstate_hal_configuration.xsd diff --git a/hal/dumpstate/aidl/1.0/config/dumpstate_hal_configuration_V1_0.cpp b/hal/dumpstate/1.1/config/dumpstate_hal_configuration_V1_0.cpp index 9738462..9738462 100644 --- a/hal/dumpstate/aidl/1.0/config/dumpstate_hal_configuration_V1_0.cpp +++ b/hal/dumpstate/1.1/config/dumpstate_hal_configuration_V1_0.cpp diff --git a/hal/dumpstate/aidl/1.0/config/dumpstate_hal_configuration_V1_0.h b/hal/dumpstate/1.1/config/dumpstate_hal_configuration_V1_0.h index 9aba0d4..9aba0d4 100644 --- a/hal/dumpstate/aidl/1.0/config/dumpstate_hal_configuration_V1_0.h +++ b/hal/dumpstate/1.1/config/dumpstate_hal_configuration_V1_0.h diff --git a/hal/dumpstate/aidl/1.0/proto/DumpstateServer.proto b/hal/dumpstate/1.1/proto/DumpstateServer.proto index f704e9e..f704e9e 100644 --- a/hal/dumpstate/aidl/1.0/proto/DumpstateServer.proto +++ b/hal/dumpstate/1.1/proto/DumpstateServer.proto diff --git a/hal/dumpstate/aidl/1.0/server_main.cpp b/hal/dumpstate/1.1/server_main.cpp index dfcd312..dfcd312 100644 --- a/hal/dumpstate/aidl/1.0/server_main.cpp +++ b/hal/dumpstate/1.1/server_main.cpp diff --git a/hal/dumpstate/aidl/1.0/service.cpp b/hal/dumpstate/1.1/service.cpp index 5c58e0b..5c0f08a 100644 --- a/hal/dumpstate/aidl/1.0/service.cpp +++ b/hal/dumpstate/1.1/service.cpp @@ -13,21 +13,32 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -#include <android-base/logging.h> -#include <android/binder_manager.h> #include <android/binder_process.h> +#include <cutils/properties.h> +#include <hidl/HidlSupport.h> +#include <hidl/HidlTransportSupport.h> + +#include <utils/Errors.h> +#include <utils/Looper.h> +#include <utils/StrongPointer.h> + +#include <sstream> + #include "DumpstateDevice.h" #include "WatchdogClient.h" #include <vsockinfo.h> -using ::aidl::android::hardware::dumpstate::implementation::DumpstateDevice; -using ::aidl::android::hardware::dumpstate::implementation::WatchdogClient; +using android::Looper; using ::android::OK; using ::android::sp; +using ::android::hardware::configureRpcThreadpool; +using ::android::hardware::joinRpcThreadpool; using ::android::hardware::automotive::utils::VsockConnectionInfo; +using ::android::hardware::dumpstate::V1_1::IDumpstateDevice; +using ::android::hardware::dumpstate::V1_1::implementation::makeVirtualizationDumpstateDevice; +using ::android::hardware::dumpstate::V1_1::implementation::WatchdogClient; int main() { const auto si = VsockConnectionInfo::fromRoPropertyStore( @@ -47,17 +58,25 @@ int main() { ALOGI("Connecting to vsock server at %s", si->str().c_str()); } - ABinderProcess_setThreadPoolMaxThreadCount(0); - - // Create an instance of our service class - std::shared_ptr<DumpstateDevice> dumpstateImpl = - ndk::SharedRefBase::make<DumpstateDevice>(si->str()); + auto dumpstate = makeVirtualizationDumpstateDevice(si->str()); + // This method MUST be called before interacting with any HIDL interfaces. + configureRpcThreadpool(2, true); + if (dumpstate->registerAsService() != OK) { + ALOGE("Could not register service."); + return 1; + } - const std::string instance = std::string() + DumpstateDevice::descriptor + "/default"; - binder_status_t status = - AServiceManager_addService(dumpstateImpl->asBinder().get(), instance.c_str()); - CHECK(status == STATUS_OK); + // Setup a binder thread pool to be a car watchdog client. + ABinderProcess_setThreadPoolMaxThreadCount(1); + ABinderProcess_startThreadPool(); + android::sp<Looper> looper(Looper::prepare(0 /* opts */)); + auto watchdogClient = ndk::SharedRefBase::make<WatchdogClient>(looper, dumpstate.get()); + if (!watchdogClient->initialize()) { + ALOGE("Failed to initialize car watchdog client"); + return 1; + } - ABinderProcess_joinThreadPool(); - return EXIT_FAILURE; // should not reach + while (true) { + looper->pollAll(-1 /* timeoutMillis */); + } } diff --git a/hal/dumpstate/aidl/1.0/tests/test_main.cpp b/hal/dumpstate/1.1/tests/test_main.cpp index d3f96f1..d3f96f1 100644 --- a/hal/dumpstate/aidl/1.0/tests/test_main.cpp +++ b/hal/dumpstate/1.1/tests/test_main.cpp diff --git a/hal/dumpstate/aidl/1.0/tests/tests.cpp b/hal/dumpstate/1.1/tests/tests.cpp index 33446b2..33446b2 100644 --- a/hal/dumpstate/aidl/1.0/tests/tests.cpp +++ b/hal/dumpstate/1.1/tests/tests.cpp 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/car_audio_configuration.xml b/product_files/vendor/etc/car_audio_configuration.xml index 595ada2..fa69f04 100644 --- a/product_files/vendor/etc/car_audio_configuration.xml +++ b/product_files/vendor/etc/car_audio_configuration.xml @@ -17,8 +17,9 @@ <!-- Defines the audio configuration in a car, including - Audio zones - - Context to audio bus mappings - - Volume groups + - Zone configurations (in each audio zone) + - Volume groups (in each zone configuration) + - Context to audio bus mappings (in each volume group) in the car environment. --> <carAudioConfiguration version="3"> 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 diff --git a/shared/BoardConfig.mk b/shared/BoardConfig.mk index 7fdc5bf..bf778ff 100644 --- a/shared/BoardConfig.mk +++ b/shared/BoardConfig.mk @@ -19,3 +19,5 @@ -include device/google/cuttlefish/shared/graphics/BoardConfig.mk -include device/google/cuttlefish/shared/telephony/BoardConfig.mk -include device/google/cuttlefish/shared/bluetooth/BoardConfig.mk + +BOARD_KERNEL_VERSION := |