Expose HAL limits for composed and PWLE vibrations
Expose limits to vibrations that use the compose and composePwle
methods, including composition sizes, primitives durations and delay.
Bug: 188431691
Fix: 183517124
Test: libvibratorservice_test
Change-Id: Id57e178cc3b718845afe4c9fb4db4fc818043dda
diff --git a/services/vibratorservice/VibratorHalWrapper.cpp b/services/vibratorservice/VibratorHalWrapper.cpp
index f15a963..a375808 100644
--- a/services/vibratorservice/VibratorHalWrapper.cpp
+++ b/services/vibratorservice/VibratorHalWrapper.cpp
@@ -135,6 +135,18 @@
if (mInfoCache.mSupportedBraking.isFailed()) {
mInfoCache.mSupportedBraking = getSupportedBrakingInternal();
}
+ if (mInfoCache.mPrimitiveDelayMax.isFailed()) {
+ mInfoCache.mPrimitiveDelayMax = getPrimitiveDelayMaxInternal();
+ }
+ if (mInfoCache.mPwlePrimitiveDurationMax.isFailed()) {
+ mInfoCache.mPwlePrimitiveDurationMax = getPrimitiveDurationMaxInternal();
+ }
+ if (mInfoCache.mCompositionSizeMax.isFailed()) {
+ mInfoCache.mCompositionSizeMax = getCompositionSizeMaxInternal();
+ }
+ if (mInfoCache.mPwleSizeMax.isFailed()) {
+ mInfoCache.mPwleSizeMax = getPwleSizeMaxInternal();
+ }
if (mInfoCache.mMinFrequency.isFailed()) {
mInfoCache.mMinFrequency = getMinFrequencyInternal();
}
@@ -209,6 +221,26 @@
return HalResult<std::vector<milliseconds>>::unsupported();
}
+HalResult<milliseconds> HalWrapper::getPrimitiveDelayMaxInternal() {
+ ALOGV("Skipped getPrimitiveDelayMaxInternal because it's not available in Vibrator HAL");
+ return HalResult<milliseconds>::unsupported();
+}
+
+HalResult<milliseconds> HalWrapper::getPrimitiveDurationMaxInternal() {
+ ALOGV("Skipped getPrimitiveDurationMaxInternal because it's not available in Vibrator HAL");
+ return HalResult<milliseconds>::unsupported();
+}
+
+HalResult<int32_t> HalWrapper::getCompositionSizeMaxInternal() {
+ ALOGV("Skipped getCompositionSizeMaxInternal because it's not available in Vibrator HAL");
+ return HalResult<int32_t>::unsupported();
+}
+
+HalResult<int32_t> HalWrapper::getPwleSizeMaxInternal() {
+ ALOGV("Skipped getPwleSizeMaxInternal because it's not available in Vibrator HAL");
+ return HalResult<int32_t>::unsupported();
+}
+
HalResult<float> HalWrapper::getMinFrequencyInternal() {
ALOGV("Skipped getMinFrequency because it's not available in Vibrator HAL");
return HalResult<float>::unsupported();
@@ -383,6 +415,30 @@
return HalResult<std::vector<milliseconds>>::ok(durations);
}
+HalResult<milliseconds> AidlHalWrapper::getPrimitiveDelayMaxInternal() {
+ int32_t delay = 0;
+ auto result = getHal()->getCompositionDelayMax(&delay);
+ return HalResult<milliseconds>::fromStatus(result, milliseconds(delay));
+}
+
+HalResult<milliseconds> AidlHalWrapper::getPrimitiveDurationMaxInternal() {
+ int32_t delay = 0;
+ auto result = getHal()->getPwlePrimitiveDurationMax(&delay);
+ return HalResult<milliseconds>::fromStatus(result, milliseconds(delay));
+}
+
+HalResult<int32_t> AidlHalWrapper::getCompositionSizeMaxInternal() {
+ int32_t size = 0;
+ auto result = getHal()->getCompositionSizeMax(&size);
+ return HalResult<int32_t>::fromStatus(result, size);
+}
+
+HalResult<int32_t> AidlHalWrapper::getPwleSizeMaxInternal() {
+ int32_t size = 0;
+ auto result = getHal()->getPwleCompositionSizeMax(&size);
+ return HalResult<int32_t>::fromStatus(result, size);
+}
+
HalResult<float> AidlHalWrapper::getMinFrequencyInternal() {
float minFrequency = 0;
auto result = getHal()->getFrequencyMinimum(&minFrequency);