Add adaptive haptics scaling to external vibrations
Converting the usage of haptic intensity, which only covers the scale
level, to HapticScale which includes both scale level and adaptive
haptics scale.
Bug: 305957324
Test: N/A
Change-Id: Ib3a5b83e20707207affbbe6dbc0586669ae4841b
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index a02657e..b270813 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -1536,7 +1536,7 @@
return IAfEffectModule::isSpatializer(&mDescriptor.type);
}
-status_t EffectModule::setHapticIntensity_l(int id, os::HapticScale intensity) {
+status_t EffectModule::setHapticScale_l(int id, os::HapticScale hapticScale) {
if (mStatus != NO_ERROR) {
return mStatus;
}
@@ -1551,7 +1551,7 @@
param->vsize = sizeof(int32_t) * 2;
*(int32_t*)param->data = HG_PARAM_HAPTIC_INTENSITY;
*((int32_t*)param->data + 1) = id;
- *((int32_t*)param->data + 2) = static_cast<int32_t>(intensity);
+ *((int32_t*)param->data + 2) = static_cast<int32_t>(hapticScale.getLevel());
std::vector<uint8_t> response;
status_t status = command(EFFECT_CMD_SET_PARAM, request, sizeof(int32_t), &response);
if (status == NO_ERROR) {
@@ -2674,11 +2674,11 @@
return false;
}
-void EffectChain::setHapticIntensity_l(int id, os::HapticScale intensity)
+void EffectChain::setHapticScale_l(int id, os::HapticScale hapticScale)
{
audio_utils::lock_guard _l(mutex());
for (size_t i = 0; i < mEffects.size(); ++i) {
- mEffects[i]->setHapticIntensity_l(id, intensity);
+ mEffects[i]->setHapticScale_l(id, hapticScale);
}
}