Record and play sound from Android to a computer - Jack disconnects periodically / Jack undetected - Depending on Android version I would like to control audio IO of my android phone with a computer. I'm currently using a usb audio sound card with a input mic and line output ports connected to my computer. A phone is connected to an adapter jack 4 pins to 2 jack 3 pins (reference). The adapters mic input is connected to the sound card line output and the adapters line output is connected to the sound card mic input. Like this, I can theoretically record phones output with the computer and play a sound on phones input from the computer.
I have with me 3 phones devices, one android 10 (Redmi Note Pro 8) an other one is a android 9 (Samsung Galaxy A40), the last one is an android 4.0.3 (LG p700)
Everything works fine on the 4.0.3. The phone can detect the cable and I can record the phone output and play on the phone input.
But on the two others devices, it's not working.
On Android 9 : the phone can't detect the jack cable of the adapter, but when I plug earphones with mic (jack 4 pins), it's working. I think that isn't an hardware issue.
On  Android 10 : the phone can detect the cable but changes state every seconds (detected/undetected). That means it is switching between earphone output and speaker output which is impossible to record or play. Like android 9, i can plug earphones, and it's working.
I personally think this may be related to phone impedance that is checked by recent version of Android.
What should I do to record and play on audio IO of a phone from a computer?
It's possible to me to develop an app on android and create a program on the computer to initialize the connection. Stereo recording isn't the objective here, mono will be enough.
(I cannot use in my case other protocol like USB or Bluetooth to record and play on phones)
EDIT 1 : Concerning OMTP/CTIA standards
To know the standard used by each device, I did this experimentation. On my previous setup, I’m able to find that it is a CTIA standard (found with an ohm-meter, mic and output line are separated). I know then my Android 4.0.3 is working with a CTIA standard.
I have with me wires, a sound card (reference), and jack 4 pin to wires adapters (reference) (the adapters are respecting OMTP standard but we don't care because we are using 2 of them)
Firstly, I created a normal DIY setup 
This setup works fine for the Android 4.0.3. Then i guess my sound card is a CTIA standard. But unbelievably, it works fine with Android 9, and don't work with Android 10.
Now, I know that my sound card, Android 4 and Android 9 are all CTIA standard
Secondly, I decided to create a crossover cable setup. Like this, I will force an OMTP standard with a CTIA sound card.

As expected, this setup do not work on Android 4 and Android 9. But on Android 10, an headset without mic is detected. But I'm unable to listen/play a sound on the device. When I'm switching cable side on Android 10, the headset is periodically connecting/disconnecting like with the first setup (before edit).
To conclude, I guess that my issue isn't related to OMTP/CTIA but to the protocol used by devices to find plugged headset. With the Android 4, the jack port contains a little switch to know when a cable is plugged. On the others devices, this switch is present but do not have a direct impact on the detection of a headset. I guess the switch are used to launch a program that could detect the type of the audio device plugged (headset with mic, headset without mic...)
Ok, after many attempts, I have found where the problem lies.
TRRS is respecting a standard of electrical impedance.

This standard isn't respected by sounds cards, impedances were highly different.
I tried to simulate an headset only by using resistors.

This jack is detected as headset on all my devices (Android 4.0.3, Android 9 and Android 10).
I found that the impedances are used here to find the type of headphones (TRRS or TRS), when the type is unknown, each phone acts differently. In old version, the audio port is enabled. In newer version, it's disabled.
Another info : depending of the usb connection of the phone and the sound card, noise could appear in the signal. This noise can be high enough to avoid its use.
To conclude :
In my case, I'm unable to create an electronical component that would take out the signal and send it to a jack. I created a solution that could record the signal from Bluetooth.