Merge "haptics: Implement constant effect for heavy click" into pi-dev am: b7f5c29f5f

am: 8d8fd690de

Change-Id: Ib59bf49360e27c6e2c1a5dcd8446d7ee7bcababf
This commit is contained in:
David Lin
2018-04-17 15:40:20 -07:00
committed by android-build-merger
3 changed files with 15 additions and 3 deletions

View File

@@ -164,6 +164,7 @@ ro.vendor.build.svn u:object_r:vendor_default_prop:s0
ro.vendor.extension_library u:object_r:vendor_default_prop:s0
ro.vibrator.hal.click.duration u:object_r:vendor_default_prop:s0
ro.vibrator.hal.tick.duration u:object_r:vendor_default_prop:s0
ro.vibrator.hal.heavyclick.duration u:object_r:vendor_default_prop:s0
sdm. u:object_r:vendor_default_prop:s0
sys.disable_ext_animation u:object_r:vendor_default_prop:s0
sys.display.low_persistence_mode_brightness u:object_r:vendor_default_prop:s0

View File

@@ -42,18 +42,22 @@ static constexpr int8_t MIN_RTP_INPUT = 0;
static constexpr char RTP_MODE[] = "rtp";
static constexpr char WAVEFORM_MODE[] = "waveform";
// Use effect #1 in the waveform library
// Use effect #1 in the waveform library for CLICK effect
static constexpr char WAVEFORM_CLICK_EFFECT_SEQ[] = "1 0";
static constexpr int32_t WAVEFORM_CLICK_EFFECT_MS = 6;
// Use effect #2 in the waveform library
// Use effect #2 in the waveform library for TICK effect
static constexpr char WAVEFORM_TICK_EFFECT_SEQ[] = "2 0";
static constexpr int32_t WAVEFORM_TICK_EFFECT_MS = 2;
// Use effect #3 in the waveform library
// Use effect #3 in the waveform library for DOUBLE_CLICK effect
static constexpr char WAVEFORM_DOUBLE_CLICK_EFFECT_SEQ[] = "3 0";
static constexpr uint32_t WAVEFORM_DOUBLE_CLICK_EFFECT_MS = 135;
// Use effect #4 in the waveform library for HEAVY_CLICK effect
static constexpr char WAVEFORM_HEAVY_CLICK_EFFECT_SEQ[] = "4 0";
static constexpr uint32_t WAVEFORM_HEAVY_CLICK_EFFECT_MS = 8;
// Timeout threshold for selecting open or closed loop mode
static constexpr int8_t LOOP_MODE_THRESHOLD_MS = 20;
@@ -76,6 +80,8 @@ Vibrator::Vibrator(std::ofstream&& activate, std::ofstream&& duration,
mClickDuration = property_get_int32("ro.vibrator.hal.click.duration", WAVEFORM_CLICK_EFFECT_MS);
mTickDuration = property_get_int32("ro.vibrator.hal.tick.duration", WAVEFORM_TICK_EFFECT_MS);
mHeavyClickDuration = property_get_int32(
"ro.vibrator.hal.heavyclick.duration", WAVEFORM_HEAVY_CLICK_EFFECT_MS);
// This enables effect #1 from the waveform library to be triggered by SLPI
// while the AP is in suspend mode
@@ -199,6 +205,10 @@ Return<void> Vibrator::performEffect(Effect effect, EffectStrength strength, per
mSequencer << WAVEFORM_TICK_EFFECT_SEQ << std::endl;
timeMS = mTickDuration;
break;
case Effect::HEAVY_CLICK:
mSequencer << WAVEFORM_HEAVY_CLICK_EFFECT_SEQ << std::endl;
timeMS = mHeavyClickDuration;
break;
default:
_hidl_cb(Status::UNSUPPORTED_OPERATION, 0);
return Void();

View File

@@ -62,6 +62,7 @@ private:
std::ofstream mLpTriggerEffect;
int32_t mClickDuration;
int32_t mTickDuration;
int32_t mHeavyClickDuration;
};
} // namespace implementation
} // namespace V1_2