This is the same as this question from 2016 (where the answer was basically: 'No'), but Android Auto since 2019 works very differently than it did 2016, so i think it is ok to ask again:
Android Auto basically gives you the ability to project app content to a car's head unit, and work with the input the user generates there. The DHU (Desktop Head Unit) is an emulator that lets a desktop computer emulate the behavior of a real head unit (for instance translating the workings of a physical dial to keyboard shortcuts, getting fake audio input from .wav files, etc) - The material that i read always assumes that you plug a phone with your app into the computer running the DHU. I would like to have it all on one computer - is it possible to connect a virtualized phone, running the app under test on the same computer as the DHU?
I managed to have a purely emulator-based android-auto env. It was... somehow painful but it worked.
In order:
sdkmanager 'extras;google;auto'
system-images;android-33;google_apis_playstore;x86_64
.adb install PATH_TO_FILE
adb forward tcp:5277 tcp:5277
$ANDROID_SDK_ROOT/extras/google/auto/desktop-head-unit
Plus: if you are running linux and wayland you have to run dhu using xwayland, to do that you need to set an environmental variable before the previous step:
SDL_VIDEODRIVER=x11 $ANDROID_SDK_ROOT/extras/google/auto/desktop-head-unit
Find below some print screens for helping finding things on emulator and the final victorius, glorious and spectacular dhu finally running: