In more recent versions of Android Studio .idea/deploymentTargetDropDown.xml will contain a list of possible targets, the most recently selected target, and the time at which it was selected
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<runningDeviceTargetSelectedWithDropDown>
<Target>
<type value="RUNNING_DEVICE_TARGET" />
<deviceKey>
<Key>
<type value="SERIAL_NUMBER" />
<value value="some_serial_number" />
</Key>
</deviceKey>
</Target>
</runningDeviceTargetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-02-22T12:03:45.955233Z" />
</component>
The same file is also stored in the settings directory
It seems like an implementation detail not to be relied on for anything mission critical, but is populated as soon as you make a selection, making it useful for deployment related scripts