Fwk: Only chime when docked and accessbility is on

Bug: 32036947

Change-Id: I5786abe827735cc3a4bc1d52baacaa19bccaae77
This commit is contained in:
Vinod Krishnan
2016-10-20 22:57:02 -07:00
parent be0eded075
commit cf11ceab65
4 changed files with 18 additions and 2 deletions

View File

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