From 1064a50dc86c2aea54bc6830c6cae464feb27feb Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Wed, 2 May 2012 16:51:37 -0700 Subject: [PATCH] hasVibrator() should only report presence of built-in vibrator. Bug: 6430585 Change-Id: Ia8d8656a2f0467b83f22a1dd747fbd17575573b3 --- .../java/com/android/server/VibratorService.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/services/java/com/android/server/VibratorService.java b/services/java/com/android/server/VibratorService.java index 6282c31ce97d4..b6098675b5dce 100755 --- a/services/java/com/android/server/VibratorService.java +++ b/services/java/com/android/server/VibratorService.java @@ -391,9 +391,15 @@ public class VibratorService extends IVibratorService.Stub } private boolean doVibratorExists() { - synchronized (mInputDeviceVibrators) { - return !mInputDeviceVibrators.isEmpty() || vibratorExists(); - } + // For now, we choose to ignore the presence of input devices that have vibrators + // when reporting whether the device has a vibrator. Applications often use this + // information to decide whether to enable certain features so they expect the + // result of hasVibrator() to be constant. For now, just report whether + // the device has a built-in vibrator. + //synchronized (mInputDeviceVibrators) { + // return !mInputDeviceVibrators.isEmpty() || vibratorExists(); + //} + return vibratorExists(); } private void doVibratorOn(long millis) {