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

Commit 55f4fc87 authored by StevenHarperUK's avatar StevenHarperUK
Browse files

Add Deskdock support to WiredAccessoryObserver

After discussion on XDA it appears that Samsung Desk Docks send a signal of 1.
Car Docs send a signal of 2

This change should work with Desk Docks now, routing the audio when the option is checked in the Dock Menu.

I have tested that no regression has occured - Car Dock audio is working.

Change-Id: Ie89a9a1c9738676188b53f9d6b22db92b6894b8c
parent 0a872611
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -151,14 +151,15 @@ class WiredAccessoryObserver extends UEventObserver {
                                         ((state == 2) ? BIT_USB_HEADSET_DGTL : 0)));
        } else if (name.equals("dock")) {
             switchState = ((mHeadsetState & (BIT_HEADSET|BIT_HEADSET_NO_MIC|BIT_HDMI_AUDIO)) |
                           ((state == 2) ? BIT_USB_HEADSET_ANLG : 0));
                           ((state == 2 || state == 1) ? BIT_USB_HEADSET_ANLG : 0));
            // This sets the switchsate to 4 (for USB HEADSET - BIT_USB_HEADSET_ANLG)
            // Looking at the other types, maybe the state that emitted should be a 1 and at 
            //       /devices/virtual/switch/usb_audio
            //
            // However the we need to deal with changes at
            //       /devices/virtual/switch/dock
            // for this the state of 2 - means that we have a USB ANLG headset
            // for the state of 2 - means that we have a USB ANLG headset Car Dock
            // for the state of 1 - means that we have a USB ANLG headset Desk Dock
        } else if (name.equals("hdmi")) {
            switchState = ((mHeadsetState & (BIT_HEADSET|BIT_HEADSET_NO_MIC|
                                             BIT_USB_HEADSET_DGTL|BIT_USB_HEADSET_ANLG)) |