summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@yahoo.com>2013-02-21 21:28:29 +0100
committerDees_Troy <dees_troy@yahoo.com>2013-02-21 21:28:29 +0100
commitd15e3f7def317314f9110895903ae2733f60a0be (patch)
treea49a18afcb26844139c938a177ae3e41eac3dc92
parentCheck for root and root perms and offer to install/fix (diff)
downloadandroid_bootable_recovery-d15e3f7def317314f9110895903ae2733f60a0be.tar
android_bootable_recovery-d15e3f7def317314f9110895903ae2733f60a0be.tar.gz
android_bootable_recovery-d15e3f7def317314f9110895903ae2733f60a0be.tar.bz2
android_bootable_recovery-d15e3f7def317314f9110895903ae2733f60a0be.tar.lz
android_bootable_recovery-d15e3f7def317314f9110895903ae2733f60a0be.tar.xz
android_bootable_recovery-d15e3f7def317314f9110895903ae2733f60a0be.tar.zst
android_bootable_recovery-d15e3f7def317314f9110895903ae2733f60a0be.zip
-rw-r--r--recovery.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 8969ebc6e..a01ca8c11 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -955,30 +955,30 @@ main(int argc, char **argv) {
}
}
- //if (status != INSTALL_SUCCESS) ui->SetBackground(RecoveryUI::ERROR);
- if (1) {
- finish_recovery(NULL);
- 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) {
- LOGI("Is encrypted, do decrypt page first\n");
- if (gui_startPage("decrypt") != 0) {
- LOGE("Failed to start decrypt GUI page.\n");
- }
- }
- DataManager_ReadSettingsFile();
- if (DataManager_GetIntValue(TW_IS_ENCRYPTED) == 0 && (TWFunc::Path_Exists(SCRIPT_FILE_TMP) || TWFunc::Path_Exists(SCRIPT_FILE_CACHE))) {
- OpenRecoveryScript::Run_OpenRecoveryScript();
+ finish_recovery(NULL);
+ // Offer to decrypt if the device is encrypted
+ 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");
}
- gui_start();
- //prompt_and_wait(device);
- }
+ }
+ // Read the settings file
+ DataManager_ReadSettingsFile();
+ // Run any outstanding OpenRecoveryScript
+ if (DataManager_GetIntValue(TW_IS_ENCRYPTED) == 0 && (TWFunc::Path_Exists(SCRIPT_FILE_TMP) || TWFunc::Path_Exists(SCRIPT_FILE_CACHE))) {
+ OpenRecoveryScript::Run_OpenRecoveryScript();
+ }
+ // Launch the main GUI
+ gui_start();
// Check for su to see if the device is rooted or not
if (PartitionManager.Mount_By_Path("/system", false)) {
+ // Disable flashing of stock recovery
+ if (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");
+ }
if (TWFunc::Path_Exists("/res/supersu/su") && !TWFunc::Path_Exists("/system/bin/su") && !TWFunc::Path_Exists("/system/xbin/su") && !TWFunc::Path_Exists("/system/bin/.ext/.su")) {
// Device doesn't have su installed
DataManager_SetIntValue("tw_busy", 1);
@@ -992,6 +992,8 @@ main(int argc, char **argv) {
LOGE("Failed to start decrypt GUI page.\n");
}
}
+ sync();
+ PartitionManager.UnMount_By_Path("/system", false);
}
// Otherwise, get ready to boot the main system...