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

[GUIDE] How to enable Camera2 API persistently and keep bootloader locked

Search This thread

mahfoozceecy

Senior Member
Mar 9, 2011
169
80
Calicut
The heading doesn't matter if you read the OP itself. It's simple reading comprehension to be honest. Basically you don't edit build.prop, still get the OTA and add Camera2 API.

I clicked on this thread reading "Enable Camera 2 Api without Rooting" . That's why i commented.

Sorry if you all didn't like it. :)
 
Last edited:
  • Like
Reactions: walpurgisnacht30

joeyhuab

Recognized Developer
Nov 5, 2012
3,202
13,323
27
Antipolo
evolution-x.org
Xiaomi Mi A1
Redmi K20 Pro
I clicked on this thread reading "Enable Camera 2 Api without Rooting" - and when read the OP, reminded me of Casey Neistat like Clickbaiting ;). That's why i commented.

Sorry if you all didn't like it. :)

It's not click bait. You have to root it and unroot after doing everything so that basically means that you did it WITHOUT rooting it.
 

Samhain77

Senior Member
Feb 25, 2009
492
89
Hello everyone. I'm pretty sure that there are a plenty of people that are rooting and unlocking their A1 just to enable Camera2 API (just like me).
But formally you can enable and make it persistent without unlocking bootloader and rooting.
Why "formally"? Because you will actually need to unlock and root during the process, but then you can relock your bootloader and forget about it until you will wipe your /data. Yes, Camera2 API will remain enabled after relocking and will persist even after OTA updates.

1. If you already didn't, unlock the bootloader and root your phone by Magisk using this guide.
2. Enable ADB in the developer settings.
3. Assuming you already have platform-tools binaries, do this in your shell/cmd:
Code:
adb shell
Now, when you are in the device shell, type this:
Code:
su
The device will probably ask about root access, grant it.
Now, when you are in the root shell, type this:
Code:
setprop persist.camera.HAL3.enabled 1
4. Reboot and make sure that Camera2 API works for you now.
5. Go to Magisk manager and completely uninstall Magisk here.
6. Reboot and make sure that your system boots properly.
7. Reboot to bootloader:
Code:
adb reboot-bootloader
8. Relock your bootloader:
Code:
fastboot oem lock

Done! Now you have permanently enabled Camera2 API without messing OTA and security measures.

THIS DOESN'T TOUCH SYSTEM FILES AT ALL AND HAS NOTHING TO DO WITH BUILD.PROP
I think you have to reflash stock boot.img after doing that otherwise you get the "your system has been destroyed" message if you relock the bootloader with modified boot.img. Doesn't it?

Inviato dal mio Mi A1 utilizzando Tapatalk

---------- Post added at 09:20 PM ---------- Previous post was at 09:16 PM ----------

I think you have to reflash stock boot.img after doing that otherwise you get the "your system has been destroyed" message if you relock the bootloader with modified boot.img. Doesn't it?

Inviato dal mio Mi A1 utilizzando Tapatalk
Sorry... I reply to myself... The patched boot.img isn't flashed but only booted one time so the guide is working as it is.
Thanks for this!

Inviato dal mio Mi A1 utilizzando Tapatalk
 

flex1911

Recognized Developer / Retired Forum Moderator
Feb 12, 2013
999
7,534
19
Volgograd
I think you have to reflash stock boot.img after doing that otherwise you get the "your system has been destroyed" message if you relock the bootloader with modified boot.img. Doesn't it?

Inviato dal mio Mi A1 utilizzando Tapatalk

Magisk should properly restore original boot.img. It worked for me at least.

Upd. Ah, cool then.
 

KloNom

Senior Member
Jul 21, 2014
206
47
Sooo. This seems really interesting. So far I have seen quite some doubting posts, and a single post which says OTA is is working afterwards. Any more actual OTA experience/opinions?
 

Samhain77

Senior Member
Feb 25, 2009
492
89
How did you do that? Just by writing the code for eis by following the procedure in OP?
Yeah, the same... Just write "setprop persist.camera.eis.enable 1"


I'm trying to enable quickcharge too... But I don't know if it has kernel drivers for that


Inviato dal mio Mi A1 utilizzando Tapatalk

---------- Post added at 11:58 PM ---------- Previous post was at 11:33 PM ----------

Install "Camera2 Probe" app from the play store so you can check camera settings before and after applying this procedure.

Sent from my Mi A1 using Tapatalk
 

Top Liked Posts

  • There are no posts matching your filters.
  • 80
    Hello everyone. I'm pretty sure that there are a plenty of people that are rooting and unlocking their A1 just to enable Camera2 API (just like me).
    But formally you can enable and make it persistent without unlocking bootloader and rooting.
    Why "formally"? Because you will actually need to unlock and root during the process, but then you can relock your bootloader and forget about it until you will wipe your /data. Yes, Camera2 API will remain enabled after relocking and will persist even after OTA updates.

    1. If you already didn't, unlock the bootloader and root your phone by Magisk using this guide.
    2. Enable ADB in the developer settings.
    3. Assuming you already have platform-tools binaries, do this in your shell/cmd:
    Code:
    adb shell
    Now, when you are in the device shell, type this:
    Code:
    su
    The device will probably ask about root access, grant it.
    Now, when you are in the root shell, type this:
    Code:
    setprop persist.camera.HAL3.enabled 1
    4. Reboot and make sure that Camera2 API works for you now.
    5. Go to Magisk manager and completely uninstall Magisk here.
    6. Reboot and make sure that your system boots properly.
    7. Reboot to bootloader:
    Code:
    adb reboot-bootloader
    8. Relock your bootloader:
    Code:
    fastboot oem lock

    Done! Now you have permanently enabled Camera2 API without messing OTA and security measures.

    THIS DOESN'T TOUCH SYSTEM FILES AT ALL AND HAS NOTHING TO DO WITH BUILD.PROP
    10
    Hello,

    I doubt that this will work with funtional OTA, modificating the build.prop it's modificate system, so it should't have working OTA. If we use Magisk and the modules to enable camera2api and hal3 it's because it doesn't modify system. Anyway, if someone try it and corroborate it work great with OTA, I will retract my self.

    Regards

    As I stated above, it doesn't modificate any system files at all.
    8
    Have you tried it? When updating the OTA build.prop in system is not rewrited? What is the difference with replace build.prop in twrp? When I tried it the OTA didn't upload because the edited system partition.

    Enviado desde mi Mi A1 mediante Tapatalk

    persist props are being stored in /data/property, so it doesn't touch build.prop at all.
    6
    I clicked on this thread reading "Enable Camera 2 Api without Rooting" - and when read the OP, reminded me of Casey Neistat like Clickbaiting ;). That's why i commented.

    Sorry if you all didn't like it. :)
    The OP is a guy who has just given everyone a simple and concise way of having arguably the best feature of this phone enabled without having to keep root on the phone and you are trying to make a song and dance over phrasing.

    The importance of this method is undeniable where security is a needed feature on a phone.
    4
    After applying the property as mentioned in the OP, is there a lag when opening the camera or not?
    Thanks!

    No, it doesn't. Camera lags when opening because of root, not because of HAL3.