Camera2 API HAL3 Enabler Tweak

Camera2 API HAL3 Enabler Tweak 1

Google replaced the deprecated Camera class from within its Android operating system. The iteration is Camera2 API. What is it actually?

Android Camera2 API provides an interface to individual camera devices connected to an Android device (read more at Android.com). If that still makes you confused, we can say it in much simpler way.

Camera2 API is something that needs to enable if we want to use any camera apps with advanced control.

Normally, most of camera gives you freedom to adjust White Balance (WB) and ISO settings in its manual mode. There are some advanced camera apps allowing users to make some adjustments with not only ISO and WB but also camera focus.

However, such camera apps require Camera2 API enabled to work properly.

Some apps can also shot RAW (instead of compressed jpg/jpeg) and this also needs Camera2 API.

Recently, Camera2 API becomes popular with the hype of ported Google Camera app (a.k.a gcam). Unluckily, not all Xiaomi devices come with Camera2 API enabled by default.

Budget range and mid range devices surely have this disabled. Obviously, flagship level devices such as Mi 8 and Mi 9 come with Camera2 API enabled by default.

Coming with the API disabled doesn’t necessarily mean it can’t be enabled. Users can still enable it manually. Sadly, the process has to undergo arduous mechanism especially for novice users.

The overall mechanism involves unlocking bootloader which takes time to wait for the official permission from Xiaomi part. Furthermore, it also needs a custom recovery.

Currently, there are a myth saying that enabling camera2 API demands root. This is not completely true.

Previously, we have shared a couple of tweaks allowing you to easily enable Camera2 API easily.

Read: Magisk Camera2 API Enabler.

Frankly saying, the tweaks seem obsolete to use on ROMs based on Android 9.0 Pie. While the time goes by, adoption to Android 9.0 Pie increases. Hence, we’ll need new solution to achieve the same goal.

Enter the HAL3 Enabler for MIUI ROM based on Android 9.0 Pie.

This tweak is a small zip file that does the magic on enabling Camera2 API. Once flashed through TWRP custom recovery, this enables Camera2 API Level 3.

In case if you didn’t aware yet, there are 4 levels of camera API available: Legacy, Limited, Full, and Level 3.

  • Legacy, where features of Camera 1 API are only available;
  • Limited, means some basic features of API 2 are made available;
  • Full, where all the basic features of Camera 2 API are available;
  • Level 3, the premium version where some extra features like RAW capture etc. are included in the API.

Download Camera2 API HAL3 Enabler

You can download the flash-able zip file from below direct link:

File name :
HAL3_ENABLE_MIUI_PIE.zip
Version n/a | 3341 downloads | Size: 181 KB

Please note! You will need an unlocked bootloader and a custom recovery to flash the file. We recommend the official TWRP, Red Wolf, Pitch Black, or Orange Fox TWRPs.

p.s: This tweak is not made by us. We have difficulties tracing back the file to its maker. Please contact us or leave a comment below if this is your work. We’ll give a proper credit.

What’s inside the file and what does it do?

The file execute following script:

#!/sbin/sh
#/system/addon.d/34-camera.sh
#During a CM13.0 upgrade, this script backs up /system/*,
#/system is formatted and reinstalled, then the file is restored.
#

. /tmp/backuptool.functions
list_files() {
 cat <<EOF
 EOF
 }
case "$1" in
   backup)
     list_files | while read FILE DUMMY; do
       backup_file $S/"$FILE"
     done
   ;;
   restore)
     list_files | while read FILE REPLACEMENT; do
       R=""
       [ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
       [ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
     done
   ;;
   pre-backup)
     # Stub
   ;;
   post-backup)
     # Stub
   ;;
   pre-restore)
     # Stub
   ;;
   post-restore)
     # Enable Camera2 API
       echo "# Enable Camera2 API" >> /system/build.prop
       echo "persist.vendor.camera.HAL3.enabled=1" >> /system/build.prop
   ;;
 esac

The last command above will add persit.vendor.camera.HAL3.enabled=1 to the build.prop file in your phone’s system.

Enjoy!

4 Comments

  1. batsy September 1, 2019
    • JoseCSSS October 9, 2019
      • JoseCSS October 20, 2019
  2. Oussama October 10, 2019

Leave a Reply