In this tutorial, you will learn how to enable Camera2 API on Xiaomi Mi A2 and Mi A2 Lite without root. Once enabled, you can download ports of various versions of the Google Camera app from below and install it on your phone.
In the past few years, Google Camera (GCam) Port from Pixel devices has gained immense popularity. But it is not just known for the amazing and latest features, it also enhances the camera quality and allows you to take great pictures using AI software. It is, in several ways, better than the stock camera app that comes pre-installed on the phone.
But in order to install Google Camera Port, you must first enable Camera2 API on your Xiaomi Mi A2/A2 Lite. Even though Xiaomi phones run the stock Android software, they still do not support Camera2 API officially. It’s easy to enable it when your phone is rooted, by editing the build.prop file manually or using a Magisk module.
But if your phone is not rooted, you will need to follow a different approach. And this guide will take you through the same. So, just follow the instructions below to first enable Camera2 API without root and then install Google Camera Port on Xiaomi Mi A2/A2 Lite.
Download Patched Boot Image
Here, we have provided Magisk Patched Boot Images for Mi A2 and Mi A2 Lite to temporarily root it. We have also provided stock boot images for the corresponding firmware, to help you unroot if you mistakenly flash the image.
Updated on March 23, 2020: Patched Boot and Stock Boot Images of March 2020 update for Xiaomi Mi A2 is now available. These have been patched with the latest version of Magisk.
For Mi A2 (jasmine_sprout)
- V188.8.131.52.QDIMIXM (March 2020 Security Update) – Huge thanks to 4KhadaJhin4!
- V184.108.40.206.QDIMIXM (January 2020 Update)
- V220.127.116.11.QDIMIXM (Android 10 update) – Huge thanks to Nicola for sharing these!
- V10.0.18.0.PDIMIXM (December 2019 Update)
- V10.0.17.0.PDIMIXM (November 2019 Update)
- V10.0.16.0.PDIMIXM (October 2019 Update)
- V10.0.15.0.PDIMIXM (October 2019 Update)
- V10.0.14.0.PDIMIXM (September 2019 Update)
- V10.0.13.0.PDIMIXM (Huge thanks to Nebrassy for uploading and Kevin for sharing these with us!)
- V10.0.8.0.PDIMIXM (Thanks to XDA Senior Member ThaiDai)
- V10.0.4.0.PDIMIXM (Huge thanks to XDA Senior Member minnuss!)
Huge thanks to Nicola Bontempelli for providing patched boot images for the Mi A2.
For Mi A2 Lite (daisy)
- V10.0.20.0.PDLMIXM (Android Pie-based March 2020 Update)
- V18.104.22.168.QDLMIXM (Android 10 Update – Recalled)
- V10.0.18.0.PDLMIXM (January 2020 Update)
- V10.0.17.0.PDLMIXM (December 2019 Update) – Credits: XDA Senior Member a1291762
- V10.0.16.0.PDLMIXM (November 2019 Update)
- V10.0.15.0.PDLMIXM (October 2019 Update) – Thanks Nico van Draanen!
- V10.0.14.0.PDLMIXM (September 2019 Update)
- V10.0.13.0.PDLMIXM (Huge thanks to Roy Goldberg!)
- V10.0.10.0.PDLMIXM (Kudos to Roy Goldberg for sending us these!)
- V10.0.2.0.PDLMIFJ Patched Boot Image: Link
How to Enable Camera2 API on Xiaomi Mi A2/A2 Lite without Root?
The process is quite easy. In order to enable the API, you must first boot the patched boot image to temporarily root your phone. Once that is done, you can use a Terminal Emulator to execute the commands that will enable Camera2 API. Once the API has been successfully enabled, you can reboot your phone to fully unroot and then install the Google Camera Port. By using this method, you will still be able to take OTA updates without any issues.
In order to temporarily boot the patched boot image, you will need to install Android SDK Platform-Tools on your PC and unlock the phone’s bootloader first. Once done, follow the listed below to enable Camera2 API on your Xiaomi Mi A2/A2 Lite.
- Download Patched Boot Image for your Xiaomi Mi A2/A2 Lite.
- Copy the downloaded image file to the folder where the ADB/Fastboot binaries are present (e.g. C:\platform-tools).
- Hold the SHIFT key and right-click on an empty space inside the folder.
- Select the ‘Open PowerShell window here’ option.
- Power off your phone completely. Then hold the Volume Down and Power buttons simultaneously to boot it into Fastboot Mode.
- Connect your phone to your PC using a USB cable.
- Enter the following command to temporarily boot the Magisk patched boot image on your Mi A2/Mi A2 Lite:
fastboot boot boot-image-filename.img
- Here, “boot-image-filename.img” will be replaced with the actual filename of the patched boot image you’re using. For example, if you downloaded the V22.214.171.124 patched boot image, then the command should be the following:
fastboot boot patched_boot_V126.96.36.199_mi_a2.img
- Just as the command is entered, your Mi A2/Mi A2 Lite should boot into the OS with temporary root.
- Right now, only the Magisk Manager stub is installed on your phone. In order for Magisk to work properly and to grant superuser permissions, you must first install the full Magisk Manager.
- Simply go to the phone’s app drawer and launch Magisk Manager app (In case the app doesn’t show up, download the latest APK from here and install it on your phone).
- Select “Yes” when prompted to upgrade to full Magisk Magisk Manager and follow the on-screen instructions.
- Once Magisk Manager is fully installed, download and install Termux (Terminal Emulator) on your phone
- Once installed, launch Termux and enter the following command:
- Grant superuser permissions to Termux when prompted
- Finally, enable Camera2 API on Xiaomi Mi A2/A2 Lite by entering the following command:
setprop persist.camera.HAL3.enabled 1
setprop persist.vendor.camera.HAL3.enabled 1
setprop persist.camera.stats.test 5
setprop persist.vendor.camera.stats.test 5
- Once the commands have executed successfully, reboot your phone to uninstall Magisk and unroot completely.
For further confirmation, you can also check Camera2 API support using an app. And finally, follow the next section to install Google Camera Port on Xiaomi Mi A2/A2 Lite.
Download Google Camera Port for Xiaomi Mi A2/Mi A2 Lite
There’s no dedicated Google Camera Port, you can try different versions from here. However, after digging enough on XDA forums, I was able to find a few versions of the Google Camera ports for the Mi A2 and Mi A2 Lite.
As of 13 November 2019, Google Camera 7.2 and 7.0 Ports for Xiaomi Mi A2 and Mi A2 Lite are available for download. v7.2 ports are only compatible with Android 10, while v7.0 ports can be installed on both Android 9 Pie and Android 10. Thanks to Kwanthay for tipping us!
General advice: Not all GCam Ports are perfect, some features like NightSight and HDR+ might be buggy on some ports, while not on some others. I have tried and gathered the most stable ones as recommended by the users themselves on XDA forums. Start by trying the first port listed and move down to test other versions until you find the one that works best for you.
How to Install
- Download Google Camera Port for Xiaomi Mi A2/A2 Lite
- Open a file manager app on the phone
- Navigate to the location where the APK file was downloaded
- Tap on the APK file to install Google Camera Port on Xiaomi Mi A2 and Mi A2 Lite
- Follow the on-screen instructions to finish the installation
- Once Google Camera has been installed, go to the app drawer and launch it
So, this was how you can enable Camera2 API on Xiaomi Mi A2/A2 Lite and install Google Camera Port on it. If you have any questions, please leave them down in the comments.
Huge thanks to Roy Goldberg, Nico van Draanen, and 4KhadaJhin4 for their contribution.