device/vibrator: Add contextual haptics feature
Add capability for vibrator HAL to detect whether the device is face-up and adjust/scale haptic alerts to avoid loud and startling buzzing when there is no case on the device. Added global compile-time disable that can be set in the environment. Bug: 198239103 Test: Verified tests and functionality Change-Id: I6b2355acb7fa5e0323b8eca6327bb19ac42a2c56 Signed-off-by: Chris Paulo <chrispaulo@google.com>
This commit is contained in:

committed by
TreeHugger Robot

parent
24789fe332
commit
0db068b63c
@@ -92,6 +92,22 @@ class HwApi : public Vibrator::HwApi, private HwApiBase {
|
||||
bool setF0CompEnable(bool value) override { return set(value, &mF0CompEnable); }
|
||||
bool setRedcCompEnable(bool value) override { return set(value, &mRedcCompEnable); }
|
||||
bool setMinOnOffInterval(uint32_t value) override { return set(value, &mMinOnOffInterval); }
|
||||
uint32_t getContextScale() override {
|
||||
return utils::getProperty("persist.vendor.vibrator.hal.context.scale", 100);
|
||||
}
|
||||
bool getContextEnable() override {
|
||||
return utils::getProperty("persist.vendor.vibrator.hal.context.enable", false);
|
||||
}
|
||||
uint32_t getContextSettlingTime() override {
|
||||
return utils::getProperty("persist.vendor.vibrator.hal.context.settlingtime", 3000);
|
||||
}
|
||||
uint32_t getContextCooldownTime() override {
|
||||
return utils::getProperty("persist.vendor.vibrator.hal.context.cooldowntime", 1000);
|
||||
}
|
||||
bool getContextFadeEnable() override {
|
||||
return utils::getProperty("persist.vendor.vibrator.hal.context.fade", false);
|
||||
}
|
||||
|
||||
// TODO(b/234338136): Need to add the force feedback HW API test cases
|
||||
bool setFFGain(int fd, uint16_t value) override {
|
||||
struct input_event gain = {
|
||||
|
Reference in New Issue
Block a user