Permalink
Browse files

audio: Add overlay to fix analog docks.

Of particular interest to devices using libhardware_legacy and
affected by commit 5a484b753cc72d6a50c1dd3bbf68b3403c741a3a: http://goo.gl/rVR1Z
which restricted the routing of AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET
to docks using FORCE_ANALOG_DOCK cases. The EXTRA_DOCK_STATE_CAR case is
returning FORCE_BT_CAR_DOCK, preventing the dock audio from routing properly.

Add an overlay option for overriding to FORCE_ANALOG_DOCK.

Change-Id: Ib7d70c242aa6f537ea5d65098ceb2c591662d8bb
  • Loading branch information...
1 parent 4384dfc commit 4ee668340cbdac6ccced68d10910f6120809cf1d @bbelos bbelos committed with Gerrit Code Review May 2, 2013
Showing with 21 additions and 2 deletions.
  1. +8 −0 core/res/res/values/config.xml
  2. +2 −0 core/res/res/values/symbols.xml
  3. +11 −2 media/java/android/media/AudioService.java
@@ -387,6 +387,14 @@
a car dock make the accelerometer more a physical input (like a lid). -->
<bool name="config_carDockEnablesAccelerometer">true</bool>
+ <!-- Control whether a desk dock event should override the default bluetooth
+ audio routing, FORCE_BT_DESK_DOCK, with an analog dock, FORCE_ANALOG_DOCK. -->
+ <bool name="config_forceAnalogDeskDock">false</bool>
+
+ <!-- Control whether a car dock event should override the default bluetooth
+ audio routing, FORCE_BT_CAR_DOCK, with an analog dock, FORCE_ANALOG_DOCK. -->
+ <bool name="config_forceAnalogCarDock">false</bool>
+
<!-- Indicate whether the lid state impacts the accessibility of
the physical keyboard. 0 means it doesn't, 1 means it is accessible
when the lid is open, 2 means it is accessible when the lid is
@@ -1220,6 +1220,8 @@
<java-symbol type="bool" name="config_disableMenuKeyInLockScreen" />
<java-symbol type="bool" name="config_enableLockBeforeUnlockScreen" />
<java-symbol type="bool" name="config_enableLockScreenRotation" />
+ <java-symbol type="bool" name="config_forceAnalogCarDock" />
+ <java-symbol type="bool" name="config_forceAnalogDeskDock" />
<java-symbol type="bool" name="config_lidControlsSleep" />
<java-symbol type="bool" name="config_reverseDefaultRotation" />
<java-symbol type="bool" name="config_showNavigationBar" />
@@ -446,6 +446,9 @@ public void onError(int error) {
private boolean mDockAudioMediaEnabled = true;
+ private boolean mForceAnalogDeskDock;
+ private boolean mForceAnalogCarDock;
+
private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;
private boolean mVolumeKeysControlRingStream;
@@ -570,6 +573,12 @@ public void onReceive(Context context, Intent intent) {
mMasterVolumeRamp = context.getResources().getIntArray(
com.android.internal.R.array.config_masterVolumeRamp);
+ mForceAnalogDeskDock = mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_forceAnalogDeskDock);
+
+ mForceAnalogCarDock = mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_forceAnalogCarDock);
+
mMainRemote = new RemotePlaybackState(-1, MAX_STREAM_VOLUME[AudioManager.STREAM_MUSIC],
MAX_STREAM_VOLUME[AudioManager.STREAM_MUSIC]);
mHasRemotePlayback = false;
@@ -3888,10 +3897,10 @@ public void onReceive(Context context, Intent intent) {
int config;
switch (dockState) {
case Intent.EXTRA_DOCK_STATE_DESK:
- config = AudioSystem.FORCE_BT_DESK_DOCK;
+ config = mForceAnalogDeskDock ? AudioSystem.FORCE_ANALOG_DOCK : AudioSystem.FORCE_BT_DESK_DOCK;
break;
case Intent.EXTRA_DOCK_STATE_CAR:
- config = AudioSystem.FORCE_BT_CAR_DOCK;
+ config = mForceAnalogCarDock ? AudioSystem.FORCE_ANALOG_DOCK : AudioSystem.FORCE_BT_CAR_DOCK;
break;
case Intent.EXTRA_DOCK_STATE_LE_DESK:
config = AudioSystem.FORCE_ANALOG_DOCK;

0 comments on commit 4ee6683

Please sign in to comment.