USB pass through charging is done with power delivery communications. You would need to have a dual role port facing towards your phone. What happens, depends on what your device is doing at the moment.
Your device has no external power supply and connects as an upstream facing device
You wait for the phone to send its PD profiles and pick the 5V profile with the current your device requires. If extra associates are connected, you increase the current requested, and sending a capabilities mismatch if you need more power. (after which the phone asks you how much you really need)
Your device has external power and the initial port negotiates in an downstream facing configuration
In this case, you first read the able properties, then send a power delivery profile based on your power from the upstream power supply. You also request PD fast role swap, so you can quickly swap power if the power supply gets unplugged. (this will typically cause the other device to take over vcon power) Then the last step is sending a data role swap packet.
Your device has external power and the initial port negotiates in an upstream facing configuration
After the phone has send its source power delivery protocols, you request the first one at 0A current. You then ask for a vcon swap, and once accepted, you start powering vcon. You can then read the SOP' marker to se if the cable is 5A capable and EPR capable. Now that you know this, you can request a power role swap, an after that, you send your source power delivery packets, while also indicating you want to use PD fast role swap. The other device typically takes over vcon in response.
You are providing power to the other device and your own power fails
You directly send the PD fast role swap signal over the cable (typically via a dedicated chip instead of a slow microcontroller) The other side act fasts an provides VBUS once it drops to 5V, at the current you earlier indicated in your earlier request.