The Mi A1 is Xiaomi’s first and so far only foray into the Android One project. Xiaomi Mi A1 brings what many users have been hoping for over the years. Xiaomi’s excellent hardware and affordable prices, and Google’s software all in one package. Stock Android does not support dual camera setups even though they’re so common these days. So Xiaomi had to include their own camera software on the Mi A1 which does sport dual rear-facing cameras. The dual cameras can actually still be improved upon by enabling the Camera2 API which is disabled by default. Today we’re going to see how one can enable Camera2 API on the Xiaomi Mi A1 and still keep the bootloader locked.
We have before discussed the Camera2 API in a lot more detail along with a method to enable it on the Mi A1. You might want to check it out if you don’t know what the Camera2 API is or what it does. That method required the use of a Magisk Module which also enabled Night Light and a few other features on the Mi A1. It also required your Mi A1 to have an unlocked bootloader. In case you decided to relock the bootloader, you’d lose Magisk and as a result, the mod and the features enabled. Most people who do unlock their bootloader don’t really intend to lock it again anyway so that’s quite fine.
But if you wished there was a way to enable the Camera2 API while still keeping the bootloader locked, there is now. Technically, you will still need a Xiaomi Mi A1 with an unlocked bootloader. The difference is that once the Camera2 API is enabled using this method, explained by flex1911, the effects are persistent. That is to say, you can relock the bootloader again and enjoy your warranty, and the Camera2 API will still be enabled. This also means you can continue to receive your regular Android OTA updates and security patches from Google.
We make sure to keep the guides as detailed and accurate as possible. The method mentioned in the guide has been successfully tested by many users as well. Yet, there is always a chance that things might not work the way they’re supposed to for everyone. As such, neither the developers who find these methods nor DroidViews take any responsibility for any harm that may come to your device. You must understand that meddling with your device using elevated privileges can produce unexpected results. Thus, you will be the only one responsible for any damage done to your device.
- A rooted Xiaomi Mi A1 with an unlocked bootloader.
- Enable USB debugging on your phone.
- ADB and Fastboot must be installed on your PC.
How to enable Camera2 API on the Xiaomi Mi A1
- Launch the adb command interface on your PC and type the following command.
- Now gain root access using the command below.
On your phone, you may be asked to allow root access. Allow it.
- You’re now in the root shell, and you can enable the Camera2 API with this simple command.
setprop persist.camera.HAL3.enabled 1
- Once you’ve issued the above command, close ADB, disconnect your phone and reboot it.
The features enabled by the Camera2 API should be working on your phone now. It’d be a good idea to check that now.
Lock the bootloader
- When you’ve made sure everything is working as expected, unroot your device. To do this, launch the Magisk Manager app and select Uninstall at the bottom of the main page. Select COMPLETE UNINSTALL from the dialog box. Note: If you’re rooted with SuperSU, you can unroot by launching the SuperSU app and selecting Unroot.
- Once Magisk is removed, re-connect your phone to the PC and launch ADB again.
- Reboot your phone into fastboot mode using the following command.
- When your Mi A1 is connected in fastboot mode, lock the bootloader using the command given below.
fastboot oem lock
This will lock your bootloader again as if it was never unlocked.