Enable Camera2 API on Xiaomi Mi A2/A2 Lite without Root and Download Google Camera Port

How to Enable Camera2 API and Install Google Camera Port on Xiaomi Mi A2/A2 Lite

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.

Related Article: How to Root Xiaomi Mi A2/A2 Lite without TWRP (Magisk)

Table of Contents

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.

Starting with the January 2021 update, patched boot images will not be provided on this page. I do not own this device anymore. You can easily patch the stock boot image on your phone itself by following step #2 of this tutorial.

For Xiaomi Mi A2 (jasmine_sprout)

V11.0.28.0.QDIMIXM Stock Boot Image
V11.0.27.0.QDIMIXM Stock Boot Image
V11.0.22.0.QDIMIXM Stock Boot Image
V11.0.21.0.QDIMIXM Stock Boot Image
V11.0.20.0.QDIMIXM Stock Boot Image
V11.0.19.0.QDIMIXM Stock Boot Image Patched Boot Image
V11.0.17.0.QDIMIXM Stock Boot Image Patched Boot Image
V11.0.15.0.QDIMIXM Stock Boot Image Patched Boot Image
V11.0.14.0.QDIMIXM Stock Boot Image
V11.0.13.0.QDIMIXM Stock Boot Image
V11.0.12.0.QDIMIXM Stock Boot Image
V11.0.11.0.QDIMIXM Stock Boot Image Patched Boot Image
V11.0.10.0.QDIMIXM Stock Boot Image Patched Boot Image
V11.0.8.0.QDIMIXM Stock Boot Image Patched Boot Image
V11.0.5.0.QDIMIXM Stock Boot Image Patched Boot Image
V11.0.4.0.QDIMIXM Stock Boot Image Patched Boot Image

For Xiaomi Mi A2 Lite (daisy)

V11.0.21.0.QDLMIXM Stock Boot Image
V11.0.20.0.QDLMIXM Stock Boot Image
V11.0.18.0.QDLMIXM Stock Boot Image
V11.0.17.0.QDLMIXM Stock Boot Image
V11.0.16.0.QDLMIXM Stock Boot Image Patched Boot Image
V11.0.14.0.QDLMIXM Stock Boot Image Patched Boot Image
V11.0.12.0.QDLMIXM Stock Boot Image Patched Boot Image
V11.0.11.0.QDLMIXM Stock Boot Image Patched Boot Image
V11.0.10.0.QDLMIXM Stock Boot Image Patched Boot Image
V11.0.7.0.QDLMIXM Stock Boot Image Patched Boot Image
V11.0.5.0.QDLMIXM Stock Boot Image Patched Boot Image
V11.0.4.0.QDLMIXM Stock Boot Image Patched Boot Image

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 steps below to enable Camera2 API on your Xiaomi Mi A2/A2 Lite.

  1. Download the patched boot image for the software build number installed on your phone.
  2. Extract the contents of the downloaded ZIP file to get the ‘magisk_patched.img’.
  3. Copy the extracted patched boot image file to the folder where the ADB/Fastboot tools are installed on your PC (e.g. C:\platform-tools).
  4. Now, launch the command-line inside the Platform-Tools folder.
  5. Power off your phone completely. Then hold the Volume Down and Power buttons simultaneously to boot it into Fastboot Mode.
    Enable Camera2 API on Xiaomi Mi A2/A2 Lite - Boot into Fastboot Mode
  6. Connect your phone to your PC using a USB cable.
  7. 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
  8. Replace “boot-image-filename.img” with the actual filename of the patched boot image you’re using. For example, if you downloaded the V11.0.6.0 patched boot image, then the command should be the following:
    fastboot boot magisk_patched.img

    Enable Camera2 API on Xiaomi Mi A2/A2 Lite - Boot Magisk Patched Boot Image

  9. Just as the command is entered, your Mi A2/Mi A2 Lite should boot into the OS with temporary root.
  10. 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.
  11. Simply go to the phone’s app drawer and launch the Magisk Manager app (In case the app doesn’t show up, download the latest APK from here and install it on your phone).
    • Note: Make sure that you install the app to the internal storage only, and not to the SD card via Adoptable Storage.
  12. Select “Yes” when prompted to upgrade to full Magisk Magisk Manager and follow the on-screen instructions.
    Upgrade to Full Magisk Manager on your Xiaomi Mi A2/A2 Lite when prompted
    (For reference only)
  13. Once Magisk Manager is fully installed, download and install Termux (Terminal Emulator) on your phone
  14. Once installed, launch Termux and enter the following command:
    su
  15. Grant superuser permissions to Termux when prompted
    Enable Camera2 API on Xiaomi Mi A2/A2 Lite without Root - Terminal Emulator
  16. 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
  17. 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

  1. Download Google Camera Port for Xiaomi Mi A2/A2 Lite
  2. Open a file manager app on the phone
  3. Navigate to the location where the APK file was downloaded
  4. Tap on the APK file to install Google Camera Port on Xiaomi Mi A2 and Mi A2 Lite
    Install Google Camera Port on Xiaomi Mi A2 and Mi A2 Lite
  5. Follow the on-screen instructions to finish the installation
  6. 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 f.y, Roy Goldberg, Nico van Draanen, and 4KhadaJhin4 for their contribution.