Mute haptic when the audio attributes have mute haptic flag.
When the client requests mute haptic channel via audio attributes,
return haptic scale as MUTE so that it is ensured the haptic data is
muted.
Bug: 320226258
Test: play audio-coupled haptic
Change-Id: Ia280a64217897179e7720fe034a81a66151a96b1
diff --git a/services/audioflinger/afutils/Vibrator.cpp b/services/audioflinger/afutils/Vibrator.cpp
index 25fcc6a..ab15a09 100644
--- a/services/audioflinger/afutils/Vibrator.cpp
+++ b/services/audioflinger/afutils/Vibrator.cpp
@@ -44,6 +44,10 @@
}
os::HapticScale onExternalVibrationStart(const sp<os::ExternalVibration>& externalVibration) {
+ if (externalVibration->getAudioAttributes().flags & AUDIO_FLAG_MUTE_HAPTIC) {
+ ALOGD("%s, mute haptic according to audio attributes flag", __func__);
+ return os::HapticScale::MUTE;
+ }
const sp<os::IExternalVibratorService> evs = getExternalVibratorService();
if (evs != nullptr) {
int32_t ret;