Skip to content
This repository was archived by the owner on Nov 23, 2022. It is now read-only.

Commit

Permalink
Adding Edl button in reboot menu
Browse files Browse the repository at this point in the history
Edl mode is available only on qualcomm devices and it used to fully
restore the bricked devices. I made the button available only if
TW_HAS_EDL_MODE := true like the download button. I set the edl
button to the right of the download button, so devices can support
edl button and download button. I also added the translation for
all languages.

Change-Id: I69d1058b8c050b722395c7b3da6dce1ccfbe7a91
  • Loading branch information
mauronofrio authored and Dees-Troy committed Mar 20, 2019
1 parent 08f91e8 commit e9a49ef
Show file tree
Hide file tree
Showing 31 changed files with 97 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ endif
ifeq ($(TW_HAS_DOWNLOAD_MODE), true)
LOCAL_CFLAGS += -DTW_HAS_DOWNLOAD_MODE
endif
ifeq ($(TW_HAS_EDL_MODE), true)
LOCAL_CFLAGS += -DTW_HAS_EDL_MODE
endif
ifeq ($(TW_NO_SCREEN_BLANK), true)
LOCAL_CFLAGS += -DTW_NO_SCREEN_BLANK
endif
Expand Down
4 changes: 4 additions & 0 deletions data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,10 @@ void DataManager::SetDefaultValues()
printf("TW_HAS_DOWNLOAD_MODE := true\n");
mConst.SetValue(TW_DOWNLOAD_MODE, "1");
#endif
#ifdef TW_HAS_EDL_MODE
printf("TW_HAS_EDL_MODE := true\n");
mConst.SetValue(TW_EDL_MODE, "1");
#endif
#ifdef TW_INCLUDE_CRYPTO
mConst.SetValue(TW_HAS_CRYPTO, "1");
printf("TW_INCLUDE_CRYPTO := true\n");
Expand Down
19 changes: 19 additions & 0 deletions gui/theme/common/landscape.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2705,6 +2705,25 @@
</actions>
</button>

<button style="main_button">
<condition var1="tw_edl_mode" var2="1"/>
<placement x="%center_x%" y="%row11_y%"/>
<text>{@rb_edl_btn=Edl}</text>
<actions>
<action function="set">tw_back=reboot</action>
<action function="set">tw_action=reboot</action>
<action function="set">tw_action_param=edl</action>
<action function="set">tw_reboot_param=edl</action>
<action function="set">tw_has_action2=0</action>
<action function="set">tw_text1={@no_os1=No OS Installed! Are you}</action>
<action function="set">tw_text2={@no_osrb=sure you wish to reboot?}</action>
<action function="set">tw_action_text1={@rebooting=Rebooting...}</action>
<action function="set">tw_complete_text1={@rebooting=Rebooting...}</action>
<action function="set">tw_slider_text={@swipe_reboot=Swipe to Reboot}</action>
<action function="page">rebootcheck</action>
</actions>
</button>

