diff --git a/gui/theme/common/languages/en.xml b/gui/theme/common/languages/en.xml index d8bf2c5d..846339d1 100755 --- a/gui/theme/common/languages/en.xml +++ b/gui/theme/common/languages/en.xml @@ -751,5 +751,6 @@ 2. Format data, and/or 3. Clean-flash your ROM. The reported problem is: + Unable to get default context for {1} -- Android may not boot. diff --git a/partition.cpp b/partition.cpp index d3dfba03..f21b6a34 100755 --- a/partition.cpp +++ b/partition.cpp @@ -1687,6 +1687,12 @@ bool TWPartition::Wipe(string New_File_System) { if (Mount_Point == "/cache") Log_Offset = 0; + if (Mount_Point == PartitionManager.Get_Android_Root_Path()) { + if (tw_get_default_metadata(PartitionManager.Get_Android_Root_Path().c_str()) != 0) { + gui_msg(Msg(msg::kWarning, "restore_system_context=Unable to get default context for {1} -- Android may not boot.")(PartitionManager.Get_Android_Root_Path())); + } + } + if (Has_Data_Media && Current_File_System == New_File_System) { wiped = Wipe_Data_Without_Wiping_Media(); if (Mount_Point == "/data" && TWFunc::get_log_dir() == DATA_LOGS_DIR) { @@ -1726,6 +1732,9 @@ bool TWPartition::Wipe(string New_File_System) { if (Mount_Point == "/cache" && TWFunc::get_log_dir() != DATA_LOGS_DIR) DataManager::Output_Version(); + if (Mount_Point == PartitionManager.Get_Android_Root_Path()) { + tw_set_default_metadata(PartitionManager.Get_Android_Root_Path().c_str()); + } if (update_crypt) { Setup_File_System(false); if (Is_Encrypted && !Is_Decrypted) { diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 857ed99b..3d544e97 100755 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -1197,6 +1197,10 @@ int TWPartitionManager::Run_Restore(const string& Restore_Name) { string Full_Filename = part_settings.Backup_Folder + "/" + part_settings.Part->Backup_FileName; + if (tw_get_default_metadata(Get_Android_Root_Path().c_str()) != 0) { + gui_msg(Msg(msg::kWarning, "restore_system_context=Unable to get default context for {1} -- Android may not boot.")(Get_Android_Root_Path())); + } + if (check_digest > 0 && !twrpDigestDriver::Check_Digest(Full_Filename)) return false; part_settings.partition_count++; @@ -1252,6 +1256,7 @@ int TWPartitionManager::Run_Restore(const string& Restore_Name) { } } TWFunc::GUI_Operation_Text(TW_UPDATE_SYSTEM_DETAILS_TEXT, gui_parse_text("{@updating_system_details}")); + tw_set_default_metadata(Get_Android_Root_Path().c_str()); UnMount_By_Path(Get_Android_Root_Path(), false); Update_System_Details(); UnMount_Main_Partitions();