diff options
author | chasewu <chasewu@google.com> | 2020-03-03 19:24:45 +0800 |
---|---|---|
committer | Chase Wu <chasewu@google.com> | 2020-03-04 01:38:37 +0000 |
commit | 6ab08577004717eed89d8c69392f5b3a3a8b7d25 (patch) | |
tree | 630d451c57cf7a7c26f0ff2266fac93c194dac55 | |
parent | 62c158c1880151032974a7617c0b8d56ff3c4583 (diff) | |
download | sunfish-6ab08577004717eed89d8c69392f5b3a3a8b7d25.tar.gz |
[DO NOT MERGE] vibrator: Fix VTS in gsi test environment
Since AOT Compliance Test (GSI) will remove some properties
to AOSP environment, the new temerature awareness mechanism
will fail due to null setting.
This commit add a flag to avoid that situation.
Bug: 150352000
Test: remove vibrator properties and test VTS items
Signed-off-by: chasewu <chasewu@google.com>
Change-Id: I2953876440f1a9db8f5845410a583676aae2366f
-rw-r--r-- | device.mk | 2 | ||||
-rw-r--r-- | vibrator/drv2624/Vibrator.cpp | 23 | ||||
-rw-r--r-- | vibrator/drv2624/Vibrator.h | 1 |
3 files changed, 14 insertions, 12 deletions
@@ -486,7 +486,7 @@ PRODUCT_PRODUCT_PROPERTIES +=\ ro.vibrator.hal.short.voltage=161 \ ro.vibrator.hal.long.voltage=161 \ ro.vibrator.hal.long.frequency.shift=10 \ - ro.vibrator.hal.steady.shape=1 + ro.vibrator.hal.steady.shape=1 \ ro.vibrator.hal.lptrigger=0 # Thermal HAL diff --git a/vibrator/drv2624/Vibrator.cpp b/vibrator/drv2624/Vibrator.cpp index 99fd6d93..b0a82fe8 100644 --- a/vibrator/drv2624/Vibrator.cpp +++ b/vibrator/drv2624/Vibrator.cpp @@ -182,7 +182,6 @@ Vibrator::Vibrator(std::unique_ptr<HwApi> hwapi, std::unique_ptr<HwCal> hwcal) : mHwApi(std::move(hwapi)), mHwCal(std::move(hwcal)) { std::string autocal; uint32_t lraPeriod = 0, lpTrigSupport = 0; - bool dynamicConfig = false; bool hasEffectCoeffs = false; std::array<float, 4> effectCoeffs = {0}; @@ -196,9 +195,9 @@ Vibrator::Vibrator(std::unique_ptr<HwApi> hwapi, std::unique_ptr<HwCal> hwcal) mHwCal->getLraPeriod(&lraPeriod); mHwCal->getCloseLoopThreshold(&mCloseLoopThreshold); - mHwCal->getDynamicConfig(&dynamicConfig); + mHwCal->getDynamicConfig(&mDynamicConfig); - if (dynamicConfig) { + if (mDynamicConfig) { uint8_t i = 0; float tempVolLevel = 0.0f; float tempAmpMax = 0.0f; @@ -313,15 +312,17 @@ Return<Status> Vibrator::on(uint32_t timeoutMs, const char mode[], // Methods from ::android::hardware::vibrator::V1_2::IVibrator follow. Return<Status> Vibrator::on(uint32_t timeoutMs) { - int usbTemp; ATRACE_NAME("Vibrator::on"); - mHwApi->getUsbTemp(&usbTemp); - if (usbTemp > TEMP_UPPER_BOUND) { - mSteadyConfig->odClamp = &mSteadyTargetOdClamp; - mSteadyConfig->olLraPeriod = mSteadyOlLraPeriod; - } else if (usbTemp < TEMP_LOWER_BOUND) { - mSteadyConfig->odClamp = &STEADY_VOLTAGE_LOWER_BOUND; - mSteadyConfig->olLraPeriod = mSteadyOlLraPeriodShift; + if (mDynamicConfig) { + int usbTemp = 0; + mHwApi->getUsbTemp(&usbTemp); + if (usbTemp > TEMP_UPPER_BOUND) { + mSteadyConfig->odClamp = &mSteadyTargetOdClamp; + mSteadyConfig->olLraPeriod = mSteadyOlLraPeriod; + } else if (usbTemp < TEMP_LOWER_BOUND) { + mSteadyConfig->odClamp = &STEADY_VOLTAGE_LOWER_BOUND; + mSteadyConfig->olLraPeriod = mSteadyOlLraPeriodShift; + } } return on(timeoutMs, RTP_MODE, mSteadyConfig, 0); diff --git a/vibrator/drv2624/Vibrator.h b/vibrator/drv2624/Vibrator.h index fb3c2d37..af72d228 100644 --- a/vibrator/drv2624/Vibrator.h +++ b/vibrator/drv2624/Vibrator.h @@ -196,6 +196,7 @@ class Vibrator : public IVibrator { uint32_t mSteadyTargetOdClamp; uint32_t mSteadyOlLraPeriod; uint32_t mSteadyOlLraPeriodShift; + bool mDynamicConfig; }; } // namespace implementation |