<action>
<touch key="home"/>
<action function="page">main</action>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/cz.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Stáhnout</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Vypínání...</string>
<string name="swipe_power_off">Potáhnout pro vypnutí</string>
<string name="swipe_power_off_s">Vypnout</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/de.xml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Download</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Ausschalten...</string>
<string name="swipe_power_off">Gerät ausschalten</string>
<string name="swipe_power_off_s">Ausschalten</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/el.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Λήψη</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Απενεργοποίηση...</string>
<string name="swipe_power_off">Σύρετε για Απενεργοποίηση</string>
<string name="swipe_power_off_s">Απενεργοποίηση</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Download</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Turning Off...</string>
<string name="swipe_power_off">Swipe to Power Off</string>
<string name="swipe_power_off_s">Power Off</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/es.xml
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Descarga</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Apagando...</string>
<string name="swipe_power_off">Deslice para Apagar</string>
<string name="swipe_power_off_s">Apagar</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/fr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@
<string name="rb_recovery_btn">Récupération</string>
<string name="rb_bootloader_btn">Amorçage</string>
<string name="rb_download_btn">Télécharger</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Arrêt en cours...</string>
<string name="swipe_power_off">Glisser pour éteindre</string>
<string name="swipe_power_off_s">Éteindre</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/hu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Download mód</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Kikapcsolás...</string>
<string name="swipe_power_off">Csúsztasson a kikapcsoláshoz</string>
<string name="swipe_power_off_s">Kikapcsolás</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/it.xml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Download</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Spegnimento in corso...</string>
<string name="swipe_power_off">Scorri per spegnere</string>
<string name="swipe_power_off_s">Spegni</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/nl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Download</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Uitschakelen...</string>
<string name="swipe_power_off">Veeg om uit te schakelen</string>
<string name="swipe_power_off_s">Uitschakelen</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/pl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Download</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Wyłączanie...</string>
<string name="swipe_power_off">Przesuń, aby wyłączyć</string>
<string name="swipe_power_off_s">Wyłącz</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/pt_BR.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
<string name="rb_recovery_btn">Recuperação</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Baixar</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Desligar...</string>
<string name="swipe_power_off">Deslize para desligar</string>
<string name="swipe_power_off_s">Desligar</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/pt_PT.xml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Descarregar</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">A desligar...</string>
<string name="swipe_power_off"> Deslize para desligar</string>
<string name="swipe_power_off_s">Desligar</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@
<string name="rb_recovery_btn">Рекавери</string>
<string name="rb_bootloader_btn">Загрузчик</string>
<string name="rb_download_btn">Режим загрузки</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Выключение...</string>
<string name="swipe_power_off">Свайп для выключения</string>
<string name="swipe_power_off_s">Выключение</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/sk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Stiahnuť</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Vypínanie...</string>
<string name="swipe_power_off">Potiahnite pre vypnutie</string>
<string name="swipe_power_off_s">Vypnúť</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/sl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
<string name="rb_recovery_btn">Obnovitev</string>
<string name="rb_bootloader_btn">Zagonski nalagalnik</string>
<string name="rb_download_btn">Prejmi</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Izklapljanje …</string>
<string name="swipe_power_off">Povlecite za izklop</string>
<string name="swipe_power_off_s">Izklopi</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/sv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
<string name="rb_system_btn">System</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Ladda ner</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Stänger av...</string>
<string name="settings_hdr">Inställningar</string>
<string name="settings_gen_s_hdr">Allmänt</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/tr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Download</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Kapatılıyor...</string>
<string name="swipe_power_off">Kapatmak için Kaydır</string>
<string name="swipe_power_off_s">Kapat</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/common/languages/uk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@
<string name="rb_recovery_btn">Рекавері</string>
<string name="rb_bootloader_btn">Завантажувач</string>
<string name="rb_download_btn">Режим завантаження</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">Вимкнення...</string>
<string name="swipe_power_off">Вимкнути</string>
<string name="swipe_power_off_s">Вимкнення</string>
Expand Down
19 changes: 19 additions & 0 deletions gui/theme/common/portrait.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2862,6 +2862,25 @@
</actions>
</button>

<button style="main_button">
<condition var1="tw_edl_mode" var2="1"/>
<placement x="%center_x%" y="%row13a_y%"/>
<text>{@rb_edl_btn=Edl}</text>
<actions>
<action function="set">tw_back=reboot</action>
<action function="set">tw_action=reboot</action>
<action function="set">tw_action_param=edl</action>
<action function="set">tw_reboot_param=edl</action>
<action function="set">tw_has_action2=0</action>
<action function="set">tw_text1={@no_os1=No OS Installed! Are you}</action>
<action function="set">tw_text2={@no_osrb=sure you wish to reboot?}</action>
<action function="set">tw_action_text1={@rebooting=Rebooting...}</action>
<action function="set">tw_complete_text1={@rebooting=Rebooting...}</action>
<action function="set">tw_slider_text={@swipe_reboot=Swipe to Reboot}</action>
<action function="page">rebootcheck</action>
</actions>
</button>

