Add getSupportedPrimitives to vibrator HAL wrapper
Expose the IVibrator.aidl getSupportedPrimitives method to be used by
the VibratorService.
Fix: b/163484172
Test: atest libvibratorservice_test
Change-Id: I6dfa0df6993837c45365a2f2c051cb1462b9d155
diff --git a/services/vibratorservice/VibratorHalController.cpp b/services/vibratorservice/VibratorHalController.cpp
index a9da74f..46175ad 100644
--- a/services/vibratorservice/VibratorHalController.cpp
+++ b/services/vibratorservice/VibratorHalController.cpp
@@ -28,6 +28,7 @@
#include <vibratorservice/VibratorHalWrapper.h>
using android::hardware::vibrator::CompositeEffect;
+using android::hardware::vibrator::CompositePrimitive;
using android::hardware::vibrator::Effect;
using android::hardware::vibrator::EffectStrength;
@@ -201,6 +202,12 @@
return apply(getSupportedEffectsFn, "getSupportedEffects");
}
+HalResult<std::vector<CompositePrimitive>> HalController::getSupportedPrimitives() {
+ hal_fn<std::vector<CompositePrimitive>> getSupportedPrimitivesFn =
+ [](std::shared_ptr<HalWrapper> hal) { return hal->getSupportedPrimitives(); };
+ return apply(getSupportedPrimitivesFn, "getSupportedPrimitives");
+}
+
HalResult<milliseconds> HalController::performEffect(
Effect effect, EffectStrength strength, const std::function<void()>& completionCallback) {
hal_fn<milliseconds> performEffectFn = [&](std::shared_ptr<HalWrapper> hal) {