Update vendor VibrationEffect to support scale factor
Update VendorEffect.aidl to support 2 continuous float scale parameters,
one that reflects the user intensity settings for that effect and a
second that is forwarded from the vendor vibrator controller service for
that vibration usage.
This allows vendors to apply the 2-tier scaling function to the
vibrations, one reflecting the user settings and a second reflecting the
vendor parameter sent to the platform based on the device current
state.
Bug: 345409060
Test: VtsHalVibratorTargetTest
Flag: EXEMPT HAL interface changes
Change-Id: Ic88f90fd0ff1eae8797a7fe7d84d5b11f6c2f6bf
diff --git a/vibrator/aidl/default/Vibrator.cpp b/vibrator/aidl/default/Vibrator.cpp
index acf7d34..29e7d18 100644
--- a/vibrator/aidl/default/Vibrator.cpp
+++ b/vibrator/aidl/default/Vibrator.cpp
@@ -117,6 +117,10 @@
if (scale <= 0) {
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
+ float vendorScale = effect.vendorScale;
+ if (vendorScale <= 0) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
int32_t durationMs = 0;
if (!effect.vendorData.getInt("DURATION_MS", &durationMs) || durationMs <= 0) {