<text style="text_m">
<condition var1="tw_has_boot_slots" var2="1"/>
<placement x="%center_x%" y="%row17_y%" placement="5"/>
Expand Down
18 changes: 18 additions & 0 deletions gui/theme/common/watch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3359,6 +3359,24 @@
<action function="page">rebootcheck</action>
</actions>
</button>
<button style="main_button">
<condition var1="tw_edl_mode" var2="1"/>
<placement x="%col1_x_right%" y="%row11_y%"/>
<text>{@rb_edl_btn=Edl}</text>
<actions>
<action function="set">tw_back=reboot</action>
<action function="set">tw_action=reboot</action>
<action function="set">tw_action_param=edl</action>
<action function="set">tw_reboot_param=edl</action>
<action function="set">tw_has_action2=0</action>
<action function="set">tw_text1={@no_os1=No OS Installed! Are you}</action>
<action function="set">tw_text2={@no_osrb=sure you wish to reboot?}</action>
<action function="set">tw_action_text1={@rebooting=Rebooting...}</action>
<action function="set">tw_complete_text1={@rebooting=Rebooting...}</action>
<action function="set">tw_slider_text={@swipe_reboot_s= Reboot}</action>
<action function="page">rebootcheck</action>
</actions>
</button>

<action>
<touch key="home"/>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/extra-languages/languages/ja.xml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
<string name="rb_recovery_btn">リカバリ</string>
<string name="rb_bootloader_btn">ブートローダー</string>
<string name="rb_download_btn">ダウンロード</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">電源を切っています...</string>
<string name="swipe_power_off">スワイプで電源を切る</string>
<string name="swipe_power_off_s">電源を切る</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/extra-languages/languages/zh_CN.xml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Download</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">正在关机…</string>
<string name="swipe_power_off">滑动按钮确认关机</string>
<string name="swipe_power_off_s">关机</string>
Expand Down
1 change: 1 addition & 0 deletions gui/theme/extra-languages/languages/zh_TW.xml
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@
<string name="rb_recovery_btn">Recovery</string>
<string name="rb_bootloader_btn">Bootloader</string>
<string name="rb_download_btn">Download</string>
<string name="rb_edl_btn">Edl</string>
<string name="turning_off">正在關機…</string>
<string name="swipe_power_off">滑動按鈕確認關機</string>
<string name="swipe_power_off_s">關機</string>
Expand Down
2 changes: 2 additions & 0 deletions openrecoveryscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ int OpenRecoveryScript::run_script_file(void) {
TWFunc::tw_reboot(rb_bootloader);
else if (strlen(value) && strcmp(value, "download") == 0)
TWFunc::tw_reboot(rb_download);
else if (strlen(value) && strcmp(value, "edl") == 0)
TWFunc::tw_reboot(rb_edl);
else
TWFunc::tw_reboot(rb_system);
} else if (strcmp(command, "cmd") == 0) {
Expand Down
7 changes: 7 additions & 0 deletions twrp-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,13 @@ int TWFunc::tw_reboot(RebootCommand command)
return property_set(ANDROID_RB_PROPERTY, "reboot,download");
#else
return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (void*) "download");
#endif
case rb_edl:
check_and_run_script("/sbin/rebootedl.sh", "reboot edl");
#ifdef ANDROID_RB_PROPERTY
return property_set(ANDROID_RB_PROPERTY, "reboot,edl");
#else
return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, (void*) "edl");
#endif
default:
return -1;
Expand Down
1 change: 1 addition & 0 deletions twrp-functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ typedef enum
rb_poweroff,
rb_bootloader, // May also be fastboot
rb_download,
rb_edl,
} RebootCommand;

enum Archive_Type {
Expand Down
2 changes: 2 additions & 0 deletions twrp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ int main(int argc, char **argv) {
TWFunc::tw_reboot(rb_bootloader);
else if (Reboot_Arg == "download")
TWFunc::tw_reboot(rb_download);
else if (Reboot_Arg == "edl")
TWFunc::tw_reboot(rb_edl);
else
TWFunc::tw_reboot(rb_system);

Expand Down
1 change: 1 addition & 0 deletions variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
#define TW_MIN_SYSTEM_SIZE "50" // minimum system size to allow a reboot
#define TW_MIN_SYSTEM_VAR "tw_min_system"
#define TW_DOWNLOAD_MODE "tw_download_mode"
#define TW_EDL_MODE "tw_edl_mode"
#define TW_IS_ENCRYPTED "tw_is_encrypted"
#define TW_IS_DECRYPTED "tw_is_decrypted"
#define TW_CRYPTO_PWTYPE "tw_crypto_pwtype"
Expand Down

0 comments on commit e9a49ef

Please sign in to comment.