• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[GUIDE] Enable Camera2 API, EIS on stock Android Pie (temporary rooting)

Search This thread

25vikasp

Senior Member
Jan 29, 2013
527
164
Mumbai
Thank you. It works also on Jan 2019 update tested with windows 10 latest update x64
summary:
1)adb (I used https://forum.xda-developers.com/showthread.php?t=2588979)
2)Install magisk manager on device (https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445)
3)enable developer option: Settings -> About -> Software Information -> More -> Now Tap on the Build Number 7-8 Times until you see a toast message “Developer option enabled”.
Settings -> Developer Option and Enable OEM Unlock and USB Debugging.
P.S. Remember that after bootloader unlock, usb debugging will be turned off so renanable it. I suggest to remove also security pin (settings\security and position\screen lock \none) for a fastest unlock
4)unlocking bootloader by prompt ms dos (REMEMER this reset device):
Enter in fast boot mode -> adb reboot bootloader
Unlock bootloader -> fastboot oem unlock
5)After autoreboot, reset usb debugging on. now we need to upload a temporary recovery to install correctly magisk
so prompt ms dos: fastboot boot twrp.img (this is just an example if your boot img is in the same folder. In my case i renamed twrp,img to boot.img and locate it in c:/ . So the command for dos is fastboot boot c:/boot.img. After OK twrp recovery will be loaded.
6)twrp will ask you to install it but we don't need it. before go on just put magisk files in sdcard: we can use adb push function or manually from device
if you want to use adb just open prompt ms dos: adb push Magisk-v18.0.zip /sdcard (this an example, in my case i renamed magisk-18.0.zip in magisk18.zip and located in c:\, so the command was adb push c:/magisk18.zip /sdcard)
After select in Twrp recovery Install and select the magisk path (SDCARD magisk zip file). After installation , select reboot system from twrp and select do not install twrp. the device will reboot
7)now we have to complete installation of Magisk:
Open magisk app and select install (direct installation, raccomanded) and select reboot device in app
8)enable camera2api and eis for gcam :
open prompt ms dos and digit:
adb shell
su (wait and look at the device for accept permission)
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
setprop persist.camera.eis.enable 1
exit
exit
adb reboot
9)removing root and relocking bootloader
Open magisk app and select uninstall (complete) . Device will rebooted
Now let's relock bootloader: prompt ms dos and digit
adb reboot bootloader (we renter in fastboot mode)
NOW is important to hold and keep holding volume - (this avoid reset) and digit fastboot oem lock. the recovery will reboot and return in fastboot screen now you can stop to press volume - and send command fastboot reboot
10)Install Gcam apk (choose one of suggested for xiaomi mi a1)


U mentioned 4 commands to enable camera api2 ,unlike other tutorials there were only 2 .Is there any difference???
 

Gothsoul

New member
Apr 5, 2019
1
0
Sys Update Error

Hello , everything worked well ,installed Gcam sucessfully , but after removing root following the steps in this post , i cant update the system anymore , an error appears when trying to install software updates , any ideas?:confused:
 

eko.ewo

Member
Jan 7, 2016
30
2
Hello , everything worked well ,installed Gcam sucessfully , but after removing root following the steps in this post , i cant update the system anymore , an error appears when trying to install software updates , any ideas?:confused:
Same with me... It also happen to me. Success on enabling gcam but unable to update to June

Sent from my BBB100-7 using Tapatalk
 

eko.ewo

Member
Jan 7, 2016
30
2
There is a simpler method:
-Unlock bootloader (with vol- trick if you want to preserve data)
-boot Pie's patched_boot
-install Magisk Manager
-with a terminal emulator (after granting root access from Magisk Manager) type "setprop persist.camera.HAL3.enabled 1" without quotes and uppercase HAL
-Only if you want to you can relock bootloader (with vol- trick if you want to preserve data)
Enjoy
Just success with this method after couple of times trying...

Sent from my Mi A1 using Tapatalk
 

_jis_

Senior Member
Feb 5, 2012
1,469
529

Tokobo

Member
Aug 30, 2010
27
0
Why are you asking, because changes you made in Oreo are still valid after updating to Pie.
Or did you have FR your phone between Pie and Oreo? You didn't mentioned it.

