diff options
author | Brandon Maxwell <maxwelb@google.com> | 2016-02-26 01:06:05 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-02-26 01:06:05 +0000 |
commit | a7260e240b381846209cbe14f0850dccffba4170 (patch) | |
tree | c6310fad62c3b477afdffcd14030d682c0babf14 /InCallUI/src/com | |
parent | d0f98e61727f94385414c076157609af5732d895 (diff) | |
parent | 5ec71527e2d6ed4c24e21a99ac7e820df68b7362 (diff) |
Merge "Respect setting for incoming call to vibrate" into nyc-dev am: 0eeee8b2e0
am: 5ec71527e2
* commit '5ec71527e2d6ed4c24e21a99ac7e820df68b7362':
Respect setting for incoming call to vibrate
Diffstat (limited to 'InCallUI/src/com')
-rw-r--r-- | InCallUI/src/com/android/incallui/StatusBarNotifier.java | 4 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index 1a4ec0935..315c0d0ae 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -315,7 +315,9 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, audioAttributes.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC); audioAttributes.setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE); notification.audioAttributes = audioAttributes.build(); - notification.vibrate = VIBRATE_PATTERN; + if (mDialerRingtoneManager.shouldVibrate(mContext.getContentResolver())) { + notification.vibrate = VIBRATE_PATTERN; + } } if (mDialerRingtoneManager.shouldPlayCallWaitingTone(callState)) { Log.v(this, "Playing call waiting tone"); diff --git a/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java b/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java index 38b37a263..3803a3e9a 100644 --- a/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java +++ b/InCallUI/src/com/android/incallui/ringtone/DialerRingtoneManager.java @@ -18,7 +18,9 @@ package com.android.incallui.ringtone; import com.google.common.base.Preconditions; +import android.content.ContentResolver; import android.net.Uri; +import android.provider.Settings; import android.support.annotation.Nullable; import com.android.contacts.common.compat.CompatUtils; @@ -70,6 +72,17 @@ public class DialerRingtoneManager { } /** + * Determines if an incoming call should vibrate as well as ring. + * + * @param resolver {@link ContentResolver} used to look up the + * {@link Settings.System#VIBRATE_WHEN_RINGING} setting. + * @return {@code true} if the call should vibrate, {@code false} otherwise. + */ + public boolean shouldVibrate(ContentResolver resolver) { + return Settings.System.getInt(resolver, Settings.System.VIBRATE_WHEN_RINGING, 0) != 0; + } + + /** * The incoming callState is never set as {@link State#CALL_WAITING} because * {@link Call#translateState(int)} doesn't account for that case, check for it here */ |