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. Just follow the steps below:)
1. If you already didn’t, unlock the bootloader and root your phone by Magisk.
2. Enable ADB in the developer settings.
3. Assuming you already have platform-tools binaries, type this in your shell/cmd:
Now, when you are in the device shell, type this:
The device will probably ask about root access, grant it.
Now, when you are in the root shell, type this:
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.
6. Reboot and make sure that your system boots properly.
7. Reboot to bootloader:
8. Relock your bootloader:
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