FR = Factory Reset? If it is, nope, but my phone is unrooted, I just unlocked the bootloader previously and changed that single line of code. However, I noticed that with Pie, we have to change more lines. So do I have to change more lines?
 

_jis_

Senior Member
Feb 5, 2012
1,469
529
Yes.

nope, but my phone is unrooted, I just unlocked the bootloader previously and changed that single line of code. However, I noticed that with Pie, we have to change more lines. So do I have to change more lines?
Wrong, it wasn't single line previously and more lines now. It is still the same...
Did you have working GCam in Oreo at all? I guess probably not.

You don't need to run your device rooted to use GCam, that is a known fact. Setprop commands you need for Camera2API and EIS for GCam are changing just data partition. They don't touch system partition, so OTA is not affected.

I have done changes for GCam in March 2018 (in that time we have Oreo 8.0.0):
Boot to fastboot - Unlock bootloader - Fastboot boot to TWRP - Setprop commands for Camera2API and EIS - Reboot to bootloader and relock - Done

And I am happy GCam user till now despite all those minor and major (Oreo 8.1 and Pie 9.0) updates.
 
Last edited:

Tokobo

Member
Aug 30, 2010
27
0
Yes.

Wrong, it wasn't single line previously and more lines now. It is still the same...
Did you have working GCam in Oreo at all? I guess probably not.

You don't need to run your device rooted to use GCam, that is a known fact. Setprop commands you need for Camera2API and EIS for GCam are changing just data partition. They don't touch system partition, so OTA is not affected.

I have done changes for GCam in March 2018 (in that time we have Oreo 8.0.0):
Boot to fastboot - Unlock bootloader - Fastboot boot to TWRP - Setprop commands for Camera2API and EIS - Reboot to bootloader and relock - Done

And I am happy GCam user till now despite all those minor and major (Oreo 8.1 and Pie 9.0) updates.

I remembered I changed the following lines (okay 2 not 1)

Code:
setprop persist.camera.HAL3.enabled 1
setprop persist.camera.eis.enable 1

It works in my Oreo with these 2 lines changed, but I noticed after the update to Pie, it hasn't been working as fantastic (I'm using Pixel2Mod-Arnova8G2-MinimalSettings-Tolyan009-v4.2.apk).

So not sure if I have to redo it for Pie considering the codes are:

Code:
setprop persist.camera.HAL3.enabled 1
[B]setprop persist.vendor.camera.HAL3.enabled 1
setprop persist.camera.stats.test 5
setprop persist.vendor.camera.stats.test 5[/B]
setprop persist.camera.eis.enable 1

There's 3 extra lines.
 

_jis_

Senior Member
Feb 5, 2012
1,469
529
Those details you should have posted in your first post to get answer in one step.
It works in my Oreo with these 2 lines changed, but I noticed after the update to Pie, it hasn't been working as fantastic (I'm using Pixel2Mod-Arnova8G2-MinimalSettings-Tolyan009-v4.2.apk).
That's unfortunately pretty normal behaviour, there is a problem with Pie stock ROM.
You can flash other ROMs or rollback to Oreo if you need GCam again fully working.
Because of the old obsolete HW of Mi A1, I don't think it's worth the effort anyway.
Third possibility is to change phone of course.
 
  • Like
Reactions: Tokobo

Tokobo

Member
Aug 30, 2010
27
0
Those details you should have posted in your first post to get answer in one step.

That's unfortunately pretty normal behaviour, there is a problem with Pie stock ROM.
You can flash other ROMs or rollback to Oreo if you need GCam again fully working.
Because of the old obsolete HW of Mi A1, I don't think it's worth the effort anyway.
Third possibility is to change phone of course.

Sorry about that.

If I get you correctly, there seems to be no need to change these 3 lines, if I have done the other 2 when I had the phone in Oreo?
Code:
setprop persist.vendor.camera.HAL3.enabled 1
setprop persist.camera.stats.test 5
setprop persist.vendor.camera.stats.test 5

