Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f7021b5e authored by Chris Wren's avatar Chris Wren Committed by android-build-merger
Browse files

Merge \"use an observer for the default sound\" into nyc-mr1-dev

am: 4e4d325b

Change-Id: Iae7822d0e0282ac9be691a4f26dbc7f8751e02f9
parents 1481cd53 4e4d325b
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -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;
@@ -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);

@@ -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);
@@ -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);
            }
        }
    }

@@ -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();
@@ -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);
+0 −1
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import java.util.concurrent.TimeUnit;
/**
 * Unit tests for FakeSettingsProvider.
 */
@Suppress
public class FakeSettingsProviderTest extends AndroidTestCase {

    private MockContentResolver mCr;
+1 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ public class BuzzBeepBlinkTest extends AndroidTestCase {
        mService.setVibrator(mVibrator);
        mService.setSystemReady(true);
        mService.setHandler(mHandler);
        mService.setSystemNotificationSound("beep!");
    }

    //