Apply intensity control for haptic data.

Use the same logic in VibrationEffect.scale to control the intensity of
haptic playback in audio framework. Note that as the maximum amplitude
of vibrator is 255, convert the haptic data to pcm_8_bit before doing
scaling.

Test: Manually
Change-Id: I6136d27c9255a215834b6e3092aa8ad696fbae04
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index f328577..ca0d749 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -295,6 +295,8 @@
                         (void *)(uintptr_t)mSinkChannelMask);
                 mMixer->setParameter(name, AudioMixer::TRACK, AudioMixer::HAPTIC_ENABLED,
                         (void *)(uintptr_t)fastTrack->mHapticPlaybackEnabled);
+                mMixer->setParameter(name, AudioMixer::TRACK, AudioMixer::HAPTIC_INTENSITY,
+                        (void *)(uintptr_t)fastTrack->mHapticIntensity);
                 mMixer->enable(name);
             }
             mGenerations[i] = fastTrack->mGeneration;
@@ -333,6 +335,8 @@
                             (void *)(uintptr_t)mSinkChannelMask);
                     mMixer->setParameter(name, AudioMixer::TRACK, AudioMixer::HAPTIC_ENABLED,
                             (void *)(uintptr_t)fastTrack->mHapticPlaybackEnabled);
+                    mMixer->setParameter(name, AudioMixer::TRACK, AudioMixer::HAPTIC_INTENSITY,
+                            (void *)(uintptr_t)fastTrack->mHapticIntensity);
                     // already enabled
                 }
                 mGenerations[i] = fastTrack->mGeneration;