Also, would installing a later version of the GCam such as the one here (https://forum.xda-developers.com/mi-a1/how-to/auto-focus-fine-gcam-arnova-t3940322) be better?
 

_jis_

Senior Member
Feb 5, 2012
1,469
529
Ah, I normally use my phones until it starts dying. I tend to let my phones depreciate as long as possible.
It is really OT now, I can't act like you, because all my previous phones are still functional and impeccable. Only one of them died for infamous LG sudden death (LG G Flex 2), but it was in a mint condition too, just a second before death.
Nokia 6230i > Nokia 6280 > Nokia E63 > Samsung Galaxy W > Samsung Galaxy Note 2 > Motorola Moto G LTE > LG G Flex 2 > Nexus 5X > Xiaomi Mi A1 > Asus ZenFone 6
 

Tokobo

Member
Aug 30, 2010
27
0
It is really OT now, I can't act like you, because all my previous phones are still functional and impeccable. Only one of them died for infamous LG sudden death (LG G Flex 2), but it was in a mint condition too, just a second before death.
Nokia 6230i > Nokia 6280 > Nokia E63 > Samsung Galaxy W > Samsung Galaxy Note 2 > Motorola Moto G LTE > LG G Flex 2 > Nexus 5X > Xiaomi Mi A1 > Asus ZenFone 6

OT?

I normally make regular backups manually, so if it fails, I have something to work on. I admit is troublesome, but buying a expensive phone often is rather heavy on the pocket. :(
 

xilan_1129

Member
Nov 28, 2018
8
2
Cannot uninstall magisk manager

I followed everything here step by step and the google camera works fine. But, when i uninstalled the magisk, then reboot, the magisk manager still there. How to completely uninstall it?

and because of it (maybe) i can't install june security update.

please help.
 

xilan_1129

Member
Nov 28, 2018
8
2
Flash magisk uninstaller then try rebooting.

I tried that but i need to unlock the bootloader again. Is there any other method?

---------- Post added at 08:53 AM ---------- Previous post was at 08:26 AM ----------

Flash magisk uninstaller then try rebooting.

Let say I want to flash the magisk uninstaller, are these the correct steps?

1. Boot to bootloader
2. Unlock then reboot to system
3. Boot to bootloader
4. Boot twrp
5. Flash the magisk uninstaller then reboot

Is that all? What about camera2 API, EIS? Do I have to do it again?

---------- Post added at 09:36 AM ---------- Previous post was at 08:53 AM ----------

Flash magisk uninstaller then try rebooting.

Ok now the magisk already uninstalled. I just simply long press the app and click uninstall. Not sure whether this way is ok or not but so far it seems ok.

Now I'm having problem to install the june security update. It keeps failing.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    this method worked for me, so i live it here
    standart method didn't worked for me on pie, so i combined it with this method

    You will need to download TWRP and Magisk Manager, Magisk
    implied that you have installed ADB and Driver

    Unlocking bootloader:
    1. Developer Option
      • Go to your Settings -> About -> Software Information -> More -> Now Tap on the Build Number 7-8 Times until you see a toast message “Developer option enabled”.
      • Settings -> Developer Option and Enable OEM Unlock and USB Debugging.
    2. Reboot to fastboot
      Code:
      adb reboot bootloader
    3. Unlocking bootloader
      Code:
      fastboot oem unlock
      device wil reboot and wipe. after setup repeat step 1-2
    Rooting
    1. Booting Recovery
      this will boot twrp. be patient this is not instantly
      Code:
      fastboot boot twrp.img
    2. Copy Magisk.zip to device
      Code:
      adb push Magisk-v18.0.zip /sdcard
      output will be something like that
      Code:
      Magisk-v18.0.zip: 1 file pushed. 20.0 MB/s (4188255 bytes in 0.200s)
    3. Flash Magisk
      go to Install -> Select Magisk-v18.0.zip
    4. Rebooting
      Code:
      adb reboot
    Enabling Camera2 API
    After device boot
    1. Install Magisk Manager.apk
    2. Code:
      adb shell
    3. Code:
      su
      Confirm superuser rights on device
    4. Code:
      setprop persist.camera.HAL3.enabled 1
    5. Code:
      setprop persist.vendor.camera.HAL3.enabled 1
    6. Code:
      setprop persist.camera.stats.test 5
    7. Code:
      setprop persist.vendor.camera.stats.test 5
    8. Code:
      setprop persist.camera.eis.enable 1
    9. Code:
      exit
    10. Code:
      exit
      reboot device and check if all ok -> run Camera2 probe and check results
      Model:Mi A1
      Manufacturer:Xiaomi
      Build:9
      SDK:28
      SupportLevel:3
      SupportLevel HR:Level_3
      Manual exposure:1
      Auto exposure:1
      Auto exposure, always flash:1
      Auto exposure, auto flash:1
      Auto exposure, auto flash redeye:1
      AF Lock:1
      Manual focus:1
      Auto focus:1
      Auto focus macro:1
      Auto focus continuous picture:1
      Auto focus continuous video:1
      Auto focus EDOF:0
      Whitebalance off:1
      Automatic whitebalance:1
      WB: cloudy day:1
      WB: day:1
      WB: fluorescent:1
      WB: incandescent:1
      WB: shade:1
      WB: twilight:1
      WB: warm fluorescent:1
      AWB Lock:1
      RawCapture:1
    Unroot device
    1. Run Magisk Manager and press Uninstall -> Complete Uninstall
    Lock bootloader
    1. Code:
      adb reboot bootloader
    2. Hold volume buttom -
      it is very important to avoid wipe
    3. Code:
      fastboot oem lock
      divice will reboot to bootloader
    4. Code:
      fastboot reboot
    I intentionally missed obvious steps such as renaming files twrp.img or magisk.zip and installing adb and drivers
    2
    Thank you. It works also on Jan 2019 update tested with windows 10 latest update x64
    summary:
    1)adb (I used https://forum.xda-developers.com/showthread.php?t=2588979)
    2)Install magisk manager on device (https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445)
    3)enable developer option: Settings -> About -> Software Information -> More -> Now Tap on the Build Number 7-8 Times until you see a toast message “Developer option enabled”.
    Settings -> Developer Option and Enable OEM Unlock and USB Debugging.
    P.S. Remember that after bootloader unlock, usb debugging will be turned off so renanable it. I suggest to remove also security pin (settings\security and position\screen lock \none) for a fastest unlock
    4)unlocking bootloader by prompt ms dos (REMEMER this reset device):
    Enter in fast boot mode -> adb reboot bootloader
    Unlock bootloader -> fastboot oem unlock
    5)After autoreboot, reset usb debugging on. now we need to upload a temporary recovery to install correctly magisk
    so prompt ms dos: fastboot boot twrp.img (this is just an example if your boot img is in the same folder. In my case i renamed twrp,img to boot.img and locate it in c:/ . So the command for dos is fastboot boot c:/boot.img. After OK twrp recovery will be loaded.
    6)twrp will ask you to install it but we don't need it. before go on just put magisk files in sdcard: we can use adb push function or manually from device
    if you want to use adb just open prompt ms dos: adb push Magisk-v18.0.zip /sdcard (this an example, in my case i renamed magisk-18.0.zip in magisk18.zip and located in c:\, so the command was adb push c:/magisk18.zip /sdcard)
    After select in Twrp recovery Install and select the magisk path (SDCARD magisk zip file). After installation , select reboot system from twrp and select do not install twrp. the device will reboot
    7)now we have to complete installation of Magisk:
    Open magisk app and select install (direct installation, raccomanded) and select reboot device in app
    8)enable camera2api and eis for gcam :
    open prompt ms dos and digit:
    adb shell
    su (wait and look at the device for accept permission)
    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
    setprop persist.camera.eis.enable 1
    exit
    exit
    adb reboot
    9)removing root and relocking bootloader
    Open magisk app and select uninstall (complete) . Device will rebooted
    Now let's relock bootloader: prompt ms dos and digit
    adb reboot bootloader (we renter in fastboot mode)
    NOW is important to hold and keep holding volume - (this avoid reset) and digit fastboot oem lock. the recovery will reboot and return in fastboot screen now you can stop to press volume - and send command fastboot reboot
    10)Install Gcam apk (choose one of suggested for xiaomi mi a1)
    1
    Does this also enable EIS?

    Yes, but if you want to be 100% sure you can type "setprop persist.camera.eis.enable 1" after the first command.
    1
    @shaman_
    Please Can you make a video of the process and share that...
    I did not understand the process
    1
    It works? I mean, everything on gcam with this tutorial work?

    BTW, that method wipe my data?
    Yes. Yes. Yes.
    Autofocus bug remains.