Enable camera2api and re-lock bootloader - Xiaomi Redmi Note 5 Pro Questions & Answers

I am planning on unlocking the bootloader, booting to TWRP, enabling camera2api via adb (adb shell setprop persist.camera.HAL3.enabled 1), and re-locking the bootloader (fastboot oem lock).
Has anyone had any experience with this (specifically any trouble re-locking the bootloader)?
I'm assuming if I can't enable camera2api with that adb command I can boot to TWRP, flash Magisk, grant su permission and then enable it, then flash Magisk Uninstaller.
I want to preserve SafetyNet and OTA updates permanently rather than rely on Magisk and flashing updates using TWRP.
Edit: This is impossible. Relocking the bootloader will wipe the phone.

FragmentsOfLife said:
I am planning on unlocking the bootloader, booting to TWRP, enabling camera2api via adb (adb shell setprop persist.camera.HAL3.enabled 1), and re-locking the bootloader (fastboot oem lock).
Has anyone had any experience with this (specifically any trouble re-locking the bootloader)?
I'm assuming if I can't enable camera2api with that adb command I can boot to TWRP, flash Magisk, grant su permission and then enable it, then flash Magisk Uninstaller.
I want to preserve SafetyNet and OTA updates permanently rather than rely on Magisk and flashing updates using TWRP.
Edit: This is impossible. Relocking the bootloader will wipe the phone.
Click to expand...
Click to collapse
You can do this without flashing magisk, just copy build.prop to your desired accessible location(through twrp's file manager) and after adding that hal3 line paste it back to /system. Then you can flash stock recovery and can stay with unlocked bootloader 'cause as much as i remember it doesn't voids warranty in xiaomi phones a....but the only problem you might face is, you'll have to do it again, everytime ota uodate overwrites build.prop

Related

[Q] How would I enable ADB with no screen?

Hey guys/gals, I have an Evo 4g with the digitizer and screen removed. I recently RUU'd it to 4.67.651.3 and have unlocked the bootloader via HTCDev. I have fastboot access, and only have adb access via a custom recovery. I don't actually have a custom recovery installed, Note that I am just booting one with "fastboot boot custom_recovery.img".
I am aware that a flag is set in "/data/data/com.android.settings/shared_prefs/com.android.settings_preferences.xml" when the box is checked (Debugging) in the gui. And I have been able to mount the data partition in recovery and push that file to the phone (with "<boolean name="enable_adb" value="true" />" set). I then set the ownership and permissions based on what they are in the android emulator, but when I boot the phone I don't get adb access.
I also have a userdata.img backup for when it was on 3.70.651.1 with adb enabled. However it is a backup made inside android via "mkyaffs2image -f /data /sdcard/userdata.img" and is not flashable via fastboot or flash_image. I'm not even sure it will work if I did manage to flash it back.
So my question is, how would I go about enabling adb in the actual rom? Or how could I flash the userdata.img backup I have?
EDIT: As an alternative, could someone provide an absolutely stock (with adb enabled) 4.67.651.3 userdata.img that I can flash to my phone?
I found a solution.
I flashed a custom boot.img that has adb enabled by default. The persist.service.adb.enable flag in default.prop needs to be changed from "persist.service.adb.enable=0" to "persist.service.adb.enable=1". Adb will remain enabled even after completely wiping the data partition.
It was a good thing that the bootloader was unlockable without a functioning screen, otherwise this wouldn't be possible.
It's just too bad there isn't much I can do with the phone in its current condition.
Hi I have the same problem but have not been successful in enabling the debugging mode. Any chance you can share the custom.boot.img you used to enable adb?
lmntone said:
I found a solution.
I flashed a custom boot.img that has adb enabled by default. The persist.service.adb.enable flag in default.prop needs to be changed from "persist.service.adb.enable=0" to "persist.service.adb.enable=1". Adb will remain enabled even after completely wiping the data partition.
It was a good thing that the bootloader was unlockable without a functioning screen, otherwise this wouldn't be possible.
It's just too bad there isn't much I can do with the phone in its current condition.
Click to expand...
Click to collapse
yangkx said:
Hi I have the same problem but have not been successful in enabling the debugging mode. Any chance you can share the custom.boot.img you used to enable adb?
Click to expand...
Click to collapse
Sure. You must be HTCDev unlocked though. Then you can "fastboot flash" or "fastboot boot" the boot image.
Also, just saying...I shall not be held responsible for any damage resulting from improper use of fastboot and/or the provided boot image.

How do you root this?

I'm seeing tons of roms and mods but no root method. Can someone point me in tbe the right direction for root methods? I just ordered this and should have it in a couple days.
It's a Nexus device, so there are few hoops to traverse, and nothing to hack.
1) Setup adb/fastboot. There is a toolkit with a simplified adb server floating around here somewhere.
2) From fastboot, unlock the bootloader using 'fastboot oem unlock' (this will factory reset, so be warned)
3) From fastboot, flash TWRP to recovery using 'fastboot flash recovery <twrp_version>.img'
4) From TWRP, install the su daemon. Usually when you reboot the system, it will detect you are not rooted and ask.
5) From the Play Store (after reboot) finalize su installation by pulling the SuperSU package.
6) Enjoy!
Note that if your N7 came with Lollipop you will need the multiboot version of TWRP. Also, while I don't recommend it, you can get TWRP installers on the Play Store that can install a recovery if you are bootloader unlocked.
jshamlet said:
It's a Nexus device, so there are few hoops to traverse, and nothing to hack.
1) Setup adb/fastboot. There is a toolkit with a simplified adb server floating around here somewhere.
2) From fastboot, unlock the bootloader using 'fastboot oem unlock' (this will factory reset, so be warned)
3) From fastboot, flash TWRP to recovery using 'fastboot flash recovery <twrp_version>.img'
4) From TWRP, install the su daemon. Usually when you reboot the system, it will detect you are not rooted and ask.
5) From the Play Store (after reboot) finalize su installation by pulling the SuperSU package.
6) Enjoy!
Note that if your N7 came with Lollipop you will need the multiboot version of TWRP. Also, while I don't recommend it, you can get TWRP installers on the Play Store that can install a recovery if you are bootloader unlocked.
Click to expand...
Click to collapse
Thanks man. I was able to get it done with Chainfire's method. Easy peezy

