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

Commit f08de588 authored by Emilio López's avatar Emilio López
Browse files

Implement hack to enable audio thru docks on Motorola phones

This allows us to pass a routing parameter to io 1 while sending
the DockState parameter to io 0 simultaneously. This is required
to enable the correct audio routing when docking/undocking and
allows audio on docks to work when combined with the DockAudio
package.

Change-Id: I23778887c4534c0e607d6fc9795e509f098d9016
parent 824fd90c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -30,4 +30,8 @@ LOCAL_STATIC_LIBRARIES := \

LOCAL_MODULE:= libaudioflinger

ifeq ($(BOARD_USE_MOTO_DOCK_HACK),true)
   LOCAL_CFLAGS += -DMOTO_DOCK_HACK
endif

include $(BUILD_SHARED_LIBRARY)
+14 −0
Original line number Diff line number Diff line
@@ -779,7 +779,21 @@ status_t AudioFlinger::setParameters(int ioHandle, const String8& keyValuePairs)
                mBtNrecIsOff = btNrecIsOff;
            }
        }

#ifdef MOTO_DOCK_HACK
        String8 key = String8("DockState");
        int device;
        if (NO_ERROR != param.getInt(key, device)) {
            LOGD("setParameters(): DockState not present");
            return final_result;
        } else {
            /* We also need to pass routing=int */
            ioHandle = 1;
            LOGD("setParameters(): DockState %d trick done!", device);
        }
#else
        return final_result;
#endif
    }

    // hold a strong ref on thread in case closeOutput() or closeInput() is called