Loading services/core/java/com/android/server/notification/NotificationManagerService.java +15 −3 Original line number Diff line number Diff line Loading @@ -305,6 +305,7 @@ public class NotificationManagerService extends SystemService { private RankingHandler mRankingHandler; private long mLastOverRateLogTime; private float mMaxPackageEnqueueRate = DEFAULT_MAX_NOTIFICATION_ENQUEUE_RATE; private String mSystemNotificationSound; private static class Archive { final int mBufferSize; Loading Loading @@ -817,6 +818,8 @@ public class NotificationManagerService extends SystemService { private final class SettingsObserver extends ContentObserver { private final Uri NOTIFICATION_LIGHT_PULSE_URI = Settings.System.getUriFor(Settings.System.NOTIFICATION_LIGHT_PULSE); private final Uri NOTIFICATION_SOUND_URI = Settings.System.getUriFor(Settings.System.NOTIFICATION_SOUND); private final Uri NOTIFICATION_RATE_LIMIT_URI = Settings.Global.getUriFor(Settings.Global.MAX_NOTIFICATION_ENQUEUE_RATE); Loading @@ -828,6 +831,8 @@ public class NotificationManagerService extends SystemService { ContentResolver resolver = getContext().getContentResolver(); resolver.registerContentObserver(NOTIFICATION_LIGHT_PULSE_URI, false, this, UserHandle.USER_ALL); resolver.registerContentObserver(NOTIFICATION_SOUND_URI, false, this, UserHandle.USER_ALL); resolver.registerContentObserver(NOTIFICATION_RATE_LIMIT_URI, false, this, UserHandle.USER_ALL); update(null); Loading @@ -851,6 +856,10 @@ public class NotificationManagerService extends SystemService { mMaxPackageEnqueueRate = Settings.Global.getFloat(resolver, Settings.Global.MAX_NOTIFICATION_ENQUEUE_RATE, mMaxPackageEnqueueRate); } if (uri == null || NOTIFICATION_SOUND_URI.equals(uri)) { mSystemNotificationSound = Settings.System.getString(resolver, Settings.System.NOTIFICATION_SOUND); } } } Loading Loading @@ -903,6 +912,11 @@ public class NotificationManagerService extends SystemService { mHandler = handler; } @VisibleForTesting void setSystemNotificationSound(String systemNotificationSound) { mSystemNotificationSound = systemNotificationSound; } @Override public void onStart() { Resources resources = getContext().getResources(); Loading Loading @@ -2869,9 +2883,7 @@ public class NotificationManagerService extends SystemService { soundUri = Settings.System.DEFAULT_NOTIFICATION_URI; // check to see if the default notification sound is silent ContentResolver resolver = getContext().getContentResolver(); hasValidSound = Settings.System.getString(resolver, Settings.System.NOTIFICATION_SOUND) != null; hasValidSound = mSystemNotificationSound != null; } else if (notification.sound != null) { soundUri = notification.sound; hasValidSound = (soundUri != null); Loading services/tests/servicestests/src/com/android/internal/util/FakeSettingsProviderTest.java +0 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import java.util.concurrent.TimeUnit; /** * Unit tests for FakeSettingsProvider. */ @Suppress public class FakeSettingsProviderTest extends AndroidTestCase { private MockContentResolver mCr; Loading services/tests/servicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ public class BuzzBeepBlinkTest extends AndroidTestCase { mService.setVibrator(mVibrator); mService.setSystemReady(true); mService.setHandler(mHandler); mService.setSystemNotificationSound("beep!"); } // Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +15 −3 Original line number Diff line number Diff line Loading @@ -305,6 +305,7 @@ public class NotificationManagerService extends SystemService { private RankingHandler mRankingHandler; private long mLastOverRateLogTime; private float mMaxPackageEnqueueRate = DEFAULT_MAX_NOTIFICATION_ENQUEUE_RATE; private String mSystemNotificationSound; private static class Archive { final int mBufferSize; Loading Loading @@ -817,6 +818,8 @@ public class NotificationManagerService extends SystemService { private final class SettingsObserver extends ContentObserver { private final Uri NOTIFICATION_LIGHT_PULSE_URI = Settings.System.getUriFor(Settings.System.NOTIFICATION_LIGHT_PULSE); private final Uri NOTIFICATION_SOUND_URI = Settings.System.getUriFor(Settings.System.NOTIFICATION_SOUND); private final Uri NOTIFICATION_RATE_LIMIT_URI = Settings.Global.getUriFor(Settings.Global.MAX_NOTIFICATION_ENQUEUE_RATE); Loading @@ -828,6 +831,8 @@ public class NotificationManagerService extends SystemService { ContentResolver resolver = getContext().getContentResolver(); resolver.registerContentObserver(NOTIFICATION_LIGHT_PULSE_URI, false, this, UserHandle.USER_ALL); resolver.registerContentObserver(NOTIFICATION_SOUND_URI, false, this, UserHandle.USER_ALL); resolver.registerContentObserver(NOTIFICATION_RATE_LIMIT_URI, false, this, UserHandle.USER_ALL); update(null); Loading @@ -851,6 +856,10 @@ public class NotificationManagerService extends SystemService { mMaxPackageEnqueueRate = Settings.Global.getFloat(resolver, Settings.Global.MAX_NOTIFICATION_ENQUEUE_RATE, mMaxPackageEnqueueRate); } if (uri == null || NOTIFICATION_SOUND_URI.equals(uri)) { mSystemNotificationSound = Settings.System.getString(resolver, Settings.System.NOTIFICATION_SOUND); } } } Loading Loading @@ -903,6 +912,11 @@ public class NotificationManagerService extends SystemService { mHandler = handler; } @VisibleForTesting void setSystemNotificationSound(String systemNotificationSound) { mSystemNotificationSound = systemNotificationSound; } @Override public void onStart() { Resources resources = getContext().getResources(); Loading Loading @@ -2869,9 +2883,7 @@ public class NotificationManagerService extends SystemService { soundUri = Settings.System.DEFAULT_NOTIFICATION_URI; // check to see if the default notification sound is silent ContentResolver resolver = getContext().getContentResolver(); hasValidSound = Settings.System.getString(resolver, Settings.System.NOTIFICATION_SOUND) != null; hasValidSound = mSystemNotificationSound != null; } else if (notification.sound != null) { soundUri = notification.sound; hasValidSound = (soundUri != null); Loading
services/tests/servicestests/src/com/android/internal/util/FakeSettingsProviderTest.java +0 −1 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ import java.util.concurrent.TimeUnit; /** * Unit tests for FakeSettingsProvider. */ @Suppress public class FakeSettingsProviderTest extends AndroidTestCase { private MockContentResolver mCr; Loading
services/tests/servicestests/src/com/android/server/notification/BuzzBeepBlinkTest.java +1 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ public class BuzzBeepBlinkTest extends AndroidTestCase { mService.setVibrator(mVibrator); mService.setSystemReady(true); mService.setHandler(mHandler); mService.setSystemNotificationSound("beep!"); } // Loading