Merge "Ensure Notification re-post with setOnlyAlertOnce(true) silences sound."
This commit is contained in:
@@ -4081,6 +4081,8 @@ public class NotificationManagerService extends SystemService {
|
|||||||
|
|
||||||
buzz = playVibration(record, vibration, hasValidSound);
|
buzz = playVibration(record, vibration, hasValidSound);
|
||||||
}
|
}
|
||||||
|
} else if ((record.getFlags() & Notification.FLAG_INSISTENT) != 0) {
|
||||||
|
hasValidSound = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,6 +191,11 @@ public class BuzzBeepBlinkTest extends NotificationTestCase {
|
|||||||
true /* noisy */, false /* buzzy*/, false /* lights */);
|
true /* noisy */, false /* buzzy*/, false /* lights */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private NotificationRecord getInsistentBeepyOnceNotification() {
|
||||||
|
return getNotificationRecord(mId, true /* insistent */, true /* once */,
|
||||||
|
true /* noisy */, false /* buzzy*/, false /* lights */);
|
||||||
|
}
|
||||||
|
|
||||||
private NotificationRecord getInsistentBeepyLeanbackNotification() {
|
private NotificationRecord getInsistentBeepyLeanbackNotification() {
|
||||||
return getLeanbackNotificationRecord(mId, true /* insistent */, false /* once */,
|
return getLeanbackNotificationRecord(mId, true /* insistent */, false /* once */,
|
||||||
true /* noisy */, false /* buzzy*/, false /* lights */);
|
true /* noisy */, false /* buzzy*/, false /* lights */);
|
||||||
@@ -498,6 +503,24 @@ public class BuzzBeepBlinkTest extends NotificationTestCase {
|
|||||||
verifyNeverStopAudio();
|
verifyNeverStopAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests the case where the user re-posts a {@link Notification} with looping sound where
|
||||||
|
* {@link Notification.Builder#setOnlyAlertOnce(true)} has been called. This should silence
|
||||||
|
* the sound associated with the notification.
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testNoisyOnceUpdateDoesCancelAudio() throws Exception {
|
||||||
|
NotificationRecord r = getInsistentBeepyNotification();
|
||||||
|
NotificationRecord s = getInsistentBeepyOnceNotification();
|
||||||
|
s.isUpdate = true;
|
||||||
|
|
||||||
|
mService.buzzBeepBlinkLocked(r);
|
||||||
|
mService.buzzBeepBlinkLocked(s);
|
||||||
|
|
||||||
|
verifyStopAudio();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testQuietUpdateDoesNotCancelAudioFromOther() throws Exception {
|
public void testQuietUpdateDoesNotCancelAudioFromOther() throws Exception {
|
||||||
NotificationRecord r = getBeepyNotification();
|
NotificationRecord r = getBeepyNotification();
|
||||||
|
|||||||
Reference in New Issue
Block a user