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

Commit ed70e2f0 authored by Steve Kondik's avatar Steve Kondik
Browse files

Merge branch 'notification-speaker-setting' of...

Merge branch 'notification-speaker-setting' of http://github.com/zewt/android_frameworks_base into eclair
parents d412c88b 7b7f825e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1184,6 +1184,13 @@ public final class Settings {
        public static final String NOTIFICATIONS_USE_RING_VOLUME =
            "notifications_use_ring_volume";

	/**
	 * Whether notification sounds are always sent to the speaker, even if
	 * headphones are plugged in.
	 * @hide
	 */
        public static final String NOTIFICATIONS_TO_SPEAKER = "notifications_to_speaker";

        /**
         * The mapping of stream type (integer) to its setting.
         */
+16 −0
Original line number Diff line number Diff line
@@ -80,6 +80,19 @@ class ServerThread extends Thread {
        }
    }

    private class NotificationSettingsObserver extends ContentObserver {
        public NotificationSettingsObserver() {
            super(null);
        }
        @Override
        public void onChange(boolean selfChange) {
            boolean enabled = (Settings.System.getInt(mContentResolver,
                Settings.System.NOTIFICATIONS_TO_SPEAKER, 1) > 0);
            Log.i(TAG, "Settings.System.NOTIFICATIONS_TO_SPEAKER " + enabled);
           SystemProperties.set("persist.sys.speaker-notif", enabled ? "1" : "0");
        }
    }
    
    @Override
    public void run() {
        EventLog.writeEvent(LOG_BOOT_PROGRESS_SYSTEM_RUN,
@@ -383,6 +396,9 @@ class ServerThread extends Thread {
	mContentResolver.registerContentObserver(Settings.Secure.getUriFor(Settings.Secure.COMPCACHE_ENABLED),
        		false, new CompcacheSettingsObserver());

        mContentResolver.registerContentObserver(Settings.System.getUriFor(Settings.System.NOTIFICATIONS_TO_SPEAKER),
                        false, new NotificationSettingsObserver());
 
        // Before things start rolling, be sure we have decided whether
        // we are in safe mode.
        final boolean safeMode = wm.detectSafeMode();