Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

When in vibrate mode, all notifications will vibrate.

(Unless the notification specifies no ringtone AND no
vibration, in which case it will remain silent.)

Bug: 7516358
Change-Id: I926d0fe0165b9622cd117e6c3ef6e3637772b444
  • Loading branch information...
commit 4c0fc03b5ed396d19035ee6a77a70189a0fba31a 1 parent 85abb08
Daniel Sandler dsandler authored
Showing with 10 additions and 1 deletion.
  1. +10 −1 services/java/com/android/server/NotificationManagerService.java
11 services/java/com/android/server/NotificationManagerService.java
View
@@ -1086,8 +1086,17 @@ public void enqueueNotificationInternal(String pkg, int callingUid, int callingP
}
// vibrate
+ // new in 4.2: if there was supposed to be a sound and we're in vibrate mode,
+ // we always vibrate, even if no vibration was specified
+ final boolean convertSoundToVibration =
+ notification.vibrate == null
+ && (useDefaultSound || notification.sound != null)
+ && (audioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE);
+
final boolean useDefaultVibrate =
- (notification.defaults & Notification.DEFAULT_VIBRATE) != 0;
+ (notification.defaults & Notification.DEFAULT_VIBRATE) != 0
+ || convertSoundToVibration;
+
if ((useDefaultVibrate || notification.vibrate != null)
&& !(audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT)) {
mVibrateNotification = r;

1 comment on commit 4c0fc03

arkguil

This code does not work as intended. See the following Issue which describe the problem. 500+ votes.

https://code.google.com/p/android/issues/detail?id=39592

Please sign in to comment.
Something went wrong with that request. Please try again.