[How To] Enable Cam2API - simply, and keep OTA - NOT working with stable PIE

Search This thread

gagansembi

New member
Nov 15, 2012
1
0
in miui devices

you can also use booting into custom recovery then from pc adb shell and run these commands then reboot
no need to install magisk
Here I list what I did to enable cam2 api, no need to worry about adb command (except when you flash patched_boot.img)

1. Already have Magisk installed
2. Download Terminal app from play store. Personally I use "Termux"
3. Open Terminal app then type
su
[enter]
4. Grant root access
5. Type
setprop persist.camera.HAL3.enabled 1
[enter]
6. Type
setprop persist.vendor.camera.HAL3.enabled 1
[enter]
7. Reboot
8. Check .. cam2 api should now enabled
9. Optional .. uninstall Terminal app you downloaded
10. Optional .. uninstall Magisk if you don't need root
 

KevMetal

Senior Member
Nov 11, 2016
1,616
629
Amazon Fire TV
Amazon Fire HD 6 and 7
you can also use booting into custom recovery then from pc adb shell and run these commands then reboot
no need to install magisk

some things won't work and gcam might crash ..you need to enable ALL of these

using setprop or buildprop editor or recovery

persist.camera.HAL3.enabled=1
persist.camera.EIS.enabled=1
persist.camera.stats.test=5
persist.vendor.camera.HAL3.enabled=1
persist.vendor.camera.EIS.enabled=1
persist.vendor.camera.stats.test=5
 

Tianhe

Senior Member
Mar 16, 2011
677
169
If rooted, simply use cam2api enabler module in magisk. The benefit of this is that its systemless so you dont have to modify build.prop and you can disable it anytime if you want to use stock camera.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    ********** 11/17/18 sorry to say folks, this method of enabling cam2api does not, for some reason, work with stable PIE. Looks like root is the only option now ********

    **** please note, the next comment, after this guide, has some 'condensed problem solving' tips from the 10 pages of comments - if you run into problems doing the following, look at the next comment for possible solutions *****

    While this might sound similar to other 'guides', it's not the same. In this guide we'll enable Cam2API, not flash anything, and not install root then later uninstall it.

    And we won't do it with a 'tool', that you have no idea what it's doing behind the scenes (they have their place, but not really needed for this imho).

    Also, it's not my intention to knock Magisk. It's a great rooting app, and it has a lot of additional features besides root. But when deciding to use Magisk or not, if all you want to do is enable cam2API, and use none of it's other great features, it seems like overkill to me.

    Prerequisites:
    1) Your version of fastboot needs to be one that recognizes 'dual slot' phones (look at the version docs if yer not sure).
    2) Your device needs to be bootloader unlocked, and adb debug enabled (research that if you don't know what it means).
    3) You need the latest version of Tingyichen's TWRP, which currently is twrp-3.2.3-jasmine-20181020.img
    https://forum.xda-developers.com/mi-a2/development/recovery-unofficial-twrp-recovery-mi-a2-t3825146


    1) Connect the device with adb, and verify it's working with 'adb devices'. Assuming it works type:
    Code:
    adb reboot bootloader

    2) Once in fastboot (the bootloader), find out which slot is current with:
    Code:
    fastboot getvar current-slot
    Make a note of which slot is current.

    3) If the current slot is NOT 'a', then we have to set it to 'a'. Do the following to accomplish that;
    Code:
    fastboot set_active a

    4) With the current slot set to a, do the following command:
    Code:
    fastboot boot twrp.img
    (or the actual name of your twrp.img if you didn't rename it to twrp.img - you don't *have* to rename it, seems most people do though.)
    At this point, let the device start and go into twrp. You will have to use your 'pattern' if you have one set on the phone. Also, you do NOT have to hold vol up to boot into twrp.

    5) Now we'll do the 2 (or 3 if u have Pie) commands to set cam2 enabled.
    Code:
    adb shell
    Code:
    setprop persist.camera.HAL3.enabled 1
    note: only do the following command for Pie or newer versions.
    Code:
    setprop persist.vendor.camera.HAL3.enabled 1
    Code:
    exit

    6) Our cam2 will be enabled the next time we reboot. So lets type this:
    Code:
    adb reboot bootloader

    7) Now, if our original active partition was b, we have to set it back to b:
    Code:
    fastboot set_active b

    8) Lastly, we simply reboot with:
    Code:
    fastboot reboot

    That's it, boom, done.

    Side Notes:
    So why does this work? After so many have indicated TWRP didn't work for them? But it did for others? Wha Up? Simple, it seems twrp isn't very dual slot smart (and why should it be? it was originally written for single slot devices - it DOES give you an option to set the other slot active when you exit it, but all that's doing is running 'set active', nothing to do with installing it).

    So I just verified this morning, even though I have cam2 working. My active slot is b, and 'fastboot boot twrp' would fail (even though others said Tingy's new version worked!). So what's different? Only thing I could think of was which slot was active. The active slot changes for ea device with updates, and thus we don't all have the same active slot!

    But setting it to a, then doing boot twrp, works like a champ. setprop persist commands of course work also (I verified, even though mine are set). And simply going back to fastboot and doing reboot should avoid any trace of twrp having been used (we didn't 'flash' it, only booted it).

    If anyone decides to try 'fastboot boot boot_a twrp.img', that *might* work, I didn't think to try it.

    Cheers
    5
    Update - additional lines for gcam 6.1

    Here I list what I did to enable cam2 api, no need to worry about adb command (except when you flash patched_boot.img)

    1. Already have Magisk installed
    2. Download Terminal app from play store. Personally I use "Termux"
    3. Open Terminal app then type
    su
    [enter]
    4. Grant root access
    5. Type
    setprop persist.camera.HAL3.enabled 1
    [enter]
    6. Type
    setprop persist.vendor.camera.HAL3 enabled 1
    [enter]
    7. Type
    setprop persist.camera.stats.test 5
    [enter]
    8. Type
    setprop persist.vendor.camera.stats.test 5
    [enter]
    9. Reboot
    10. Check .. cam2 api should now enabled
    11. Optional .. uninstall Terminal app you downloaded
    12. Optional .. uninstall Magisk if you don't need root

    Thanks to @akshayakakat for the info on the additional lines needed to get gcam 6.1 working.

    See - https://forum.xda-developers.com/mi-a2/how-to/camera2api-mi-a2-using-temporary-root-t3869543
    4
    @Fallen997, do not be lazy, read the posts and pages before, you will see that they are allot statements that it work ;)
    3
    The problem is, using TWRP I couldn't get adb shell working. Which is why I used PBRB.

    In TWRP, try to disable MTP (inside 'mount' option), and you'll can get adb shell working.
    3
    only one question after installing Magisk When Open Adb Command Window. When device On Or In Fastboot Mode? & In Adb shell Command is with setprop or without it? Please Explain This In Detail Thanks In advance
    Sorry But I'm A Noob

    Here I list what I did to enable cam2 api, no need to worry about adb command (except when you flash patched_boot.img)

    1. Already have Magisk installed
    2. Download Terminal app from play store. Personally I use "Termux"
    3. Open Terminal app then type
    su
    [enter]
    4. Grant root access
    5. Type
    setprop persist.camera.HAL3.enabled 1
    [enter]
    6. Type
    setprop persist.vendor.camera.HAL3 enabled 1
    [enter]
    7. Reboot
    8. Check .. cam2 api should now enabled
    9. Optional .. uninstall Terminal app you downloaded
    10. Optional .. uninstall Magisk if you don't need root