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

[GUIDE] Enable Camera2 API Without Root [mido] [Unlocked Bootloader] [MIUI 9]

Search This thread

A_K_S_H_

Member
Jan 20, 2017
34
23
DISCLAIMER

I am not responsible for anything that happens to your device on following these steps. These are untested steps that worked for me and might work for you.

PREREQUISITES

1. PC with adb
2. Unlocked Bootloader
3. TWRP
4. MIUI 9 [Might work with other ROMs, not tested]
5. Lazyflasher zip

NOTES

1. If you are on a custom ROM, chances are that camera2 api is already enabled. Use Manual Camera Compatibility to verify.
2. If you are on MIUI, updating using ota might reset build.prop file. This might help, not tested. Update: I successfully updated to MIUI 9 Global 7.10.19 | Beta, see below for steps,
3. I am using Google Camera v4.4.020.163412804 on MIUI 9 Global 7.9.7 | Beta, and it is a HUGE improvement over the stock camera.

STEPS

1. Boot into TWRP. (Guide if you don't have TWRP)
2. Mount System.
3. Take NANDroid backup. (Optional but HIGHLY RECOMMENDED)
4. Connect to PC and execute the following command in terminal:
Code:
[SIZE="3"]adb pull /system/build.prop[/SIZE]
5. This copies build.prop to the current directory. (C:\Users\[USERNAME] by default on windows)
6. Copy it to another directory for backup.
7. Open in editor and add the following line at end:
Code:
[SIZE="3"]persist.camera.HAL3.enabled=1[/SIZE]
8. Save and exit.
9. Execute following commands:
Code:
[SIZE="3"]adb push build.prop /system/
adb shell
cd system
chmod 644 build.prop
[/SIZE]
10. Copy lazyflasher to internal storage.
11. Flash using TWRP.
12. Reboot to system.
13. Use Manual Camera Compatibility Checker to verify.
14. PROFIT!
15. Install the latest Google Camera HDR+ Port. (Optional but HIGHLY RECOMMENDED ;P)

UPDATING MIUI

1. Download the official recovery zip from here.
2. Download latest TWRP from here
2. Reboot into TWRP.
3. Take NANDroid. (Optional, just in case . . .)
4. Transfer ROM zip, TWRP img and Lazyflasher zip to internal storage.
5. Flash ROM zip. (Took about 10 minutes)
6. Flash TWRP img. (Go to flash -> select flash image -> select twrp-[v].img)
7. Flash Lazyflasher zip.
8. Follow steps 4 through 9 of above instructions. (Yes, build.prop also gets replaced on update)
9. Reboot to system.
10. Wait patiently.
11. VOILA !!

LINKS

1. Manual Camera Compatibility Checker
2. Lazyflasher Zip
3. Google Camera HDR+ Port
4. Latest MIUI Recovery Image
5. Official TWRP for mido
6. Sources: (1) (2) (3)


Hope this helps. Try and comment if this works for you in other ROMs. Also let me know if anything is unclear.
 
Last edited:

A_K_S_H_

Member
Jan 20, 2017
34
23
TWRP Tweaks (MIUI 9 Beta)

The method in this thread basically allows you to edit build.prop without rooting, which opens up a lot of possibilities. Here are some other useful tweaks to build.prop that I use.

(Note: If a line is already present in the file, edit the line otherwise add at end.)

1. Enable MIUI's full screen gestures
Code:
[SIZE="3"]
qemu.hw.mainkeys=0
[/SIZE]

2. Add EIS and disable noise cancellation
Code:
[SIZE="3"]
persist.camera.eis.enable=1
persist.camera.HAL3.enabled=1
ro.qc.sdk.audio.fluencetype=fluencepro
[/SIZE]

3. Turn off noise cancellation for audio recordings
Code:
[SIZE="3"]
persist.audio.fluence.voicerec=false
[/SIZE]

4. Fix Google Assistant talkback
Code:
[SIZE="3"]
mm.enable.qcom_parser=245389
[/SIZE]

Sources: (1)

Do reply if you are using some build.prop tweak and I'll add it here!
 
Last edited:

A_K_S_H_

Member
Jan 20, 2017
34
23
is it possible to make the flash-able zip work with stock recovery?

I am not sure if it is safe to flash zips from stock recovery. Even if you could, you would not be able to take NANDroid, so you are doomed if things go south. Still, if you want, you could try and then we'll know :p
 

A_K_S_H_

Member
Jan 20, 2017
34
23
What does the lazyflasher zip actually do? A quick search on google shows a custom kernel installer.

The source of the lazyflasher zip (2 in sources) says:

This device uses dm-verity

This means that swiping to allow system modifications will prevent you from being able to boot if you are using the stock kernel. In order to bypass dm-verity's boot prevention, you will have to install a kernel that has dm-verity disabled in the fstab.

When I was trying the adb method, I was getting a bootloop, because (I think) the system partition had been modified (new build.prop replaced old one). Flashing this zip solved this, so I guess it essentially allows modifications to the system partition.
 
  • Like
Reactions: anonymity_antim

joefso

Senior Member
Aug 2, 2007
1,125
383
I am not sure if it is safe to flash zips from stock recovery. Even if you could, you would not be able to take NANDroid, so you are doomed if things go south. Still, if you want, you could try and then we'll know :p

I am willing to try because it would be great if this could work withouth using twrp, root or a unlocked bootloader.

Are the scripts compatible?
 

A_K_S_H_

Member
Jan 20, 2017
34
23
I am willing to try because it would be great if this could work withouth using twrp, root or a unlocked bootloader.

Are the scripts compatible?

They should be, as I used them with stock MIUI, stock kernel. However, are you going to flash a zip on locked bootloader? Is that even possible? Why would modifications to the system partition be allowed with locked bootloader? What would be the point of locking if that is the case?
 

joefso

Senior Member
Aug 2, 2007
1,125
383
They should be, as I used them with stock MIUI, stock kernel. However, are you going to flash a zip on locked bootloader? Is that even possible? Why would modifications to the system partition be allowed with locked bootloader? What would be the point of locking if that is the case?

I assumed that if OTA updates can be flashed through bootloader then by that logic /system could be modified too, right? hmmm


In Android devices, Recovery is an Android-based, lightweight runtime environment separate from and parallel to the main Android operating system. Recovery's original purpose was:

to apply software updates to the device, e.g. OTA updates, and
to erase user data and cache, e.g. for troubleshooting or preparing the device for resale (factory reset) and
to run (another) external tool from microSD flash memory

https://forum.xda-developers.com/wiki/Recovery
 
Last edited:

A_K_S_H_

Member
Jan 20, 2017
34
23
yep I found..
do you have any solution for locked bootloader or everything stock??

Unfortunately I don't have access to a stock mido right now, and I don't want to lock my bootloader.

If you're willing to risk it, you could try these steps:

1. Go to developer settings and enable adb.
2. Follow steps 4 to 9 of main post (with device switched on)
3. Reboot.

You might get a bootloop on rebooting, in which case you'd have to get into stock recovery and factory reset, because afaik, stock recovery doesn't give you adb.

Do tell what happens if you try this, good luck!
 

gel14a

Member
Sep 2, 2014
10
1
When I replace the build.prop the phone goes bootloop. It does not matter I use adb or root explorer or something... Why is that? BTW only this method worked: I used an app called build prop editor and worked like a charm! Thank you. If you did not tell that it was possible to enable camera 2 api on miui 9, all my hopes would be lost. So I suggest everyone to use another methods in case this does not work.
 
Last edited:
  • Like
Reactions: mike_bravo

qun

Senior Member
Nov 27, 2010
55
6
Does this work for MIUI 8? I dont want to root my phone but would like camera2
 

Ghavio1516

Member
Jul 15, 2017
39
3
Can someone tell me what is this?it was set to no hdr+ on default.im on miui 9 global beta 7.12.8
 

Attachments

  • Screenshot_2017-12-25-16-18-06-905_com.google.android.GoogleCamera.png
    Screenshot_2017-12-25-16-18-06-905_com.google.android.GoogleCamera.png
    158 KB · Views: 1,053

foxhunt

New member
Dec 30, 2017
1
0
In the end of the TWRP guide it says to flash lazyflasher.zip . In the end of this guide it also says you have to install lazyflasher.zip .
Do you have to install it both times or is once enough ? What would happen if you follow both guides to the letter and install it twice ?
 

A_K_S_H_

Member
Jan 20, 2017
34
23
In the end of the TWRP guide it says to flash lazyflasher.zip . In the end of this guide it also says you have to install lazyflasher.zip .
Do you have to install it both times or is once enough ? What would happen if you follow both guides to the letter and install it twice ?
No, once should be enough, but flashing twice won't cause any trouble either.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 12
    DISCLAIMER

    I am not responsible for anything that happens to your device on following these steps. These are untested steps that worked for me and might work for you.

    PREREQUISITES

    1. PC with adb
    2. Unlocked Bootloader
    3. TWRP
    4. MIUI 9 [Might work with other ROMs, not tested]
    5. Lazyflasher zip

    NOTES

    1. If you are on a custom ROM, chances are that camera2 api is already enabled. Use Manual Camera Compatibility to verify.
    2. If you are on MIUI, updating using ota might reset build.prop file. This might help, not tested. Update: I successfully updated to MIUI 9 Global 7.10.19 | Beta, see below for steps,
    3. I am using Google Camera v4.4.020.163412804 on MIUI 9 Global 7.9.7 | Beta, and it is a HUGE improvement over the stock camera.

    STEPS

    1. Boot into TWRP. (Guide if you don't have TWRP)
    2. Mount System.
    3. Take NANDroid backup. (Optional but HIGHLY RECOMMENDED)
    4. Connect to PC and execute the following command in terminal:
    Code:
    [SIZE="3"]adb pull /system/build.prop[/SIZE]
    5. This copies build.prop to the current directory. (C:\Users\[USERNAME] by default on windows)
    6. Copy it to another directory for backup.
    7. Open in editor and add the following line at end:
    Code:
    [SIZE="3"]persist.camera.HAL3.enabled=1[/SIZE]
    8. Save and exit.
    9. Execute following commands:
    Code:
    [SIZE="3"]adb push build.prop /system/
    adb shell
    cd system
    chmod 644 build.prop
    [/SIZE]
    10. Copy lazyflasher to internal storage.
    11. Flash using TWRP.
    12. Reboot to system.
    13. Use Manual Camera Compatibility Checker to verify.
    14. PROFIT!
    15. Install the latest Google Camera HDR+ Port. (Optional but HIGHLY RECOMMENDED ;P)

    UPDATING MIUI

    1. Download the official recovery zip from here.
    2. Download latest TWRP from here
    2. Reboot into TWRP.
    3. Take NANDroid. (Optional, just in case . . .)
    4. Transfer ROM zip, TWRP img and Lazyflasher zip to internal storage.
    5. Flash ROM zip. (Took about 10 minutes)
    6. Flash TWRP img. (Go to flash -> select flash image -> select twrp-[v].img)
    7. Flash Lazyflasher zip.
    8. Follow steps 4 through 9 of above instructions. (Yes, build.prop also gets replaced on update)
    9. Reboot to system.
    10. Wait patiently.
    11. VOILA !!

    LINKS

    1. Manual Camera Compatibility Checker
    2. Lazyflasher Zip
    3. Google Camera HDR+ Port
    4. Latest MIUI Recovery Image
    5. Official TWRP for mido
    6. Sources: (1) (2) (3)


    Hope this helps. Try and comment if this works for you in other ROMs. Also let me know if anything is unclear.
    4
    TWRP Tweaks (MIUI 9 Beta)

    The method in this thread basically allows you to edit build.prop without rooting, which opens up a lot of possibilities. Here are some other useful tweaks to build.prop that I use.

    (Note: If a line is already present in the file, edit the line otherwise add at end.)

    1. Enable MIUI's full screen gestures
    Code:
    [SIZE="3"]
    qemu.hw.mainkeys=0
    [/SIZE]

    2. Add EIS and disable noise cancellation
    Code:
    [SIZE="3"]
    persist.camera.eis.enable=1
    persist.camera.HAL3.enabled=1
    ro.qc.sdk.audio.fluencetype=fluencepro
    [/SIZE]

    3. Turn off noise cancellation for audio recordings
    Code:
    [SIZE="3"]
    persist.audio.fluence.voicerec=false
    [/SIZE]

    4. Fix Google Assistant talkback
    Code:
    [SIZE="3"]
    mm.enable.qcom_parser=245389
    [/SIZE]

    Sources: (1)

    Do reply if you are using some build.prop tweak and I'll add it here!
    2
    Hello my device is rooted and I have Twrp medo recovery installed on my Redmi note 4 so can you pls guide me how to enable camera 2 API on my device?

    Download Mix Explorer form XDA, select root option from drawer, go to System, open build.prop with code editor, at the end add the line:

    persist.camera.HAL3.enabled=1

    Save and exit, and try using GCAM.
    Also, if you have magisk, go to downloads and search for pixel experience module, it gives you a lot more cool stuff!
    2
    My device said it is compatible with Manual camera. But I didn't enable camera2 API.

    MIUI 9 China Stable
    Xiaomi Mi5s

    Well, although this guide is meant for mido, I would have expected at least this check to work for any device. I have no idea why it shows compatible, but it seems this isn't the ultimate check for enabled Camera2 API after all. So, to check further, one could try installing apps that need camera2 API (like gcam) and see if they work or not. Another way could be to just search the build.prop itself and see if the hal3 line is present, and set to enabled.
    1
    is it possible to make the flash-able zip work with stock recovery?