While most of flagship Android phones such as Xiaomi Mi 8, Mi 9, Poco F1, Redmi K20 Pro (Mi 9T Pro) come with Camera2 API enabled by default, almost all of Android phones in the entry-level and budget-level segments do not.
Xiaomi Mi A2 is considerably an Android phone coming in the mid-range level. The phone is expected to be the best mobile photography device available at medium range price tag.
The phone that has codename Jasmine_sprout boasts an impressive camera setup. Consequently, it can capture stunning photos even for newbies. Thanks to the Qualcomm Snapdragon 660 chipset and its dual-camera setup incorporating a 20MP, f/1.8, 1/2.8″, 1.0µm, PDAF sensor and a 12 MP, f/1.8, 1/2.9″, 1.25µm secondary sensor.
Unfortunately, the phone does not come with Android Camera2 API enabled by default. Hence, users who demand this feature to death need to manually activate it.
What is Camera2 API?
Android Camera2 is the latest camera API used in Android. It replaces the deprecated “
Camera” class (source: Android.com). Shortly, the Camera2 API provides an interface to individual camera devices connected to an Android device.
The “API” itself stands for the “Application Programming Interface“. Android as a mobile operating system employs APIs to give developers tools and access to certain parts of the system which in this case is the Camera so that they can use granted tools and access for their application.
Google introduced the so-called Camera2 API since Android 5.0 Lollipop to give camera app developers better access to advanced camera controls including manual exposure (ISO, shutter speed), focus, RAW capture, etc.
Feature-rich camera apps like Google Camera (gcam), Camera FV-5, Open Camera, Manual Camera, and so on, would not work properly without access to this so-called Camera2 API.
Most of Android users want to activate Camera2 API so they can use Google Cam on their phones.
How to enable Camera2 API on Mi A2?
The basic concept of activating the Camera2 API on an Android device is simple. All you need to do is to modify the “build.prop” file.
This might sound easy but it’s not in practice especially for newbies.
Build Properties file or the “build.prop” is basically a file in the Android system folder which defines the A-Z details of the phone including its model, brand, android version, etc.
Users can edit this file and tweak it to change the way the Android phone behaves.
This tutorial will guide you through the complete steps on how to enable Camera2 API on Mi A2 with no TWRP and no root flashed. We’ll make use of the what-so-called patched boot image.
At some point, we’ll also use Magisk Manager but we are not going to actually root it.
You will need:
- A Xiaomi Mi A2 device (obviously!).
- Make sure its battery is at least 50%
- A USB data cable. Use the one shipped with the device.
- A Windows-based computer. We prefer to use Windows 10 or 8.1 64-bit operating system.
- Xiaomi ADB Fastboot Drivers.
- Patched boot image for Mi A2.
- The latest version of Magisk Manager app.
- A cup of coffee (optional).
Steps to Enable Camera2 API on Mi A2
Step 2. Download ADB Fastboot Drivers installer and install it on your computer.
Step 3. Download the latest Android Platform Tools and extract it on your computer.
You must have both already installed if you followed our guide on unlocking Mi A2 bootloader. In case if you use another computer, make sure you install the drivers and have the platform-tools.
Step 4. Download patched boot image for Mi A2 here. Make sure you choose the appropriate version according to the current Android One ROM version running on the phone. Failed to do so may lead to a broken device if flashed.
As for example, we’ll use version 10.0.9.0. Again, use the corresponding version based on the current Android One ROM version running on your phone. See Settings >> System >> About phone.
Step 5. Download the zip file and extract it using either Winzip or Winrar.
You’ll get two files: the boot image (boot.img) and the patched one (patched_boot.img).
Step 6. Copy the patched_boot file to the platform-tools folder.
Step 7. Enable USB Debugging on your phone. We believe you have it enabled as a consequence of unlocking bootloader process. Nevertheless, it is a good practice to always double-check everything.
Enable the USB Debugging option:
Settings >> System >> Developer Options >> enable the "USB Debugging" option.
In case if the Developer Options went missing, activate it from:
Settings >> System >> About phone >> Tap the Build Number several times >> congratulation you are a developer.
Step 8. Connect the Mi A2 phone to the computer using its USB cable.
Step 9. Hold down the Shift key on the keyboard and right-click anywhere inside the platform-tools folder. Choose “Open Powershell Window here”.
Step 10. Type these lines of command and hit Enter to execute each of theme:
adb reboot bootloader
The system will establish ADB connection to your phone and will reboot it to the bootloader or Fastboot mode. You’ll notice the familiar Fastboot Bunny logo.
Step 11. Issue this command to temporarily boot your phone in the rooted mode, thanks to the patched boot file.
fastboot boot patched_boot.img
Your phone will reboot back into the system at this point.
Step 12. Look for the Magisk app. Its icon looks something similar to this one:
Couldn’t find the app? Open up your favorite web browser then download Magisk Manager APK file here or type this URL on the web browser:
or scan this QR Code with your phone.
Alternatively, you can also download it in your computer then transfer the APK file to your phone since it is still currently connected. Do not forget to install the Magisk APK file then.
Step 13. Open up Magisk Manager app by tapping on its icon. The app will ask you to download full zip, just skip it (Do not download).
Step 14. Type this command in the PowerShell or Command Prompt window:
Step 15. Look at your phone screen, Magisk will notify you about root access request. You need to grant it. Allow the root access once.
Step 16. Type this command to enable Camera2 API access Level 3:
setprop persist.camera.HAL3.enabled 1
Step 17. Next, type this lines of command as well if your phone is running Android One ROM based on Android 9.0 Pie. Oreo users can simply skip this step.
setprop persist.vendor.camera.HAL3.enabled 1 setprop persist.camera.stats.test 5 setprop persist.vendor.camera.stats.test 5
Step 18. Type exit twice to go out of the ADB shell interface:
Step 19. Open up the Magisk Manager app on your phone again. Choose Uninstall then Full Uninstall.
Step 20. Wait for Magisk to uninstall itself and unroot your phone. As part of the process, your phone will reboot and when it gets back to the system, you’ll notice the app disappeared.
Finally, open up the Google Play Store, search for and install either “Camera2 API Probe” or “Manual Camera Compatibility“. Run the app to check the Camera2 API status.
Voila! You have activated Camera2 API on your Mi A2 successfully without TWRP and without root.
Yup, we know. You might be wondering about the role of Magisk Manager in this method.
Magisk Manager acts as root access manager. The use of patched_boot image for booting will temporarily root your phone (without actually root it). Patched boot image acts as a pre-rooted boot image.
Since we don’t flash the patched boot image nor we flashed Magisk full zip package, we can safely say this method done without actually rooting the Mi A2.
Just do not hesitate to drop a comment below whether you have questions to ask or you have successfully enabled Camera2 API on Mi A2.
Thanks and credits: Minnuss.