I have a set of phones that have dual SIM cards. What I would like to do is have them connected to one network using SIM card 1, run some test, disconnect from the network, then have them connect to a second network using SIM card 2. Is there a way to do this through ADB? Preferably without root access, but if that's not possible, then with root access is okay.
This post didn't get much attention, so I don't know if it's worth posting the answer, but I did find a solution.
I didn't know when posting this that the solution is dependent on the version of Android. In my case, the phones have Android 9 (Pie).
The command that I found to turn on/off SIM cards is:
adb shell service call phone 180 i32 X i32 Y
where X is the SIM card number (1 and 2, in my case) and Y is 1 for enable and 0 for disable.
If anyone is interested, I found the solution by digging through source code on android.googlesource.com. Once I found the interface for ITelephony (it was a .aidl file), I had to count the functions, because the number 180 in the command meant the 180th function in that file. I also derived the arguments i32 X i32 Y from the arguments to that function. The answer here helped me a ton: https://stackoverflow.com/questions/20227326/where-to-find-info-on-androids-service-call-shell-command.