mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-22 12:05:32 -04:00
universal7885: vibrator: Don't allow intensity 0
* Even if amplitude is > 0 resulting intensity might be 0 sometimes * New devices just return EINVAL in kernel and ignore it, but on older ones this may result in very weak vibration Change-Id: I5d290d60d8414ca747dce4af847f190e3caedbe0 Signed-off-by: roynatech2544 <whiteshell2544@naver.com>
This commit is contained in:
parent
053aa4fa1c
commit
f8f5a64999
1 changed files with 5 additions and 0 deletions
|
|
@ -168,6 +168,11 @@ ndk::ScopedAStatus Vibrator::setAmplitude(float amplitude) {
|
|||
if (intensity > INTENSITY_MAX) {
|
||||
intensity = INTENSITY_MAX;
|
||||
}
|
||||
|
||||
if (intensity == 0) {
|
||||
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
|
||||
}
|
||||
|
||||
LOG(DEBUG) << "Setting intensity: " << intensity;
|
||||
|
||||
if (mHasTimedOutIntensity) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue