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

Commit 4ee66834 authored by Brian Beloshapka's avatar Brian Beloshapka Committed by Gerrit Code Review
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
parent 4384dfcc
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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
+2 −0
Original line number Diff line number Diff line
@@ -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" />
+11 −2
Original line number Diff line number Diff line
@@ -446,6 +446,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished {

    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 class AudioService extends IAudioService.Stub implements OnFinished {
        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 class AudioService extends IAudioService.Stub implements OnFinished {
                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;