From e4c56d9367ae89c705b92e44f327bd1d0132129c Mon Sep 17 00:00:00 2001 From: Vairavan Srinivasan Date: Thu, 31 Mar 2011 13:32:54 -0700 Subject: 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 --- services/java/com/android/server/VibratorService.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'services/java/com') 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); } } -- cgit v1.2.3-59-g8ed1b