When connecting two Android phones via a cable, how can I choose which phone is charging which phone? E.g. when I connected a Samsung Galaxy S9 (Android 10) with a Google Pixel 6 (Android 12) via a male-to-male USB-C cable, the Google Pixel 6 got charged.
Under USB preferences, whichever device has Charge connected device as enabled is charging the other device.
Snapshot from Pixel 4a (Android 12) connected to and charging One Plus 7 (Android 10)
And the reverse (One Plus charging Pixel)
If you want to switch charging when connected, toggle the switch on any device and the selection on the other device gets reversed.
Edit: To address the comments, charging cannot be switched off on both devices. I couldn't find any documentation around this.