Loading services/core/java/com/android/server/notification/NotificationManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -3648,7 +3648,7 @@ public class NotificationManagerService extends SystemService { if (DBG) Slog.v(TAG, "Interrupting!"); Uri soundUri = record.getSound(); hasValidSound = (soundUri != null); hasValidSound = soundUri != null && !Uri.EMPTY.equals(soundUri); long[] vibration = record.getVibration(); // Demote sound to vibration if vibration missing & phone in vibration mode. if (vibration == null Loading services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java +20 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.server.notification; import static android.app.NotificationManager.IMPORTANCE_HIGH; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; Loading Loading @@ -198,7 +200,7 @@ public class BuzzBeepBlinkTest { boolean noisy, boolean buzzy, boolean lights, boolean defaultVibration, boolean defaultSound, boolean defaultLights) { NotificationChannel channel = new NotificationChannel("test", "test", NotificationManager.IMPORTANCE_HIGH); new NotificationChannel("test", "test", IMPORTANCE_HIGH); final Builder builder = new Builder(getContext()) .setContentTitle("foo") .setSmallIcon(android.R.drawable.sym_def_app_icon) Loading Loading @@ -680,6 +682,23 @@ public class BuzzBeepBlinkTest { verifyStopVibrate(); } @Test public void testEmptyUriSoundTreatedAsNoSound() throws Exception { NotificationChannel channel = new NotificationChannel("test", "test", IMPORTANCE_HIGH); channel.setSound(Uri.EMPTY, null); final Notification n = new Builder(getContext(), "test") .setSmallIcon(android.R.drawable.sym_def_app_icon).build(); StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, 0, mTag, mUid, mPid, n, mUser, null, System.currentTimeMillis()); NotificationRecord r = new NotificationRecord(getContext(), sbn, channel); mService.addNotification(r); mService.buzzBeepBlinkLocked(r); verifyNeverBeep(); } static class VibrateRepeatMatcher implements ArgumentMatcher<VibrationEffect> { private final int mRepeatIndex; Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -3648,7 +3648,7 @@ public class NotificationManagerService extends SystemService { if (DBG) Slog.v(TAG, "Interrupting!"); Uri soundUri = record.getSound(); hasValidSound = (soundUri != null); hasValidSound = soundUri != null && !Uri.EMPTY.equals(soundUri); long[] vibration = record.getVibration(); // Demote sound to vibration if vibration missing & phone in vibration mode. if (vibration == null Loading
services/tests/notification/src/com/android/server/notification/BuzzBeepBlinkTest.java +20 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ */ package com.android.server.notification; import static android.app.NotificationManager.IMPORTANCE_HIGH; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertNull; import static junit.framework.Assert.assertTrue; Loading Loading @@ -198,7 +200,7 @@ public class BuzzBeepBlinkTest { boolean noisy, boolean buzzy, boolean lights, boolean defaultVibration, boolean defaultSound, boolean defaultLights) { NotificationChannel channel = new NotificationChannel("test", "test", NotificationManager.IMPORTANCE_HIGH); new NotificationChannel("test", "test", IMPORTANCE_HIGH); final Builder builder = new Builder(getContext()) .setContentTitle("foo") .setSmallIcon(android.R.drawable.sym_def_app_icon) Loading Loading @@ -680,6 +682,23 @@ public class BuzzBeepBlinkTest { verifyStopVibrate(); } @Test public void testEmptyUriSoundTreatedAsNoSound() throws Exception { NotificationChannel channel = new NotificationChannel("test", "test", IMPORTANCE_HIGH); channel.setSound(Uri.EMPTY, null); final Notification n = new Builder(getContext(), "test") .setSmallIcon(android.R.drawable.sym_def_app_icon).build(); StatusBarNotification sbn = new StatusBarNotification(mPkg, mPkg, 0, mTag, mUid, mPid, n, mUser, null, System.currentTimeMillis()); NotificationRecord r = new NotificationRecord(getContext(), sbn, channel); mService.addNotification(r); mService.buzzBeepBlinkLocked(r); verifyNeverBeep(); } static class VibrateRepeatMatcher implements ArgumentMatcher<VibrationEffect> { private final int mRepeatIndex; Loading