OP3 on 7.0 Nougat with an altered Build.prop and Android Pay (no root) - possible?

On Android 6.X with OP3 I used to do the following in order to achieve my perfect build:
Unlock the bootloader (fastboot oem unlock)
Boot into TWRP without flashing (fastboot boot twrp_version.img)
Alter the build.prop file (mount system in TWRP and "adb pull /system/build.prop ./build.prop" then edit the file with an extra line and push it back with "adb push ./build.prop /system/build.prop")
Reboot to fastboot (adb reboot-bootloader)
Lock the bootloader (fastboot oem lock)
Start up the phone.
This would let me have my custom changes in build.prop, but with a locked bootloader and NO root, so Android's safetynet would allow Android Pay and everything else to work.
I am currently unable to follow these steps (following these steps now yields a DM Verity error upon locking the bootloader) - it is simply not possible to get Android Pay to work.
Does anyone know if it's possible to simply alter a line in build.prop (I *don't* want root) but still allow Android Pay? It seems absolutely absurd to me that I can't make a simple change to this file.
I have tried creating my own signed zip of the stock OTA file with only a change to the build.prop by following a few guides, but found that the stock recovery will *not* flash it (either it won't accept my self signed key or maybe I'm doing something wrong, I don't know).

System Has Been Destroyed. probably with the OEM LOCKED.

Hello,
So today I wanted to install a Magisk module, after rebooting, it got me to a bootloop, I erased ALL DATA on adb mode (power botton and volume up). then started all over.
But the Bootloader was still unlocked (because before, I had root), The febuary update was impossible to install, so I thought, maybe locking the OEM may fix it, so I tried tool called " TOOL ALL IN ONE " that claims to have full support for my device.
After trying to OEM Lock, I get a friendly greeting that says " System has been destroyed " .
Trying to go back into ADB mode isn't working.
I have no idea if the OEM was locked, nor how to fix the phone.
I've heard of Mi Flash, but will it work on a Android One device? if so, PLEASE provide me with how to do so (in a noobie friendly way if possible)
If it'll help, I'm running on Pie with January update. No TWRP/Magisk. no current Root access.
UPDATE: I wanted to wait for an answer from you guys but I took a leap of faith and typed " fastboot oem unlock " and the phone was unlocked (showing unlocked on Android One boot screen). That got the system to start a boot! But I think it's bootlooping now. I tried entering ADB mode and I was succefully able to! then I selected to delete all data ( This helped me before to fix the bootloop ). then rebooted.
and right while I am typing this. I see a beautiful Hi there sign!!!
Bois, The phone is up and Running!!! but with all data now gone (ofc).
But still, The OEM is unlocked, Can you please recommend me a proper way to lock it?
Install dump ota febuary update in fastboot
Vitor00 said:
Install dump ota febuary update in fastboot
Click to expand...
Click to collapse
How do I do that? in a noobie way please.
wynix black said:
How do I do that? in a noobie way please.
Click to expand...
Click to collapse
Download adb and fastboot.>>>>https://androiddatahost.com/uq6us
Download ota dump>>>>>https://drive.google.com/file/d/1SZ3rOyaViNZyUzoZDbueqMAJ_Q5vKLA1/view
install adb and fastboot, and paste files from ota in the folder of adb and fastboot
open adb and fastboot and paste the commands one by one>>>>>>https://drive.google.com/open?id=1oxRLyX1x4gAQga5vwn1epHrjqtitDWRB
EDIT: To lock bootloader again, paste "fastboot oem lock" in adb and fastboot
Vitor00 said:
Download adb and fastboot.>>>>
Download ota dump>>>>>
install adb and fastboot, and paste files from ota in the folder of adb and fastboot
open adb and fastboot and paste the commands one by one>>>>>>
EDIT: To lock bootloader again, paste "fastboot oem lock" in adb and fastboot
Click to expand...
Click to collapse
Is the "ota dump" is on February update?
can I auto update easily after this or will I have to install the ota(s) manually in the future?
Are you sure that locking the oem after installing the ota won't give a system has been destroyed?
and finally, is it possible to enable Camera 2 API in the middle of the operation? Before locking the oem.
Many thanks!
Vitor00 said:
Install dump ota febuary update in fastboot
Click to expand...
Click to collapse
Vitor00 said:
Download adb and fastboot.>>>>https://androiddatahost.com/uq6us
install adb and fastboot, and paste files from ota in the folder of adb and fastboot
open adb and fastboot and paste the commands one by one
EDIT: To lock bootloader again, paste "fastboot oem lock" in adb and fastboot
Click to expand...
Click to collapse
I extracted the OTA_DAIZY.zip that you provided in the folder of minimal adb and fastboot, then typed the first command (the bluetooth one) in cmd while the phone is in Fastboot mode, CMD says " error canont load 'bluetooth.img' : no such file or directory"
please, how do I exactly " paste files from ota in the folder of adb and fastboot " ?
You can use MiFlash on this phone and not get your hands dirty with the method mentioned above. Grab the latest available stock ROM from here: https://en.miui.com/download-354.html
Download MiFlash(latest if possible). Turn off the phone and go to fastboot mode (vol down + power). Connect the phone to PC. Open MiFlash and select ROM location then click refresh, your device should be seen now. On the bottom you have options choose one then click start. DON'T interrupt the process when it's flashing.
marstonpear said:
You can use MiFlash on this phone and not get your hands dirty with the method mentioned above. Grab the latest available stock ROM from here:
Download MiFlash(latest if possible). Turn off the phone and go to fastboot mode (vol down + power). Connect the phone to PC. Open MiFlash and select ROM location then click refresh, your device should be seen now. On the bottom you have options choose one then click start. DON'T interrupt the process when it's flashing.
Click to expand...
Click to collapse
Thank you, I'm currently dowloading the stock ROM from the link you provided.
I have some questions about this,
1-you mentioned the options at the bottom, can you explain every one of them, is it as good as it sounds? one of the options is " save user data " of course i'd prefer to save my data IF it's possible and won't ruin the procces. does the "clean data and lock" can result in the System has been destroyed sign? because currently, even if i have a fresh clean all data on my phone, whenever i try to lock the bootloader (from my pc) it says system has been destroyed, If yes, will updates work fine via the settings thing or I will have to do this manually anyways? in other words, will having the oem locked give me any benefits? I'm not intrested in any warrenty/security thing.
2- if I had Magisk with root, and some of it's modules and maybe Camera 2 API enabled and I installed an update rom using Mi Flash, are they going to be deleted?
3-will this rom replace the original that i have on my phone? and my og one will be perma deleted? if I deleted all data after this procces, will it take me to a fresh instalation of this rom? or the one I had before?
4- will my phone remain unlocked after using Mi Flash with the first two options in the bottom (not "clean all and lock" ) ?
I really apologize for asking so many questions!
1- you can try save user data but the phone may not boot, I don't know the reason but I had bricked mine once and tried to flash the stock and save my data, somehow it didn't work. Try it for yourself and if it doesn't boot, flash the ROM again via MiFlash and select clean all and lock. Clean all and lock basically cleans the device, returns it to stock ROM and locks the bootloader, makes your device basically unused, you will have to set it up from scratch. If you use the clean all and lock or the clean all option, phone will boot normally and you can have updates without any problems. Locked bootloader means you can't do any changes to partitions of the device, which is good if you're not planning on rooting etc. You can have updates with either locked or unlocked BL unless of course you haven't tampered with the partitions of the device. I like locked BL because when you unlock the BL it shows another screen when booting, which I personally don't like.
2-MiFlash returns everything to stock, you will definitely lose magisk and root and the modules you installed on Magisk because using MiFlash flashes the original boot.img which makes Magisk useless. You can however get temporary root access and enable cam2API via ADB then lock the bootloader but you need to be careful with the process because you may lose your data (Locking/Unlocking BL erases all data but there's a way to bypass that)
3-As of now, the link I provided has the 10.0.3.0 (january update), if you've downloaded it your phone will install stock(from xiaomi) Pie ROM with January security patches. I forgot to write this update has issues with SIM (reverses SIM1 to SIM2) so I suggest grabbing V10.0.2.0.PDLMIFJ (Fastboot image) from here: https://forum.xda-developers.com/mi-a2-lite/how-to/ota-v9-6-4-0-odlmiff-t3823913 then flashing it via MiFlash then updating to newer versions through settings.
4- if you choose "save user data" or "clean all" your phone will stay unlocked, if you choose "clean all and lock" you will have a locked bootloader. :good:
marstonpear said:
1- you can try save user data but the phone may not boot, I don't know the reason but I had bricked mine once and tried to flash the stock and save my data, somehow it didn't work. Try it for yourself and if it doesn't boot, flash the ROM again via MiFlash and select clean all and lock. Clean all and lock basically cleans the device, returns it to stock ROM and locks the bootloader, makes your device basically unused, you will have to set it up from scratch. If you use the clean all and lock or the clean all option, phone will boot normally and you can have updates without any problems. Locked bootloader means you can't do any changes to partitions of the device, which is good if you're not planning on rooting etc. You can have updates with either locked or unlocked BL unless of course you haven't tampered with the partitions of the device. I like locked BL because when you unlock the BL it shows another screen when booting, which I personally don't like.
2-MiFlash returns everything to stock, you will definitely lose magisk and root and the modules you installed on Magisk because using MiFlash flashes the original boot.img which makes Magisk useless. You can however get temporary root access and enable cam2API via ADB then lock the bootloader but you need to be careful with the process because you may lose your data (Locking/Unlocking BL erases all data but there's a way to bypass that)
3-As of now, the link I provided has the 10.0.3.0 (january update), if you've downloaded it your phone will install stock(from xiaomi) Pie ROM with January security patches. I forgot to write this update has issues with SIM (reverses SIM1 to SIM2) so I suggest grabbing V10.0.2.0.PDLMIFJ (Fastboot image) from here: https://forum.xda-developers.com/mi-a2-lite/how-to/ota-v9-6-4-0-odlmiff-t3823913 then flashing it via MiFlash then updating to newer versions through settings.
4- if you choose "save user data" or "clean all" your phone will stay unlocked, if you choose "clean all and lock" you will have a locked bootloader. :good:
Click to expand...
Click to collapse
Thank you so much for the helpful answers!
So I flashed my phone with the first link you provided ( January update ) using Mi Flash and the option to save user data, It worked perfectly fine. not just that, but I was Finally able to get the February update using the option in the settings, I'm not aware of the SIM problem you mentioned, but i'm not experiencing any major bugs right now.
I want to get camera 2 API but I'll wait till March update to bring it ( if it exists, and launched within the first 10 days ). If the March update didn't carry with Camera 2 API enabled, I'll have to do it myself.
One last question please, How to enable the cam 2 API without magisk or touching something that may stop the built-in updater from installing? how to make it (and maybe Magisk too) survive flashing an OTA?. Will the option "save user data" protect them from getting Snapped™ ?
wynix black said:
Thank you so much for the helpful answers!
So I flashed my phone with the first link you provided ( January update ) using Mi Flash and the option to save user data, It worked perfectly fine. not just that, but I was Finally able to get the February update using the option in the settings, I'm not aware of the SIM problem you mentioned, but i'm not experiencing any major bugs right now.
I want to get camera 2 API but I'll wait till March update to bring it ( if it exists, and launched within the first 10 days ). If the March update didn't carry with Camera 2 API enabled, I'll have to do it myself.
One last question please, How to enable the cam 2 API without magisk or touching something that may stop the built-in updater from installing? how to make it (and maybe Magisk too) survive flashing an OTA?. Will the option "save user data" protect them from getting Snapped™ ?
Click to expand...
Click to collapse
I don't think Xiaomi will ever let this phone have Cam2API. They even broke GCam functionality on Pie update (on Oreo Gcam worked fine but now every Gcam has focus issues). Follow this topic to have Magisk and keep it after updates: https://forum.xda-developers.com/mi-a2-lite/how-to/guide-install-magisk-proper-support-ota-t3836952 Follow this topic to have Cam2API enabled if you don't want root/Magisk: https://forum.xda-developers.com/mi-a2-lite/how-to/guide-how-to-enable-camera2-api-t3851414 :good:

Bootloop Caused by a Magisk module, can't use adb commands..

Magisk module causing bootloop in 10.0.12/10.3.4 (Indian) oneplus 7T update , can't use adb as it is disabled in recovery, I even flashed back stock boot image to enable USB debugging but it didn't worked out..
Patched boot image of 10.3.4 /10.0.12 with magisk core only enabled will solve the problem..
I know this is a common case for oneplus 7t users as no full fledged custom recovery is available So mentioning your methods here how you escape from this situation will be helpful to other users....
Stock recovery w/ adb enabled, can mount data re (namely /data/adb/modules/) located in this thread:
https://forum.xda-developers.com/oneplus-7t/development/recovery-adb-shell-enabled-t4024661
I just created a recovery for 10.0.12 global. It may work for all devices.
To flash/use from the command line while at the bootloader:
fastboot reboot fastboot
fastboot flash recovery (filename).
fastboot reboot bootloader
Choose reboot to recovery.
Enter your pin to decrypt
Adb should work and you should be able to disable modules in /data/adb/modules/. Reboot and the module should be disabled and you can then delete it from magisk manager.
Hope this helps
Uraniam9 said:
I know this is a common case for oneplus 7t users as no full fledged custom recovery is available So mentioning your methods here how you escape from this situation will be helpful to other users....
Click to expand...
Click to collapse
The way i remove my modules with out installing any custom recovery is just by turning off the phone, connect to pc, go to command prompt, type the path of the folder where fastboot and adb is, type the following command: adb wait-for-device shell magisk --remove-modules,(while phone is off) hit enter turn phone on wait for it to get to the boot screen it will reboot, once it reboots modules will be uninstalled.
Mind you that I have never installed or modified the recovery of my OnePlus , I bought it and just unlocked the bootloader. My model is 1900

Categories

Resources