Hovatek Forum DEVELOPMENT Android [Tutorial] How to enable / disable certain TWRP features without kernel source code
Can't login? Please, reset your password.
Hovatek is recruiting! Apply Now


[Tutorial] How to enable / disable certain TWRP features without kernel source code

[Tutorial] How to enable / disable certain TWRP features without kernel source code

X3non
X3non
X3non
Recognized Contributor
22,062
27-05-2019, 12:33 PM
#1



In this tutorial, i'll be showing how to enable and disable certain TWRP features without having kernel source code (which is almost impossible to get for some phones). As we know TWRP has certain flags to enable or disable features e.g of what TWRP flag looks like in boardconfig.mk to remove the 'Reboot bootloader' button as seen below
Code:

TW_NO_REBOOT_BOOTLOADER := true
I'll be attempting to disable "reboot bootloader" in TWRP >> reboot and enable "partition sd card" in TWRP >> Advanced as examples. You can play around and make other findings yourself


Requirements

  • TWRP recovery ; you can port one yourself OR using our porting tool
  • Notepad++
  • Unpack your TWRP OR unpack using Android Image Kitchen (whichever method you find easier)


Steps on how to enable and disable TWRP features without having kernel source code


Follow the steps below to enable and disable TWRP features without having kernel source code

  1. Navigate to the Unpack folder >> Ramdisk\twres\ >>> Edit potrait.xml using notepad++ (by default notepad++ won't open xml files so be sure to rename the file extension to something different e.g .txt)

    [Image: how-to-enable-and-disable-certain-TWRP-f...code-1.jpg]

  2. To disable reboot bootloader option, we'll need to search for the section hold reboot bootloader values. You can scroll down until you find this or search for common names eg "bootloader"
  3. There might be more than one item found, we're actually looking for the one that's under the button tags
    Code:

    <button style="main_button">
    <condition...

    [Image: how-to-enable-and-disable-certain-TWRP-f...code-2.jpg]

  4. The entire highlighted text is the section for reboot bootloader, in my TWRP this option is already enable so to disable it, simply modify the condition values as seen below OR highlight and delete the entire section

    [Image: how-to-enable-and-disable-certain-TWRP-f...code-3.jpg]

  5. Modify the condition statement as seen below

    [Image: how-to-enable-and-disable-certain-TWRP-f...code-4.jpg]

  6. Save the file, if you renamed the file extension then ensure to rename back to .xml then repack recovery, flash and boot to TWRP then confirm that reboot bootloader option has been disabled

  7. Now to enable feature, e.g i want to enable partition sd card feature, still on the same portait.xml file
  8. Once again, we can search for a common names based on what you're looking for e.g "Partition SD Card", "Partition", or just 'SD card"

    [Image: how-to-enable-and-disable-certain-TWRP-f...code-5.jpg]

  9. There might be more than one item found, we're actually looking for the one that's under the button tags
    Code:

    <button style="main_button">
    <condition...

    [Image: how-to-enable-and-disable-certain-TWRP-f...code-6.jpg]

  10. In my TWRP this option is disable (missing) so to enable it, simply modify the condition values as seen below OR highlight and delete the entire conditional statement line
    • e.g of modifying the statement as seen below

      [Image: how-to-enable-and-disable-certain-TWRP-f...code-7.jpg]

    • e.g of deleting the conditional statement line

      [Image: how-to-enable-and-disable-certain-TWRP-f...code-8.jpg]

  11. Save the file, if you renamed the file extension then ensure to rename back to .xml then repack recovery, flash and boot to TWRP then confirm that the partition sd card option has been enabled


Important Notice
  • This doesn't work for all TWRP flag features as you will notice not everything is within potrait.xml file
  • When modifying this xml file, ensure to carefully edit values as mistakenly deleting a single quote sign " could lead to a broken TWRP
This post was last modified: 05-10-2019, 03:07 AM by X3non.
xerxes
xerxes
xerxes
Senior Member
8,355
27-05-2019, 06:40 PM
#2
Thanks a lot X3non! I try it at night and I will tell you the result.

Sent from my TECNO CX Air using Tapatalk
This post was last modified: 27-05-2019, 06:41 PM by xerxes.
xerxes
xerxes
xerxes
Senior Member
8,355
28-05-2019, 03:15 PM
#3
Can I add locking feature to the latest TWRP 3.2.1 or 3.2.3 by adding stg to the portrait.xml?

I tried to lock my TWRP but still I can't do it the project leader told me that they don't add this feature never and ever.



Sent from my TECNO CX Air using Tapatalk
X3non
X3non
X3non
Recognized Contributor
22,062
28-05-2019, 05:49 PM
#4
(28-05-2019, 03:15 PM)Mikesew Can I add locking feature to the latest TWRP 3.2.1 or 3.2.3 by adding stg to the portrait.xml?
I tried to lock my TWRP but still I can't do it the project leader told me that they don't add this feature never and ever.

Sent from my TECNO CX Air using Tapatalk

Not sure, and i doubt adding anything to potrait.xml will work
you can try it out yourself
xerxes
xerxes
xerxes
Senior Member
8,355
28-05-2019, 09:33 PM
#5



I didn't have the code for the locked condition can you help me with this?

Sent from my TECNO CX Air using Tapatalk
X3non
X3non
X3non
Recognized Contributor
22,062
29-05-2019, 09:39 AM
#6
(28-05-2019, 09:33 PM)Mikesew I didn't have the code for the locked condition can you help me with this?

Sent from my TECNO CX Air using Tapatalk

I don't either
Users browsing this thread:
 1 Guest(s)
Users browsing this thread:
 1 Guest(s)
YtWhTl
live chat
whatsapp telegram instagram