It works such you toggle the Pinx (output) from 1 to 0.
That opens the Q1 for
time t = aprox R3 * C1.
During that time you have to provide ADC. As it takes say 1us for STM32, you may try with
R3 = 10k C1 = 4n7-10n
to get t = say 100usecs. You may try even smaller t. The goal is to get the smallest t while the measured ADCin is still stable/precise.
After the measurement you do nothing, the C1 discharges, Q1 will be closed and Vxx and the Divider (say 9k/1k) will be switched off from MCU. No current drained.
Good if you want to measure Vxx = 3V on a CRxxxx coin battery from time to time.. Or something like that.
PS: mind the t changes with Vxx a little bit. You need a logic Q1 pmosfet with lowest level threshold, ie. 1.5V.
Below simulation: it took 1usecs to get the ADC Vin stable. And it lasts for 30usecs stable. You do ADC there. R4 and C2 are parasitic for simulation only.
I do not have such low threshold logic level Pmosfet model for simulation, so I used power mosfet instead (not good, it has high threshold voltage and big gate capacitance).
And the situation with 30V Vxx, and the divider 9k/1k.
As you can see from that picture:
1. the turquoise blue transitor's Gate-Source voltage decreases by the (-)5V difference created by the 1->0 pulse at Pinx (green). For that Pmos it means it "opens" itself as the pulse peak is higher than its G-S threshold voltage.
2. the yellow voltage at the ADC's input is 3V. It lasts for ~40us stable. Enough time to measure.
So the whole measurement process you load the Vxx with the Divider (and capacitive C1 current) could be for example 5usecs (with a smaller R3 or C1, toggle Pinx, wait 1usecs till ADC voltage stabilize, do ADC in 1us..). Needs to be elaborated in real life, however
3. during the time Vxx is connected to and the ADC's input voltage is stable it takes 3.5mA off the Vxx, 200usecs from the start the Vxx current drops to 80uA, after 1.5ms the Vxx current reaches 7nA..
PS: from that picture you may see the threshold voltage of the pmosfet used in the simulation is about -3V. Therefore that transitor will most probably not work with 3.3V 1->0 Pinx pulse. You need a pmosfet with "logic level threshold" - those are 1.2-1.5V threshold transistors to work with 3.3V levels. Consult your datasheets.
And the ADC input voltage at the beginning of the cycle and after 40usecs.