Android Pie update for Xiaomi Mi A1 was released a while back and our users have asked us if they can enable Camera2 API on their Mi A1 after on Android Pie. To answer the question, I will show you in this post how to easily enable Camera2 API on Xiaomi Mi A1 without permanently rooting it. The instructions will work regardless of the Android version installed on your phone. Furthermore, links have also been provided below to download the latest Google Camera Port for your Xiaomi Mi A1.
Advertisement
The Xiaomi Mi A1 is the company’s first smartphone featuring the Android One program. Being a part of the program means that the device offers guaranteed updates. Be it a major Android version release or monthly security patches. Talking about the software, the phone incorporates the stock AOSP firmware which is free from the majority of OEM bloatware. If you try installing the Google Camera Port on your Mi A1, you will probably fail due to the lack of Camera2 API support. Despite being based on stock Android, the Mi A1 still doesn’t offer direct support for Camera2API on Android Pie or Oreo.
If you have rooted your Mi A1, you can easily enable the API by making a few build.prop
edits or via a Magisk module. In the case of the former, you would mount and write the /system partition, which will ultimately break the possibility of installing OTA updates on your rooted phone via Magisk. So, if you do not want to root, you can still enable camera2 API on your Xiaomi Mi A1 quite easily.
Advertisement
The process that has been listed below will first require you to boot Magisk Patched Boot Image to temporarily root your phone. Once your Mi A1 boots into the OS, you can simply use a Terminal Emulator to enable Camera2 API by executing a few simple commands. Since you will be rooting the phone temporarily, you will still be able to take OTA updates after following this method, so stay out of worries.
Also read: How to Hard Reset Xiaomi Mi A1 to Factory Settings (2 Methods)
Page Contents
Downloads
Below are the download links for stock and patched boot images for Xiaomi Mi A1 running Android Pie. We have also provided the stock boot image for the corresponding firmware. It shall help you unroot your phone in case you mistakenly flash the patched boot permanently.
Instructions to Enable Camera2API on Xiaomi Mi A1
In order to temporarily boot the patched boot image on your Mi A1, you must first install Android platform-tools on your PC and unlock the bootloader of your Xiaomi Mi A1 (Note: Unlocking the bootloader will wipe all the data on your phone, so make sure that you take a complete backup first). If you already have the bootloader unlocked, nothing will be wiped using this method.
I have personally tested this method on a Xiaomi Mi A1 running the latest Android Pie firmware. Although, it will work on older Android versions too. Just make sure that you download the patched boot image corresponding to the software build number installed on your phone.
Now to enable Camera2 API on your Xiaomi Mi A1, follow the instructions below.
- Download the Magisk patched boot image for Xiaomi Mi A1.
- Copy the downloaded image file to the folder where the ADB/Fastboot binaries are present (e.g. C:/username/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 Xiaomi Mi A1 completely.
- Now hold the Volume Down and Power buttons together to enter Fastboot Mode.
- Connect your phone to the PC using the USB cable.
- Enter the following command to temporarily boot the Magisk patched boot image on your Mi A1:
fastboot boot boot-image-filename.img
- Make sure to replace ‘boot-image-filename.img‘ with the actual filename. For example, if you’re on the firmware with V10.0.21.0 build number, the command should be:
fastboot boot patched_boot_V10.0.21.0_mi_a1.img
- Just as the command is entered, your Mi A1 should boot into the OS with temporary root with Magisk.
- Right now, only the Magisk Manager stub is installed on your phone. In order for Magisk to work and to grant superuser permissions, you must first install 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 for Android) on your Mi A1.
- Once installed, launch Termux and enter the following command:
su
- Grant superuser permissions to the Termux app when prompted.
- Finally, enable Camera2 API on Xiaomi Mi A1 running Android Pie by entering the following commands:
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
- Further, enter the following command to enable EIS (Electronic Image Stabilization) on Mi A1:
setprop persist.camera.eis.enable 1
- Once the command executes without any errors, close Termux and reboot your phone. When your phone reboots, Magisk Manager should vanish and your Mi A1 should be unrooted.
For further confirmation, you can also check Camera2 API support using an app. With the API enabled, you can now go ahead and install Google Camera Port on your Mi A1.
Download Google Camera Port for Xiaomi Mi A1
XDA RD joeyhuab created a dedicated thread on the forums to share the latest working Google Camera Ports for Xiaomi Mi A1. Below are some of the GCam ports shared by different users on that thread. Note that each version may have bugs of there own. Rest assured, these are the most stable ports available for the device as confirmed by the XDA users who shared them.
- Google Camera 7.2.014 Port by marlin-ku (PXv4.1.1)
- PXv4.1.1_GCam_7.2.014_whyred_02.apk
- Notes: Not completely stable and the camera app may reboot randomly
- HyperCam E4 (Only for Android 10)
- Google Camera v7.0.0.9 Port by Parrot043:
- Google Camera v6.3.017 Port by Parrot043:
- Google Camera v6.2.030 Port by Wyroczen (Most stable Port):
- Google Camera 6.2.030 Port by overwhelmer:
- 6.2_MiA1_Edition_v1.1G_Q.apk (Only Android 10)
- 6.2_MiA1_Edition_v1.1G_P.apk (Only Android Pie)
- GoogleCamera_6.2.030_MiA1Edition_v1.0g_overwhelmer_STABLE.apk
- Google Camera v6.2.030 Port by Arnova8G2:
Note: For Wyroczen’s version, you will need to install the DotFix module on your rooted device. If your Mi A1 isn’t rooted, then go to Google Camera app “Settings” > “Advanced” > “Lab” and disable “mi a1 dot related fixes”. Also, switch “raw_sensor” to “raw10”. This shall help prevent pink/purple tinted photos.
If you’re not satisfied with the provided ports, you can try and find the perfect one for you from here. Finding the perfect GCam Port for any device is hard. If you have found a better port, then please let us know in the comments. It would help other users who are looking for it.
You have just succeeded to enable Camera2 API on your Xiaomi Mi A1 without root. If you have any questions regarding the method listed above, please feel free to leave a comment.
Comments 72 Comments
Yes, Ale. I have added it, please check now.
Charan, I have added the latest stock and patched boot images for the V10.0.24.0 update.
Yes, Kapil. I have added it now, please refresh the page and check.
Hi, thanks for the VERY informative tutorial. Just a couple of doubts: how do we know if we have flashed the root version permanently? And as you have already uploaded the stock boot images, how do you flash that if we have mistakenly flashed the patched version permanently? (I’m asking this because I want to be completely safe in this method and also I’m a TOTAL newbie in these things and this is my first ever venture, and it’s very scary, not knowing what might happen at an time.)
Thank you Navneeth for the kind words.
The quickest way to differentiate between a permanent flash and a temporary boot is the command itself.
In this tutorial, we are using the ‘fastboot boot’ command, which basically just boots the phone with the directed partition image (a patched boot image in this case).
On the other hand, when you “flash” something, the command uses the ‘fastboot flash’ syntax. For example, if you were to flash the patched boot image, the command would be:
fastboot flash boot boot.img
(Here ‘boot.img’ would be the actual filename of the boot image).TL;DR – As long as you use the ‘fastboot boot’ command as instructed, your phone will automatically be unrooted on the next reboot.
Hi;
I need the patched boot image for V10.0.24.0. Will you share it sir?
thank you
It has been uploaded and added. Please check now.
Yes, you will need the patched boot image for V10.0.24.0. I am in midst of extracting, patching and uploading it. Just hold on for a while.
Hi Dhananjay, where can I find the patched boot image for august 2020 update (V10.0.24.0) ?
Thanks.
I have just added it Ivan, please check the links again.
Hello!
I am not trying to enable Camera2api, but solving an issue with the volume of the speaker during calls, it is really low.
I need to edit “root”\system_root\system\vendor\etc\mixer_paths_m tp_global.xml”.
Will this way work for this and make it permanent?
Thanks.
Yes, it will work. But when you unroot (i.e. reboot the phone), it might end up in a bootloop because the /system partition was modified.
If performing the fix is really something you need to do, then I suggest you root the phone.
Tobias, I have added the stock boot for the August 2020 update with V10.0.24.0.PDHMIXM build number.
Hi Gaurav. Stock and Patched boot images for the July update (V10.0.23.0) have been added. Please check now.
Hi Ali. If you still need it, I have just uploaded and added the V10.0.22.0 boot images to the post.
Hi Dev. I have just added it.
Hi Helvin. I haven’t been able to capture the OTA URL or get a direct link to the 10.0.22.0 full ROM/fastboot.
Though I have found something. I am currently downloading it and will reply back if I add the boot images.
Hi Ali. For now, I do not have my hands on the OTA package of the June 2020 update. As soon as I do, I will extract the boot image and upload it.
Hi Lanang. Have you tried installing a different port? If all the ports crash, it means that camera2 API wasn’t successfully enabled. To confirm the same, please check this post.
Hi Nanda. Yes, the phone will have root permissions, but only temporarily. Since you will only temporarily boot the phone with the patched (rooted) boot image, it will only stay rooted until the next reboot, as mentioned in the instructions.
Hi Chaki. I have added the download links for the stock and patched boot images for the March 2020 security update. Please refresh the page and check again.
Hi Asif, both the patched and stock boot images for the March 2020 update have been added.
Hi Hadi. I have just added them, along with a couple of new ports from various developers like marlin-ku and overwhelmer.
hi, thanks for the file, it really work on my cousin’s mia1, now he can easily install any gcam version out there, haha
god bless you!
You’re welcome! I am glad it proved helpful.
Hello, I have added the new boot images. Please check again.
Hi CasaLiro. I have added the patched and stock boot images for the January 2020 update. Please refresh the page and check again.
Hi Ikhsan, if your phone’s bootloader is already unlocked, then no, this process will not wipe any data stored on the phone.
Bro thanks i could not found a single thread about installing (Pie Dec 19) Gcam for Mi A1 including XDA and may be its because of the Mi A1 is getting old and developers have switched to another device.
But anyhow ton of thanks as i installed successfully Gcam with temporary root having no issue in instillation process , i am on pie December security update and now having camera2api enabled in my Mi A1.
Thanks and keep it up.
Hi Ibrar. Thank you so much for your appreciation. It means a lot to me.
Hi Alexandre. Thanks for the confirmation! Glad that you got it working.
Hi! When I type in “fastboot boot boot-image-filename.img” it says no such file in directory. What do I do?
Hi Allan. You need to replace “boot-image-filename.img” with the actual filename of the patched boot image.
For example, if you’re using the November patched boot image, the command should be:
.\fastboot boot patched_boot_10.0.15.0_mi_a1.img
I hope it clarifies.
Hi Cristian. I have uploaded the November 2019 stock and patched boot images. Please check now.
Hey bro i used latest November security patched boot image… everything ok but when I reboot my phone magisk says magisk not install I have to fastboot the image file after reboot pleas help
Hi Khabir. By using this method, your phone is only temporarily rooted, until you reboot. A reboot will unroot your phone.
After booting with the corresponding patched boot image, you will need to use Termux to execute the above-stated commands.
hi
I have done it. it’s working nice.
thanks for your post.
the only thing I need to confirm is magisk Manager is still on my phone after rebooting. I should remove it or not
Hi Jignesh. Please, open Magisk Manager, it should show that Magisk is not installed. If so, then you can safely remove the app.
P.S. Thanks for your appreciation. I am glad it was helpful to you.
Great! You’re welcome Shrnjay. And apologies for the previous boot images that caused the issues.
Hi, thank you for guide
Do you know if there is the rom patched of nomvember update?
Hi Mick. They are now available. Please check again.
please upload mi a1 November 2019 patch boot image
Hi Virendra. It’s up now. Please re-check.
Hi Shrnjay. I have reuploaded the new images, and they have been confirmed to be working. Please try downloading it once again, and then use the “fastboot boot patched_boot_10.0.14.0_mi_a1.img” to temporarily boot your phone with Magisk root.
I wanna know after doing all of these above steps my bootloader is still unlocked, because there wasn’t any instruction given to lock the bootloader so should i lock it, or not? will it brick my phone or it’s safe to lock it?
Hi Praneet. Yes, the bootloader will still be unlocked and it needs to be kept that way. If you lock the bootloader, the Camera2 API will be disabled. Locking is possible, and should not brick your phone. But if you want Camera2 API, you must keep it unlocked. And don’t worry, neither an unlocked bootloader or the Camera2 API modifications will prevent you from taking and installing OTA updates on your phone.
@Dhananjay, you are wrong. I have enabled Camera 2 API then I locked bootloader without losing any data and using Gcam after locking the bootloader.
Hi Samuel. Thanks for correcting me. I don’t own the device anymore, but the same unlocking trick (without wiping user data) stopped working for the Mi A1 months ago.
Even if it works, I wouldn’t suggest locking the bootloader. That’s because once you update your phone with a future security patch, you will need to re-perform the procedure to enable Camera2 API. For which, you will again need to unlock the phone’s bootloader.
I personally find it quite redundant, following the whole unlocking, enabling camera2 API, and re-locking bootloader again, and again, every month.
Unless someone is skeptical about their device’s security with an unlocked bootloader
what is the best pixel 4 camera for mi a1?
Hi Ayrton. First of all, your Mi A1 should be running Android 10 to be able to use the Pixel 4 camera port (Google Camera 7.0 or above).
Try downloading the first two ports available here. One is of Google Camera v7.0.009, while the other is of v7.1.019. Give them both a try and see which works the best for you. For the v7.0.009 port, you will also need to load the config file, which could be found here.
Also, do let us know which version works best so that we can update the post with the link to that version as well.
Hi Strider. Must be some issue with Mediafire. Please try these links if you’re still on the August 2019 update. On the other hand, Patched and Stock boot images for consecutive September and October updates are now live.
Hi. Thanks for the kind comment. The image is now available for download.
Hi Parag. Once I get hands on the full OTA package or fastboot image of the September update, I will surely upload and post the boot images as soon as possible.
Hi Mani. The link has been added above.
Hi Vincenzo, the patched boot for August 10.0.12.0 update is now available.
Hi. The patched boot image is now live. Sorry for the delay.
You gave the Link for stock boot IMG also na… what’s that for?
Hi Mahesh. For two major reasons:
1) If a user accidentally flashes the patched boot image instead of temporarily booting it.
2) In case a user faces an issue while installing the OTA updates.
Hi. Which firmware build number is currently installed on the phone? Also, please state the device name, is it the Mi A2 or the Mi A2 Lite?
Yes, it is now available for download.
Hi. It’s now available, please check the Downloads section.
Hi Zack. The May Patched Boot is now available. And never use a patched/stock boot of another software version.
Hi. The download link is now up and running, please check.
Hi. It’s available now, please check the Downloads section.
Hi Himanshu. It’s available already, please check the Downloads section.
download link not work
Works for A2?
Hi. We have a separate tutorial for the Mi A2/A2 Lite here.
Can I use the command “Disable” instead of enable to disable or restore the settings as previous.
There’s nothing like disable. It is a property name. In order to disable it, just set its value to “0”. The following commands will help you understand what I am trying to explain:
setprop persist.camera.HAL3.enabled 0
setprop persist.camera.eis.enable 0
I already finished all the step but when i open the gcam its force close…i have try 4 gcam including given gcam.
Hi. Follow the steps in this guide and check if Camera2 API is enabled now your Mi A1.