Revert "Load vibration scale gain from system properties"
Revert submission 29071407-scale-gain-system-property
Reason for revert: DroidMonitor: Potential culprit for http://b/365965907 - verifying through ABTD before submission.
Reverted changes: /q/submissionid:29071407-scale-gain-system-property
Change-Id: I2fa76c68c6a065dd44457838d724adadb57d153c
diff --git a/libs/vibrator/ExternalVibrationUtils.cpp b/libs/vibrator/ExternalVibrationUtils.cpp
index 4757bdb..ca13afc 100644
--- a/libs/vibrator/ExternalVibrationUtils.cpp
+++ b/libs/vibrator/ExternalVibrationUtils.cpp
@@ -17,10 +17,6 @@
#include <cstring>
-#include <android-base/parsedouble.h>
-#include <android-base/properties.h>
-#include <android-base/thread_annotations.h>
-
#include <android_os_vibrator.h>
#include <algorithm>
@@ -38,21 +34,6 @@
static constexpr float SCALE_GAMMA = 0.65f; // Same as VibrationEffect.SCALE_GAMMA
static constexpr float SCALE_LEVEL_GAIN = 1.4f; // Same as VibrationConfig.DEFAULT_SCALE_LEVEL_GAIN
-float getScaleLevelGain() {
- static std::mutex gMutex;
- static float gScaleLevelGain GUARDED_BY(gMutex) = 0;
- std::lock_guard lock(gMutex);
- if (gScaleLevelGain != 0) {
- return gScaleLevelGain;
- }
- float scaleGain;
- std::string value = ::android::base::GetProperty("vendor.vibrator.scale.level.gain", "");
- if (value.empty() || !::android::base::ParseFloat(value, &scaleGain) || scaleGain <= 1) {
- scaleGain = SCALE_LEVEL_GAIN;
- }
- return gScaleLevelGain = scaleGain;
-}
-
float getOldHapticScaleGamma(HapticLevel level) {
switch (level) {
case HapticLevel::VERY_LOW:
@@ -98,8 +79,7 @@
case HapticLevel::NONE:
return 1.0f;
default:
- float scaleLevelGain = getScaleLevelGain();
- float scaleFactor = powf(scaleLevelGain, static_cast<int32_t>(level));
+ float scaleFactor = powf(SCALE_LEVEL_GAIN, static_cast<int32_t>(level));
if (scaleFactor <= 0) {
ALOGE("Invalid scale factor %.2f for level %d, using fallback to 1.0",
scaleFactor, static_cast<int32_t>(level));