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

Commit 51ed9304 authored by Brian Beloshapka's avatar Brian Beloshapka Committed by Jessica Wagantall
Browse files

audio: Add overlay to fix analog docks.

Issue-Id: RM-170
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 f26009d4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -375,4 +375,9 @@

    <!-- Show WiFi activity indicators on signal bar -->
    <java-symbol type="bool" name="config_showWifiActivityIndicators" />

    <!-- Support Samsung docks -->
    <java-symbol type="bool" name="config_forceAnalogCarDock" />
    <java-symbol type="bool" name="config_forceAnalogDeskDock" />

</resources>
+8 −0
Original line number Diff line number Diff line
@@ -608,6 +608,10 @@
         we rely on gravity to determine the effective orientation. -->
    <bool name="config_deskDockEnablesAccelerometer">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>

    <!-- Car dock behavior -->

    <!-- The number of degrees to rotate the display when the device is in a car dock.
@@ -626,6 +630,10 @@

    <bool name="config_carDockEnablesAccelerometer">true</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>

    <!-- HDMI behavior -->

    <!-- The number of degrees to rotate the display when the device has HDMI connected
+12 −2
Original line number Diff line number Diff line
@@ -547,6 +547,9 @@ public class AudioService extends IAudioService.Stub {

    private boolean mDockAudioMediaEnabled = true;

    private boolean mForceAnalogDeskDock;
    private boolean mForceAnalogCarDock;

    private int mDockState = Intent.EXTRA_DOCK_STATE_UNDOCKED;

    // Used when safe volume warning message display is requested by setStreamVolume(). In this
@@ -653,6 +656,11 @@ public class AudioService extends IAudioService.Stub {
        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);

        // read this in before readPersistedSettings() because updateStreamVolumeAlias needs it
        mLinkNotificationWithVolume = Settings.Secure.getInt(mContext.getContentResolver(),
                Settings.Secure.VOLUME_LINK_NOTIFICATION, 1) == 1;
@@ -5172,10 +5180,12 @@ public class AudioService extends IAudioService.Stub {
                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;