openrecoveryscript: do not skip decryption even if using block.map

- Allows addon.d scripts to run that require access
  to decrypted /data (e.g. Magisk). Seems to also affect
  GApps addon.d script, resulting in non-booting system
- If decryption prompt is canceled, installation will
  still proceed (i.e. on devices where TWRP doesn't
  support encryption)
- Should resolve
  https://github.com/TeamWin/Team-Win-Recovery-Project/issues/1478
  and possibly
  https://github.com/TeamWin/Team-Win-Recovery-Project/issues/1459

Change-Id: Idcd397aa145577c409d5174ae3f9c48474e5734b
This commit is contained in:
Captain Throwback
2019-07-04 14:26:39 -04:00
committed by bigbiff
parent d54e1da83e
commit f8d0e2156e

View File

@@ -127,7 +127,6 @@ int main(int argc, char **argv) {
gui_loadResources();
bool Shutdown = false;
bool SkipDecryption = false;
string Send_Intent = "";
{
TWPartition* misc = PartitionManager.Find_Partition_By_Path("/misc");
@@ -162,9 +161,6 @@ int main(int argc, char **argv) {
string ORSCommand = "install ";
ORSCommand.append(ptr);
// If we have a map of blocks we don't need to mount data.
SkipDecryption = *ptr == '@';
if (!OpenRecoveryScript::Insert_ORS_Command(ORSCommand))
break;
} else
@@ -232,17 +228,13 @@ int main(int argc, char **argv) {
// Offer to decrypt if the device is encrypted
if (DataManager::GetIntValue(TW_IS_ENCRYPTED) != 0) {
if (SkipDecryption) {
LOGINFO("Skipping decryption\n");
LOGINFO("Is encrypted, do decrypt page first\n");
if (gui_startPage("decrypt", 1, 1) != 0) {
LOGERR("Failed to start decrypt GUI page.\n");
} else {
LOGINFO("Is encrypted, do decrypt page first\n");
if (gui_startPage("decrypt", 1, 1) != 0) {
LOGERR("Failed to start decrypt GUI page.\n");
} else {
// Check for and load custom theme if present
TWFunc::check_selinux_support();
gui_loadCustomResources();
}
// Check for and load custom theme if present
TWFunc::check_selinux_support();
gui_loadCustomResources();
}
} else if (datamedia) {
TWFunc::check_selinux_support();
@@ -266,7 +258,8 @@ int main(int argc, char **argv) {
// Run any outstanding OpenRecoveryScript
std::string cacheDir = TWFunc::get_cache_dir();
std::string orsFile = cacheDir + "/recovery/openrecoveryscript";
if ((DataManager::GetIntValue(TW_IS_ENCRYPTED) == 0 || SkipDecryption) && (TWFunc::Path_Exists(SCRIPT_FILE_TMP) || TWFunc::Path_Exists(orsFile))) {
if (TWFunc::Path_Exists(SCRIPT_FILE_TMP) || (DataManager::GetIntValue(TW_IS_ENCRYPTED) == 0 && TWFunc::Path_Exists(orsFile))) {
OpenRecoveryScript::Run_OpenRecoveryScript();
}