Mirroring Sony XZ1 Compact on Car Screen
Mirroring Sony XZ1 Compact on car screen. This tutorial was written on 6.08.2022. Since this is a cat-and-mouse game with Google, certain apps may no longer work or work differently at a later date.
I want to use the display in my car (Skoda Octavia) to use and watch my preferred content. I want to see data from the ECU (Electronic Control Unit), stream videos and TV content and use applications from my NAS (e.g. Plex, Domotics, etc…). With this enhanced capability, the car display becomes a central element in terms of information and entertainment.
I understand that Google does not want this. The only thing that matters here is safety on the road. The more distracted you are, the greater the risk of an accident! And yes, I am definitely more distracted. In order not to be negligent here, I use Skoda’s automatic distance control while driving. But that doesn’t change the fact that the risk of an accident is still higher. Therefore it should be mentioned again at this point. If you use something like this, it is your responsibility. I hereby hold myself harmless!
If possible, your passenger should “mess around” with the car display.
In this video you can see the result of the planned project.
After a few years of experience with a Samsung S5 and S7, I wanted to use an even more performant and smaller device. I bought a second-hand smartphone for around 120 Euros. The choice fell on the Sony Xperia XZ1 Compact. The XZ1 Compact has a stronger processor than the S7 and is smaller – so requirements are met. I did not have any special wishes regarding the display (quality and resolution) and cameras because it is not relevant for the application. Btw, the display of the S7 is better than that of the XZ1 Compact.
I attach particular importance to the fact that all links point to the manufacturer pages or developer pages. And not any dubious sites, where you run the risk of getting a virus or are cluttered with unnecessary advertising.
Fundamentals and Prerequisites
Here you can find a step-by-step guide on how to unlock the bootloader of your XZ1 Compact and then root your XZ1 Compact.
XZ1 Compact Fastboot Mode vs. Recovery Mode vs. Flash Mode
You need to know these key combinations:
Volume Up + Power = Fastboot Mode (LED lights up blue)
Volume Down + Power = Recovery Mode AND/OR Flash Mode (LED lights up green)
Sony Flash Tool
You don’t need this part to root your device. If you have a boot loop or want to put another stock ROM version on your device, you can use the original tool from Sony. If you use Samsung, you know ODIN. Sony has their own flash tool. It is simple and works flawlessly:
Here you can find the manual from Sony:
In order to flash your XZ1 Compact, you have to enter Flash Mode (Volume Down + Power) after opening the Flash Tool. The LED should then light up green and your device will be recognized by the flash tool. The appropriate Windows drivers are installed during the installation of the Sony Flash Tool. So much for the theory.
ADB and Fastboot Preparation
Sounds simple, but it means you have all the drivers and ADB/Fastboot are working on your PC. If ADB and Fastboot don’t work, you don’t need to read any further. These are applications that are needed for rooting.
Either you use Minimal ADB tool or you have Google’s Android Studio installed. Android Studio has the advantage that you can later use DHU (Desktop Head Unit) and thus easily test Android Auto on the PC. Disadvantage of this method. Android Studio is extremely extensive. I.e. you have to invest a bit of time to understand what you can do with it. I use Android Studio and therefore have no experience with the Minimal ADB tool.
Regarding drivers. The eternal suffering with Windows and Device Manager! If not the right drivers are installed Fastboot does not work. It took me about 1 hour to get it to work.
Tip – Test if ADB command works
Execute the following command:
- adb devices
The result should look like this:
Tip – Check whether the “fastboot” command works:
To make sure that your PC or the XZ1 Compact understands fastboot, you have to enter the following command:
- Start your device in flash boot mode
Press and hold Volume Up. Plug in the USB cable. This will start the XZ1 Compact in flash boot mode.
Enter the following command in the Windows Console:
- fastboot devices
A device ID should then be displayed. If this is not the case (Unknown Device), fastboot does not work. At this point you have to make sure that you have installed the correct drivers properly! In other words: If the command “fastboot” does not work, you cannot unlock the bootloader. Without an unlocked bootloader, you cannot root the device.
If ADB and Fastboot are working, you have all requirements to unlock the bootloader.
You can request/query the device ID on this Sony page:
You will need the Device ID in the next step.
Follow the instructions on this page. It is the Sony Developer page. There you need to find and understand all the relevant info to unlock your bootloader:
Important! Once the bootloader is unlocked, this action cannot be undone. Sony has defined it this way.
For me the following commands for “unlock key” worked – should the commands described by Sony not work. “0x” must be in front of your ID:
- fastboot -i 0x0fce oem unlock 0xYOUR_ID
- fastboot flashing unlock
If everything worked, your device will show a warning message at startup – which is o.k.
Although I already have some experience with Samsung devices – I have rooted about 10 different Samsung devices, the preparation work (unlock bootloader for the XZ1 Compact) is very time-consuming compared to Samsung devices. Just getting the Windows drivers to work took me hours. Sure, if all tools, drivers and data are available, this process takes 5 minutes. But that’s really only possible if all the requirements described above are met.
Installing the Android SDK alone takes at least 30 minutes. So you can assume that you need about 2 to 3 hours time to complete these steps successfully. It took me 3 days to research, compile and test all this info.
Flash TWRP as Recovery
First download TWRP:
I renamed the file to twrp.img and enter the following command in fastboot mode:
- fastboot flash recovery twrp.img
Now you have TWRP in Recovery Boot. To test this, you can switch off the device and restart while pressing Volume Down + Power. Now TWRP should start.
Rooting Sony XZ1 Compact with Magisk
The bootloader on your device is unlocked and you have TWRP as recovery boot. With this, you have all the prerequisites to root your device with Magisk and then install your desired applications. Congratulations! 😊
IMPORTANT!!! This step drives me crazy and only through long research I found the solution. You have to use a Magisk version no higher than Magisk 20.4. For all versions above that, the car touchscreen will not work on AA Mirror/Screen2Auto/…!!!
Here the link to the original Magisk Version 20.4.:
If you know this, rooting is a piece of cake. Select Magisk ZIP in TWRP and install it. Et voilà, your device is now rooted! If you’re not sure, you can find some tutorials on YouTube on how to do it.
SuperSU didn’t work for me – no idea why. I didn’t spend too long on why it didn’t work though.
Done. Your XZ1 Compact is rooted! In the next chapters, I’ll describe how you can mirror your phone’s display to your car’s display AND operate it with your car’s touchscreen. Mirroring works by now without root BUT then the touchscreen of the car does not work. This is an absolute no go for me! I want to be able to operate everything via the car touchscreen.
I use the following apps. Of course, this may vary. I mention it because not all apps work in the latest version. I.e. I had to download an APK for some apps.
Netflix, Sky Go, Magenta TV, A1TV do not work. You don’t need to ask me, because I can’t offer a solution.
Apps to mirror the display:
- Android Auto (enable developer mode) – Google Play Store.
- AA Mirror (original version) – https://github.com/slashmax/AAMirror
- AA Tweaker (original version) – https://github.com/shmykelsa/AA-Tweaker
Configure Android Auto, AA Mirror and AA Tweaker
This is a science of its own! The good news, it works. The bad news, here I don’t describe the procedure and configuration. You can find enough info on the internet. In a nutshell:
Android Auto must be in developer mode and there the option “Unknown sources” must be activated.
AA Mirror – just try out the desired configurations. You can’t do much wrong.
AA Tweaker – Patch AA Mirror. I have also adjusted the Bluetooth setting. Everything else are gimmicks, so you can try it out yourself.
After patching, you will find AA Mirror in the Android Auto app list or you can select it on the car display. If you tap on it, you will see the mirrored phone display on the car display AND you can operate it with the car touchscreen. Goal achieved!
- Root Explorer – Google Play Store
- Torque Pro – Google Play Store
- Car Launcher Pro – Google Play Store
- Back Button – Google Play Store
- Tasker – Google Play Store
- Revanced – https://github.com/j-hc/revanced-magisk-module
- Amazon Prime Video (older version) – APK
- DREI TV (older version) – APK
- NFL Game Pass – Google Play Store
- PLEX (server running on Synology NAS) – Google Play Store
- DS Photo (DS Photo Server running on Synology NAS) – Google Play Store
- DS CAM (Synology Surveillance running on NAS) – Google Play Store
- OpenVPN (Server running on Synology NAS) – Google Play Store
- CamSam Pro – Google Play Store
- Traccar Client (Server running on Synology NAS) – Google Play Store
- Domotics Premium (Domotics server running on Synology NAS) – Google Play Store
PLEX, Domotics, Traccar, … all run on my Synology NAS. This is what the mirrored display looks like with Car Launcher Pro and the various apps listed above.
Boot Device When Charging With USB
IMPORTANT!! This is a guide for Sony devices!!! It does not work like this for Samsung or other manufacturers!!!!
This point is only interesting for those who want the device to turn on when there is power through the USB cable. For me quite important, because the device stays in the car and should switch on when I am in the car. Switching off is done via Tasker -> if e.g. no power is present anymore. So I don’t have to care about anything. Device switches on automatically and off automatically 😊
To bring it to the point. Under /vendor/bin you have to delete the file chargemon. Sounds simple, it is. Just finding this info alone took me hours 😉
Caution. You need root privileges to access the /vendor/bin folder. I use root explorer for that.
Here is the link to the post:
I went in the /system/bin folder and deleted the chargemon file, this works for me (xperia ray). The phone now boots when I plug in the charger.
(Make sure to backup the chargemon file before deleting it, in case this doesn’t work.)
Thank you!! For my Sony Xperia XZ1 device it worked, but the file was in /vendor/bin folder instead of /system/bin
GPS Signal Strength
Basically a banal topic. When using a cell phone, we are used to the GPS signal being found quickly and reliably. In my first configuration (XZ1 phone connected via WLAN – no SIM card in the phone), I had the effect that the GPS signal was not found at all or after a long wait. This is of course especially annoying because Google Maps is one of the main applications in the car. I tried different solutions from the net, but did not find a satisfactory solution. By chance, I decided that my car phone gets its own SIM card and the GPS signal strength problem was solved. Apparently this is due to the fact that the cell phone towers transmit additional position data and thus quickly enough position data is available.
Now some of you will surely ask, what about the security of the SIM card? Yes, this SIM card does not have a security PIN! It is a data card and I can strongly restrict the functionalities of the card via APP (from my mobile provider). E.g. No 0800/0900 numbers, no calls abroad, roaming disabled, etc… Apart from that, I can lock the card with the app. So if my car incl. the phone with the SIM card is stolen, I can immediately lock the SIM – apart from that, I have then another problem 😉
Anyway, GPS signal is good and thus problem solved!
Testing with DHU (Desktop Head Unit)
If you have the Android SDK installed, you can test Android Auto with DHU on your PC. I find this great and much more comfortable than going into the car every time. Downside: Once again, it took me a bit of time to get it up and running. It’s really just a matter of installing and configuring the apps from here on out.
The prerequisite is the Android Studio:
Here is the link to Google instructions:
As said, the whole thing has to be downloaded and installed once. Some patience is therefore necessary!
Caution or look carefully! Which version is installed or do you want to install. When installing the Android Studio was the DHU version 1.1 installed. I have installed the DHU version 2.0 rc2 afterwards. Now both versions are running.
Commands – follow the Google instructions:
- adb devices
At this point you have to change to the right directory = SDK_Location -> path where you installed the Android SDK
- SDK_Location\extras\google\auto>adb forward tcp:5277 tcp:5277
Version 2.0 rc2:
- desktop-head-unit -c SDK_Location\extras\google\auto\config\default.ini
When you connect the smartphone to the PC for the first time, the PC does not recognize the smartphone immediately. You have to stop and restart the Android Auto server (server for infotainment system). This can sometimes be necessary up to three times. But after that it should work!
This is something for the geeks among you. For example, if you want to watch TV content abroad, it won’t work because the TV content provider requires a regional IP address. If you are abroad and start the TV app you will get an error message or the hint that the content can only be viewed in your country of origin. I use the OpenVPN client and get the IP address from my home. The VPN server is running on my Synology NAS.
How I solved the mirroring with a Samsung S7, you can find in this post: