Merge "Convert hardware/interfaces/keymaster/3.0/default/Android.mk to Android.bp" into main am: ab18a3b5a7 am: ad6f0eabf9
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3135574
Change-Id: I8f6e8b6d106a73250c618467a985f9910959c31a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/automotive/evs/aidl/Android.bp b/automotive/evs/aidl/Android.bp
index dfb15c6..5b2f82f 100644
--- a/automotive/evs/aidl/Android.bp
+++ b/automotive/evs/aidl/Android.bp
@@ -44,6 +44,9 @@
ndk: {
min_sdk_version: "29",
},
+ rust: {
+ enabled: true,
+ },
},
versions_with_info: [
{
diff --git a/automotive/evs/aidl/rust_impl/Android.bp b/automotive/evs/aidl/rust_impl/Android.bp
new file mode 100644
index 0000000..ac8b90f
--- /dev/null
+++ b/automotive/evs/aidl/rust_impl/Android.bp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+rust_binary {
+ name: "android.hardware.automotive.evs-aidl-rust-service",
+ relative_install_path: "hw",
+ vendor: true,
+ srcs: ["src/*.rs"],
+ crate_root: "src/main.rs",
+ vintf_fragments: ["manifest_evs-rust-service.xml"],
+ init_rc: ["evs-rust-service.rc"],
+ rustlibs: [
+ "android.hardware.automotive.evs-V2-rust",
+ "libbinder_rs",
+ "liblog_rust",
+ ],
+}
diff --git a/automotive/evs/aidl/rust_impl/README.md b/automotive/evs/aidl/rust_impl/README.md
new file mode 100644
index 0000000..bf00aed
--- /dev/null
+++ b/automotive/evs/aidl/rust_impl/README.md
@@ -0,0 +1,21 @@
+# Rust Skeleton EVS HAL implementation.
+
+WARNING: This is not a reference EVS HAL implementation and therefore does not
+provide any actual functionality.
+
+This folder contains a skeleton EVS HAL implementation in Rust to demonstrate
+how vendors could implement their EVS HAL in Rust. To compile and run this
+implementation, please include below package to the device build script:
+
+* `android.hardware.automotive.evs-aidl-rust-service`
+
+Please note that this service will attempt to register the service as
+`IEvsEnumerator/rust/0` and therefore is also required to be declared in the
+service context by adding below line to a proper `service_contexts` file:
+
+> android.hardware.automotive.evs.IEvsEnumerator/rust/0 u:object_r:hal_evs_service:s0
+
+This implementation intentionally returns `binder::StatusCode::UNKNOWN_ERROR`
+for any API call except deprecated API for ultrasonics; the process will be
+panicked on these methods instead. Hence, this implementation does not comply
+with VTS tests and vendors must replace each method with actual implementation.
diff --git a/automotive/evs/aidl/rust_impl/evs-rust-service.rc b/automotive/evs/aidl/rust_impl/evs-rust-service.rc
new file mode 100644
index 0000000..3741b21
--- /dev/null
+++ b/automotive/evs/aidl/rust_impl/evs-rust-service.rc
@@ -0,0 +1,8 @@
+service vendor.evs-hal-rust-default /vendor/bin/hw/android.hardware.automotive.evs-aidl-rust-service
+ class early_hal
+ priority -20
+ user graphics
+ group automotive_evs camera
+ onrestart restart cardisplayproxyd
+ onrestart restart evsmanagerd
+ disabled
diff --git a/automotive/evs/aidl/rust_impl/manifest_evs-rust-service.xml b/automotive/evs/aidl/rust_impl/manifest_evs-rust-service.xml
new file mode 100644
index 0000000..813cbb2
--- /dev/null
+++ b/automotive/evs/aidl/rust_impl/manifest_evs-rust-service.xml
@@ -0,0 +1,7 @@
+<manifest version="2.0" type="device">
+ <hal format="aidl">
+ <name>android.hardware.automotive.evs</name>
+ <version>2</version>
+ <fqname>IEvsEnumerator/rust/0</fqname>
+ </hal>
+</manifest>
diff --git a/automotive/evs/aidl/rust_impl/src/default_evs_hal.rs b/automotive/evs/aidl/rust_impl/src/default_evs_hal.rs
new file mode 100644
index 0000000..72b2d53
--- /dev/null
+++ b/automotive/evs/aidl/rust_impl/src/default_evs_hal.rs
@@ -0,0 +1,113 @@
+//
+// Copyright (C) 2024 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.
+//
+
+use android_hardware_automotive_evs::aidl::android::hardware::automotive::evs::{
+ CameraDesc::CameraDesc, DisplayState::DisplayState, IEvsCamera::IEvsCamera,
+ IEvsDisplay::IEvsDisplay, IEvsEnumerator::IEvsEnumerator,
+ IEvsEnumeratorStatusCallback::IEvsEnumeratorStatusCallback,
+ IEvsUltrasonicsArray::IEvsUltrasonicsArray, Stream::Stream,
+ UltrasonicsArrayDesc::UltrasonicsArrayDesc,
+};
+
+pub struct DefaultEvsHal {}
+
+impl binder::Interface for DefaultEvsHal {}
+
+impl IEvsEnumerator for DefaultEvsHal {
+ fn closeCamera(
+ &self,
+ _: &binder::Strong<(dyn IEvsCamera + 'static)>,
+ ) -> std::result::Result<(), binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn closeDisplay(
+ &self,
+ _: &binder::Strong<(dyn IEvsDisplay + 'static)>,
+ ) -> std::result::Result<(), binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn closeUltrasonicsArray(
+ &self,
+ _: &binder::Strong<(dyn IEvsUltrasonicsArray + 'static)>,
+ ) -> std::result::Result<(), binder::Status> {
+ unimplemented!()
+ }
+
+ fn getCameraList(&self) -> std::result::Result<std::vec::Vec<CameraDesc>, binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn getDisplayIdList(&self) -> std::result::Result<std::vec::Vec<u8>, binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn getDisplayState(&self) -> std::result::Result<DisplayState, binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn getStreamList(
+ &self,
+ _: &CameraDesc,
+ ) -> std::result::Result<std::vec::Vec<Stream>, binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn getUltrasonicsArrayList(
+ &self,
+ ) -> std::result::Result<std::vec::Vec<UltrasonicsArrayDesc>, binder::Status> {
+ unimplemented!()
+ }
+
+ fn isHardware(&self) -> std::result::Result<bool, binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn openCamera(
+ &self,
+ _: &str,
+ _: &Stream,
+ ) -> std::result::Result<binder::Strong<(dyn IEvsCamera + 'static)>, binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn openDisplay(
+ &self,
+ _: i32,
+ ) -> std::result::Result<binder::Strong<(dyn IEvsDisplay + 'static)>, binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn openUltrasonicsArray(
+ &self,
+ _: &str,
+ ) -> std::result::Result<binder::Strong<(dyn IEvsUltrasonicsArray + 'static)>, binder::Status>
+ {
+ unimplemented!()
+ }
+
+ fn registerStatusCallback(
+ &self,
+ _: &binder::Strong<(dyn IEvsEnumeratorStatusCallback + 'static)>,
+ ) -> std::result::Result<(), binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+
+ fn getDisplayStateById(&self, _: i32) -> std::result::Result<DisplayState, binder::Status> {
+ Err(binder::StatusCode::UNKNOWN_ERROR.into())
+ }
+}
diff --git a/automotive/evs/aidl/rust_impl/src/main.rs b/automotive/evs/aidl/rust_impl/src/main.rs
new file mode 100644
index 0000000..df312c0
--- /dev/null
+++ b/automotive/evs/aidl/rust_impl/src/main.rs
@@ -0,0 +1,42 @@
+//
+// Copyright (C) 2024 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.
+//
+
+mod default_evs_hal;
+
+use crate::default_evs_hal::DefaultEvsHal;
+
+use android_hardware_automotive_evs::aidl::android::hardware::automotive::evs::IEvsEnumerator::BnEvsEnumerator;
+
+use log::info;
+
+fn main() {
+ binder::ProcessState::start_thread_pool();
+
+ let service = DefaultEvsHal {};
+
+ // Register HAL implementation as rust/0 instance.
+ let service_name = "android.hardware.automotive.evs.IEvsEnumerator/rust/0";
+ let service_binder = BnEvsEnumerator::new_binder(service, binder::BinderFeatures::default());
+
+ binder::add_service(service_name, service_binder.as_binder())
+ .expect(format!("Failed to register {}.", service_name).as_str());
+ info!("EVS Hardware Enumerator is ready");
+
+ binder::ProcessState::join_thread_pool();
+
+ // In normal operation, we don't expect the thread pool to exit.
+ info!("EVS Hardware Enumerator is shutting down");
+}
diff --git a/gnss/aidl/android/hardware/gnss/IGnss.aidl b/gnss/aidl/android/hardware/gnss/IGnss.aidl
index 8a22d6e..aaafe7f 100644
--- a/gnss/aidl/android/hardware/gnss/IGnss.aidl
+++ b/gnss/aidl/android/hardware/gnss/IGnss.aidl
@@ -217,10 +217,6 @@
* Starts a location output stream using the IGnssCallback gnssLocationCb(), following the
* settings from the most recent call to setPositionMode().
*
- * When a location output stream is in progress, calling setPositionMode() does not change the
- * settings of the current location output stream. stop() and start() must be called to make the
- * new settings effective.
- *
* This output must operate independently of any GNSS location batching operations,
* see the IGnssBatching for details.
*/
@@ -310,10 +306,6 @@
/**
* Sets the GnssPositionMode parameter, its associated recurrence value, the time between fixes,
* requested fix accuracy, time to first fix.
- *
- * If a location output stream is in progress, calling this method does not affect the settings
- * of current location output stream. stop() and start() must be called to make the new settings
- * effective.
*/
void setPositionMode(in PositionModeOptions options);
diff --git a/nfc/aidl/vts/functional/Android.bp b/nfc/aidl/vts/functional/Android.bp
index d0b684b..d2508ce 100644
--- a/nfc/aidl/vts/functional/Android.bp
+++ b/nfc/aidl/vts/functional/Android.bp
@@ -49,6 +49,7 @@
cc_test {
name: "VtsNfcBehaviorChangesTest",
defaults: [
+ "aconfig_lib_cc_shared_link.defaults",
"VtsHalTargetTestDefaults",
"use_libaidlvintf_gtest_helper_static",
],
@@ -65,6 +66,7 @@
"system/nfc/utils/include",
],
shared_libs: [
+ "liblog",
"libbinder",
"libbinder_ndk",
"libnativehelper",
diff --git a/radio/aidl/vts/Android.bp b/radio/aidl/vts/Android.bp
index e83a7c1..9521068 100644
--- a/radio/aidl/vts/Android.bp
+++ b/radio/aidl/vts/Android.bp
@@ -25,6 +25,7 @@
cc_test {
name: "VtsHalRadioTargetTest",
defaults: [
+ "aconfig_lib_cc_shared_link.defaults",
"VtsHalTargetTestDefaults",
"use_libaidlvintf_gtest_helper_static",
],
diff --git a/sensors/aidl/default/include/sensors-impl/Sensors.h b/sensors/aidl/default/include/sensors-impl/Sensors.h
index 2adbc9d..c90db69 100644
--- a/sensors/aidl/default/include/sensors-impl/Sensors.h
+++ b/sensors/aidl/default/include/sensors-impl/Sensors.h
@@ -97,9 +97,13 @@
return;
}
if (mEventQueue->write(&events.front(), events.size())) {
+ if (mEventQueueFlag == nullptr) {
+ // Don't take the wake lock if we can't wake the receiver to avoid holding it
+ // indefinitely.
+ return;
+ }
mEventQueueFlag->wake(
static_cast<uint32_t>(BnSensors::EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS));
-
if (wakeup) {
// Keep track of the number of outstanding WAKE_UP events in order to properly hold
// a wake lock until the framework has secured a wake lock
diff --git a/vibrator/bench/benchmark.cpp b/vibrator/bench/benchmark.cpp
index deaa6f2..8e8d78f 100644
--- a/vibrator/bench/benchmark.cpp
+++ b/vibrator/bench/benchmark.cpp
@@ -381,6 +381,16 @@
return false;
}
+ void waitForComplete(std::future<void>& callbackFuture) {
+ // Wait until the HAL has finished processing previous vibration before starting a new one,
+ // so the HAL state is consistent on each run and metrics are less noisy. Some of the newest
+ // HAL implementations are waiting on previous vibration cleanup and might be significantly
+ // slower, so make sure we measure vibrations on a clean slate.
+ if (callbackFuture.valid()) {
+ callbackFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT);
+ }
+ }
+
static void SlowBenchConfig(Benchmark* b) { b->Iterations(VIBRATION_ITERATIONS); }
};
@@ -402,13 +412,7 @@
return android::binder::Status::ok();
}
- void waitForComplete() {
- // Wait until the HAL has finished processing previous vibration before starting a new one,
- // so the HAL state is consistent on each run and metrics are less noisy. Some of the newest
- // HAL implementations are waiting on previous vibration cleanup and might be significantly
- // slower, so make sure we measure vibrations on a clean slate.
- mPromise.get_future().wait_for(VIBRATION_CALLBACK_TIMEOUT);
- }
+ std::future<void> getFuture() { return mPromise.get_future(); }
private:
std::promise<void> mPromise;
@@ -419,6 +423,8 @@
for (auto _ : state) {
auto cb = hasCapabilities(Aidl::IVibrator::CAP_ON_CALLBACK) ? new HalCallback() : nullptr;
+ // Grab the future before callback promise is destroyed by the HAL.
+ auto cbFuture = cb ? cb->getFuture() : std::future<void>();
// Test
if (shouldSkipWithError(state, mVibrator->on(ms, cb))) {
@@ -430,9 +436,7 @@
if (shouldSkipWithError(state, mVibrator->off())) {
return;
}
- if (cb) {
- cb->waitForComplete();
- }
+ waitForComplete(cbFuture);
state.ResumeTiming();
}
});
@@ -442,6 +446,8 @@
for (auto _ : state) {
auto cb = hasCapabilities(Aidl::IVibrator::CAP_ON_CALLBACK) ? new HalCallback() : nullptr;
+ // Grab the future before callback promise is destroyed by the HAL.
+ auto cbFuture = cb ? cb->getFuture() : std::future<void>();
// Setup
state.PauseTiming();
@@ -457,9 +463,7 @@
// Cleanup
state.PauseTiming();
- if (cb) {
- cb->waitForComplete();
- }
+ waitForComplete(cbFuture);
state.ResumeTiming();
}
});
@@ -687,6 +691,8 @@
for (auto _ : state) {
auto cb = hasCapabilities(Aidl::IVibrator::CAP_PERFORM_CALLBACK) ? new HalCallback()
: nullptr;
+ // Grab the future before callback promise is destroyed by the HAL.
+ auto cbFuture = cb ? cb->getFuture() : std::future<void>();
// Test
if (shouldSkipWithError(state, mVibrator->perform(effect, strength, cb, &lengthMs))) {
@@ -698,9 +704,7 @@
if (shouldSkipWithError(state, mVibrator->off())) {
return;
}
- if (cb) {
- cb->waitForComplete();
- }
+ waitForComplete(cbFuture);
state.ResumeTiming();
}
});
@@ -800,6 +804,8 @@
for (auto _ : state) {
auto cb = new HalCallback();
+ // Grab the future before callback promise is moved and destroyed by the HAL.
+ auto cbFuture = cb->getFuture();
// Test
if (shouldSkipWithError(state, mVibrator->compose(effects, cb))) {
@@ -811,7 +817,7 @@
if (shouldSkipWithError(state, mVibrator->off())) {
return;
}
- cb->waitForComplete();
+ waitForComplete(cbFuture);
state.ResumeTiming();
}
});