[automerger skipped] Merge "Merge 24Q3 (ab/11976889) to aosp-main-future" into aosp-main-future am: 5b64d61312 -s ours
am skip reason: Merged-In I4cc82131bb070a37cb6ed9dbe9d7cccc7ab5ee89 with SHA-1 23e78269a3 is already in history
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/27909038
Change-Id: Ie3d8bcd079cf3cc3a4dbc5c37bd6986cb991c69e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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/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();
}
});