diff options
author | Vairavan Srinivasan <vairav@codeaurora.org> | 2011-03-31 13:32:54 -0700 |
---|---|---|
committer | Vairavan Srinivasan <vairav@codeaurora.org> | 2012-08-19 12:08:42 -0700 |
commit | e4c56d9367ae89c705b92e44f327bd1d0132129c (patch) | |
tree | 3b7fafe7ebedb67a1b5efff7e977f0523d3e6966 /services/java/com/android/server/VibratorService.java | |
parent | dfac68eacc60c130e54345d98bd45c99573cb627 (diff) |
VibratorService: Fix to ensure actual delay in a vibrate pattern
delay might timeout early as value of duration isn't updated
correctly in the loop, should the wait be interrupted, to reflect
the elapsed time. Fix is to update duration in the loop.
Change-Id: I525b0e97799b288f46ae3a056cff7dcc69701bb0
Diffstat (limited to 'services/java/com/android/server/VibratorService.java')
-rwxr-xr-x | services/java/com/android/server/VibratorService.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/services/java/com/android/server/VibratorService.java b/services/java/com/android/server/VibratorService.java index b6098675b5dc..72fde1123809 100755 --- a/services/java/com/android/server/VibratorService.java +++ b/services/java/com/android/server/VibratorService.java @@ -441,7 +441,7 @@ public class VibratorService extends IVibratorService.Stub private void delay(long duration) { if (duration > 0) { - long bedtime = SystemClock.uptimeMillis(); + long bedtime = duration + SystemClock.uptimeMillis(); do { try { this.wait(duration); @@ -451,8 +451,7 @@ public class VibratorService extends IVibratorService.Stub if (mDone) { break; } - duration = duration - - SystemClock.uptimeMillis() - bedtime; + duration = bedtime - SystemClock.uptimeMillis(); } while (duration > 0); } } |