summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-01-25 16:01:29 +0100
committerDees_Troy <dees_troy@teamw.in>2013-01-25 16:10:48 +0100
commit6ed34b7f61c144a09d457d608290eea81aae702d (patch)
treef1d6a3d3b680fb69e7e9520e4e92e564f594e119 /recovery.cpp
parentConvert AOSP commands to ORS for encrypted devices (diff)
downloadandroid_bootable_recovery-6ed34b7f61c144a09d457d608290eea81aae702d.tar
android_bootable_recovery-6ed34b7f61c144a09d457d608290eea81aae702d.tar.gz
android_bootable_recovery-6ed34b7f61c144a09d457d608290eea81aae702d.tar.bz2
android_bootable_recovery-6ed34b7f61c144a09d457d608290eea81aae702d.tar.lz
android_bootable_recovery-6ed34b7f61c144a09d457d608290eea81aae702d.tar.xz
android_bootable_recovery-6ed34b7f61c144a09d457d608290eea81aae702d.tar.zst
android_bootable_recovery-6ed34b7f61c144a09d457d608290eea81aae702d.zip
Diffstat (limited to '')
-rw-r--r--recovery.cpp39
1 files changed, 10 insertions, 29 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 7d1dd142e..20684fdd5 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -958,41 +958,22 @@ main(int argc, char **argv) {
//if (status != INSTALL_SUCCESS) ui->SetBackground(RecoveryUI::ERROR);
if (1) {
finish_recovery(NULL);
- DataManager_ReadSettingsFile();
if (PartitionManager.Mount_By_Path("/system", false) && TWFunc::Path_Exists("/system/recovery-from-boot.p")) {
rename("/system/recovery-from-boot.p", "/system/recovery-from-boot.bak");
ui_print("Renamed stock recovery file in /system to prevent\nthe stock ROM from replacing TWRP.\n");
}
PartitionManager.UnMount_By_Path("/system", false);
- if (DataManager_GetIntValue(TW_IS_ENCRYPTED) == 0) {
- // Check for the SCRIPT_FILE_TMP first as these are AOSP recovery commands
- // that we converted to ORS commands up above. Run those first.
- int boot_recovery = 1, check = 1;
- if (TWFunc::Path_Exists(SCRIPT_FILE_TMP)) {
- boot_recovery = 0;
- gui_console_only();
- if (OpenRecoveryScript::run_script_file() != 0) {
- // There was an error, boot the recovery
- check = 0;
- gui_start();
- } else {
- usleep(2000000); // Sleep for 2 seconds before rebooting
- }
- }
- // Check for the ORS file in /cache and attempt to run those commands.
- if (check && OpenRecoveryScript::check_for_script_file()) {
- boot_recovery = 0;
- if (OpenRecoveryScript::run_script_file() != 0) {
- // There was an error, boot the recovery
- gui_start();
- } else {
- usleep(2000000); // Sleep for 2 seconds before rebooting
- }
+ if (DataManager_GetIntValue(TW_IS_ENCRYPTED) != 0) {
+ LOGI("Is encrypted, do decrypt page first\n");
+ if (gui_startPage("decrypt") != 0) {
+ LOGE("Failed to start decrypt GUI page.\n");
}
- if (boot_recovery)
- gui_start();
- } else
- gui_start();
+ }
+ DataManager_ReadSettingsFile();
+ if (DataManager_GetIntValue(TW_IS_ENCRYPTED) == 0 && (TWFunc::Path_Exists(SCRIPT_FILE_TMP) || TWFunc::Path_Exists(SCRIPT_FILE_CACHE))) {
+ OpenRecoveryScript::Run_OpenRecoveryScript();
+ }
+ gui_start();
//prompt_and_wait(device);
}