FORUMS
Remove All Ads from XDA

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

478 posts
Thanks Meter: 2,915
 
By flex1911, Forum Moderator / Recognized Developer on 9th February 2018, 02:49 PM
View First Unread Post Reply Email Thread
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
The Following 72 Users Say Thank You to flex1911 For This Useful Post: [ View ]
 
 
9th February 2018, 02:52 PM |#2  
Member
Thanks Meter: 1
 
More
Quote:
Originally Posted by flex1911

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 uninstall Magisk here.
6. Reboot to bootloader:
Code:
adb reboot-bootloader
7. Relock your bootloader:
Code:
fastboot oem lock
Done! Now you have permanently enabled Camera2 API without messing OTA and security measures.

Is it true

Sent from my Mi A1 using Tapatalk
The Following User Says Thank You to Ammo thind For This Useful Post: [ View ] Gift Ammo thind Ad-Free
9th February 2018, 02:59 PM |#3  
AridaneAM's Avatar
Member
Thanks Meter: 331
 
More
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
9th February 2018, 03:04 PM |#4  
dipakd's Avatar
Senior Member
Flag pune
Thanks Meter: 59
 
More
Can you give me the platform-tools binaries? Or link for that
9th February 2018, 03:07 PM |#5  
Member
Thanks Meter: 1
 
More
Quote:
Originally Posted by flex1911

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 uninstall Magisk here.
6. Reboot to bootloader:
Code:
adb reboot-bootloader
7. Relock your bootloader:
Code:
fastboot oem lock
Done! Now you have permanently enabled Camera2 API without messing OTA and security measures.

Editing prop file will make sure that there is no ota

Sent from my Mi A1 using Tapatalk
9th February 2018, 03:11 PM |#6  
flex1911's Avatar
OP Forum Moderator / Recognized Developer
Flag Volgograd
Thanks Meter: 2,915
 
Donate to Me
More
Quote:
Originally Posted by AridaneAM

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.
The Following 7 Users Say Thank You to flex1911 For This Useful Post: [ View ]
9th February 2018, 03:14 PM |#7  
black_arashi's Avatar
Member
Thanks Meter: 143
 
Donate to Me
More
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
9th February 2018, 03:15 PM |#8  
flex1911's Avatar
OP Forum Moderator / Recognized Developer
Flag Volgograd
Thanks Meter: 2,915
 
Donate to Me
More
Quote:
Originally Posted by black_arashi

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.
The Following 9 Users Say Thank You to flex1911 For This Useful Post: [ View ]
9th February 2018, 04:12 PM |#9  
pihpih95's Avatar
Senior Member
Flag Kuala Terengganu
Thanks Meter: 12
 
More
Welcome @flex1911 from zenfone 2 forum
9th February 2018, 04:32 PM |#10  
Haizum74's Avatar
Senior Member
Flag Capital of Yorkshire
Thanks Meter: 56
 
More
I am currently waiting for delivery of my Mi A1 (hopefully today) and will give this a go and report back.

For people questioning this, build.prop is only one of a number of read only files that are used when setting up after reboot so I can see why this would potentially work. Not a dev myself, but understand the basics.


PS Its modify not modificate
9th February 2018, 04:48 PM |#11  
Junior Member
Thanks Meter: 6
 
More
Step 5 should be only Magisk application uninstall and not a complete uninstall right?
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread