From 89583ef00f54369be2b5ab3495495616056eba13 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Wed, 26 Aug 2015 09:01:59 -0500 Subject: Fix up some TW_OEM_BUILD things Fix factory reset now properly formats data as expected Change text for ORS processing Disable system read only check, SuperSU, and patch system Stop copying fstab and version to cache Change-Id: I20f5cae390afbb8d2d88e01b8d9b9bf4ff0fdea1 --- data.cpp | 2 ++ openrecoveryscript.cpp | 7 ++++++- partitionmanager.cpp | 13 +++++++++++-- twrp.cpp | 4 ++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/data.cpp b/data.cpp index d7b02f1d6..7364b9f4e 100644 --- a/data.cpp +++ b/data.cpp @@ -1005,6 +1005,7 @@ int DataManager::GetMagicValue(const string varName, string& value) void DataManager::Output_Version(void) { +#ifndef TW_OEM_BUILD string Path; char version[255]; @@ -1035,6 +1036,7 @@ void DataManager::Output_Version(void) PartitionManager.Output_Storage_Fstab(); sync(); LOGINFO("Version number saved to '%s'\n", Path.c_str()); +#endif } void DataManager::ReadSettingsFile(void) diff --git a/openrecoveryscript.cpp b/openrecoveryscript.cpp index cf6f598c5..cf24cbade 100644 --- a/openrecoveryscript.cpp +++ b/openrecoveryscript.cpp @@ -576,9 +576,14 @@ void OpenRecoveryScript::Run_OpenRecoveryScript(void) { DataManager::SetValue("tw_has_action2", "0"); DataManager::SetValue("tw_action2", ""); DataManager::SetValue("tw_action2_param", ""); +#ifdef TW_OEM_BUILD + DataManager::SetValue("tw_action_text1", "Running Recovery Commands"); + DataManager::SetValue("tw_complete_text1", "Recovery Commands Complete"); +#else DataManager::SetValue("tw_action_text1", "Running OpenRecoveryScript"); - DataManager::SetValue("tw_action_text2", ""); DataManager::SetValue("tw_complete_text1", "OpenRecoveryScript Complete"); +#endif + DataManager::SetValue("tw_action_text2", ""); DataManager::SetValue("tw_has_cancel", 0); DataManager::SetValue("tw_show_reboot", 0); if (gui_startPage("action_page", 0, 1) != 0) { diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 0262648f1..bf4b38247 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -1095,8 +1095,17 @@ int TWPartitionManager::Factory_Reset(void) { for (iter = Partitions.begin(); iter != Partitions.end(); iter++) { if ((*iter)->Wipe_During_Factory_Reset && (*iter)->Is_Present) { - if (!(*iter)->Wipe()) - ret = false; +#ifdef TW_OEM_BUILD + if ((*iter)->Mount_Point == "/data") { + if (!(*iter)->Wipe_Encryption()) + ret = false; + } else { +#endif + if (!(*iter)->Wipe()) + ret = false; +#ifdef TW_OEM_BUILD + } +#endif } else if ((*iter)->Has_Android_Secure) { if (!(*iter)->Wipe_AndSec()) ret = false; diff --git a/twrp.cpp b/twrp.cpp index 091de19fd..219c30612 100644 --- a/twrp.cpp +++ b/twrp.cpp @@ -332,6 +332,7 @@ int main(int argc, char **argv) { PartitionManager.Disable_MTP(); #endif +#ifndef TW_OEM_BUILD // Check if system has never been changed TWPartition* sys = PartitionManager.Find_Partition_By_Path("/system"); if (sys) { @@ -350,10 +351,12 @@ int main(int argc, char **argv) { sys->Change_Mount_Read_Only(false); } } +#endif // Launch the main GUI gui_start(); +#ifndef TW_OEM_BUILD // Disable flashing of stock recovery TWFunc::Disable_Stock_Recovery_Replace(); // Check for su to see if the device is rooted or not @@ -368,6 +371,7 @@ int main(int argc, char **argv) { sync(); PartitionManager.UnMount_By_Path("/system", false); } +#endif // Reboot TWFunc::Update_Intent_File(Reboot_Value); -- cgit v1.2.3