The diagram and photo below show an audio loopback dongle for the headset connector that we call the "Dr. Rick O'Rang audio loopback dongle." The Chrome hardware team designed this circuit and plug for functional testing; however it has many other uses too. The Android audio team uses it to measure round-trip audio latency, via the Larsen effect (feedback loop).
Figure 1. circuit diagram
To ensure that the output signal will not overload the microphone input, we cut it down by about 20dB. The resistor loads tell the microphone polarity switch that the audio loopback dongle is a US/CTIA pinout Tip Ring Ring Shield (TRRS) plug.
Figure 2. Assembled