From 96179213ba1b2b3fc0e7d527ac606eba511bc558 Mon Sep 17 00:00:00 2001 From: Svetoslav Ganov Date: Wed, 10 Oct 2012 14:17:45 -0700 Subject: [PATCH] No sound produced on global actions dialog pops up if no vibrator is present. 1. If the global gesture to enable accessibility is enabled there should be a haptic or auditory feedback after the global actions dialog pops up as a result of a long press on power. On devices with no vibrator an attempt to vibrate was performed evne if not hardware support exists As a result no sound was played because the it was assumed a haptic feedback was provided. bug:7324903 Change-Id: Ic76db232d761a2899c1ca5f59ca55ff15ae575dd --- .../com/android/internal/policy/impl/PhoneWindowManager.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 9307f37b1bfe8..7e047fdfdf961 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -4302,6 +4302,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { } public boolean performHapticFeedbackLw(WindowState win, int effectId, boolean always) { + if (!mVibrator.hasVibrator()) { + return false; + } final boolean hapticsDisabled = Settings.System.getIntForUser(mContext.getContentResolver(), Settings.System.HAPTIC_FEEDBACK_ENABLED, 0, UserHandle.USER_CURRENT) == 0; if (!always && (hapticsDisabled || mKeyguardMediator.isShowingAndNotHidden())) {