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

Commit 088f73a9 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fwk: Only chime when docked and accessbility is on" into cw-f-dev

parents 243e9668 cf11ceab
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -6862,6 +6862,12 @@ public final class Settings {
         */
        public static final String DOCK_SOUNDS_ENABLED = "dock_sounds_enabled";

        /**
         * Whether to play a sound for dock events, only when an accessibility service is on.
         * @hide
         */
        public static final String DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY = "dock_sounds_enabled_when_accessbility";

        /**
         * URI for the "device locked" (keyguard shown) sound.
         * @hide
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@
    <integer name="def_power_sounds_enabled">1</integer>
    <string name="def_low_battery_sound" translatable="false">/system/media/audio/ui/LowBattery.ogg</string>
    <integer name="def_dock_sounds_enabled">0</integer>
    <integer name="def_dock_sounds_enabled_when_accessibility">0</integer>
    <string name="def_desk_dock_sound" translatable="false">/system/media/audio/ui/Dock.ogg</string>
    <string name="def_desk_undock_sound" translatable="false">/system/media/audio/ui/Undock.ogg</string>
    <string name="def_car_dock_sound" translatable="false">/system/media/audio/ui/Dock.ogg</string>
+2 −0
Original line number Diff line number Diff line
@@ -2662,6 +2662,8 @@ class DatabaseHelper extends SQLiteOpenHelper {
                    R.string.def_low_battery_sound);
            loadIntegerSetting(stmt, Settings.Global.DOCK_SOUNDS_ENABLED,
                    R.integer.def_dock_sounds_enabled);
            loadIntegerSetting(stmt, Settings.Global.DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY,
                    R.integer.def_dock_sounds_enabled_when_accessibility);
            loadStringSetting(stmt, Settings.Global.DESK_DOCK_SOUND,
                    R.string.def_desk_dock_sound);
            loadStringSetting(stmt, Settings.Global.DESK_UNDOCK_SOUND,
+9 −2
Original line number Diff line number Diff line
@@ -167,10 +167,17 @@ final class DockObserver extends SystemService {
            intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
            intent.putExtra(Intent.EXTRA_DOCK_STATE, mReportedDockState);

            boolean dockSoundsEnabled = Settings.Global.getInt(cr,
                    Settings.Global.DOCK_SOUNDS_ENABLED, 1) == 1;
            boolean dockSoundsEnabledWhenAccessibility = Settings.Global.getInt(cr,
                    Settings.Global.DOCK_SOUNDS_ENABLED_WHEN_ACCESSIBILITY, 1) == 1;
            boolean accessibilityEnabled = Settings.Secure.getInt(cr,
                    Settings.Secure.ACCESSIBILITY_ENABLED, 0) == 1;

            // Play a sound to provide feedback to confirm dock connection.
            // Particularly useful for flaky contact pins...
            if (Settings.Global.getInt(cr,
                    Settings.Global.DOCK_SOUNDS_ENABLED, 1) == 1) {
            if ((dockSoundsEnabled) ||
                   (accessibilityEnabled && dockSoundsEnabledWhenAccessibility)) {
                String whichSound = null;
                if (mReportedDockState == Intent.EXTRA_DOCK_STATE_UNDOCKED) {
                    if ((previousDockState == Intent.EXTRA_DOCK_STATE_DESK) ||