diff options
author | Santos Cordon <santoscordon@google.com> | 2014-12-18 12:06:22 -0800 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2014-12-18 12:08:22 -0800 |
commit | 1b4b81431922b7546cbf7876e2b98e150a19baff (patch) | |
tree | 5daecd60779a3c00999b0729b5988fec34981816 /InCallUI | |
parent | a6e15ec2ca6b134c412d50c2a2032e7f547b20e3 (diff) |
Add haptic vibration feedback on in-call buttons.
For buttons which appear an first-class actions in the in-call screen,
add haptic feedback. This feedback ignores the system settings, meaning
that it vibrates when buttons are touched regardless of the system
settings for vibrating on keypress.
Bug: 18388068
Change-Id: Ifadc973af9bcdfdfdc9d51b1c927b08d93714a58
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallButtonFragment.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java index 0bfcc80c2..5c67862fc 100644 --- a/InCallUI/src/com/android/incallui/CallButtonFragment.java +++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java @@ -27,6 +27,7 @@ import android.graphics.drawable.StateListDrawable; import android.os.Bundle; import android.telecom.AudioState; import android.view.ContextThemeWrapper; +import android.view.HapticFeedbackConstants; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -152,6 +153,7 @@ public class CallButtonFragment int id = view.getId(); Log.d(this, "onClick(View " + view + ", id " + id + ")..."); + boolean isClickHandled = true; switch(id) { case R.id.audioButton: onAudioButtonClicked(); @@ -197,9 +199,16 @@ public class CallButtonFragment mOverflowPopup.show(); break; default: + isClickHandled = false; Log.wtf(this, "onClick: unexpected"); break; } + + if (isClickHandled) { + view.performHapticFeedback( + HapticFeedbackConstants.VIRTUAL_KEY, + HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING); + } } public void updateColors() { |