Merge remote-tracking branch 'origin/android-9.0' into android-10.0
Change-Id: Ie850f431f0d2c39c86b9c10701676a24770ab447
This commit is contained in:
+23
-9
@@ -111,7 +111,7 @@ TWPartitionManager::TWPartitionManager(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
int TWPartitionManager::Process_Fstab(string Fstab_Filename, bool Display_Error) {
|
||||
int TWPartitionManager::Process_Fstab(string Fstab_Filename, bool Display_Error, bool Sar_Detect) {
|
||||
FILE *fstabFile;
|
||||
char fstab_line[MAX_FSTAB_LINE_LENGTH];
|
||||
TWPartition* settings_partition = NULL;
|
||||
@@ -198,7 +198,7 @@ int TWPartitionManager::Process_Fstab(string Fstab_Filename, bool Display_Error)
|
||||
fstab_line[line_size] = '\n';
|
||||
|
||||
TWPartition* partition = new TWPartition();
|
||||
if (partition->Process_Fstab_Line(fstab_line, Display_Error, &twrp_flags))
|
||||
if (partition->Process_Fstab_Line(fstab_line, Display_Error, &twrp_flags, Sar_Detect))
|
||||
Partitions.push_back(partition);
|
||||
else
|
||||
delete partition;
|
||||
@@ -213,7 +213,7 @@ int TWPartitionManager::Process_Fstab(string Fstab_Filename, bool Display_Error)
|
||||
for (std::map<string, Flags_Map>::iterator mapit=twrp_flags.begin(); mapit!=twrp_flags.end(); mapit++) {
|
||||
if (Find_Partition_By_Path(mapit->first) == NULL) {
|
||||
TWPartition* partition = new TWPartition();
|
||||
if (partition->Process_Fstab_Line(mapit->second.fstab_line, Display_Error, NULL))
|
||||
if (partition->Process_Fstab_Line(mapit->second.fstab_line, Display_Error, NULL, Sar_Detect))
|
||||
Partitions.push_back(partition);
|
||||
else
|
||||
delete partition;
|
||||
@@ -227,6 +227,13 @@ int TWPartitionManager::Process_Fstab(string Fstab_Filename, bool Display_Error)
|
||||
|
||||
std::vector<TWPartition*>::iterator iter;
|
||||
for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
|
||||
if (Sar_Detect) {
|
||||
if ((*iter)->Mount_Point == "/s")
|
||||
return true;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
(*iter)->Partition_Post_Processing(Display_Error);
|
||||
|
||||
if ((*iter)->Is_Storage) {
|
||||
@@ -592,6 +599,8 @@ TWPartition* TWPartitionManager::Find_Partition_By_Path(const string& Path) {
|
||||
std::vector<TWPartition*>::iterator iter;
|
||||
string Local_Path = TWFunc::Get_Root_Path(Path);
|
||||
|
||||
if (Local_Path == "/system")
|
||||
Local_Path = Get_Android_Root_Path();
|
||||
for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
|
||||
if ((*iter)->Mount_Point == Local_Path || (!(*iter)->Symlink_Mount_Point.empty() && (*iter)->Symlink_Mount_Point == Local_Path))
|
||||
return (*iter);
|
||||
@@ -1265,8 +1274,12 @@ void TWPartitionManager::Set_Restore_Files(string Restore_Name) {
|
||||
Part->Backup_FileName.resize(Part->Backup_FileName.size() - strlen(extn) + 3);
|
||||
}
|
||||
|
||||
if (!Part->Is_SubPartition)
|
||||
Restore_List += Part->Backup_Path + ";";
|
||||
if (!Part->Is_SubPartition) {
|
||||
if (Part->Backup_Path == Get_Android_Root_Path())
|
||||
Restore_List += "/system;";
|
||||
else
|
||||
Restore_List += Part->Backup_Path + ";";
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
}
|
||||
@@ -1289,6 +1302,8 @@ int TWPartitionManager::Wipe_By_Path(string Path) {
|
||||
bool found = false;
|
||||
string Local_Path = TWFunc::Get_Root_Path(Path);
|
||||
|
||||
if (Local_Path == "/system")
|
||||
Local_Path = Get_Android_Root_Path();
|
||||
// Iterate through all partitions
|
||||
for (iter = Partitions.begin(); iter != Partitions.end(); iter++) {
|
||||
if ((*iter)->Mount_Point == Local_Path || (!(*iter)->Symlink_Mount_Point.empty() && (*iter)->Symlink_Mount_Point == Local_Path)) {
|
||||
@@ -2839,10 +2854,9 @@ string TWPartitionManager::Get_Active_Slot_Display() {
|
||||
}
|
||||
|
||||
string TWPartitionManager::Get_Android_Root_Path() {
|
||||
std::string Android_Root = getenv("ANDROID_ROOT");
|
||||
if (Android_Root == "")
|
||||
Android_Root = "/system";
|
||||
return Android_Root;
|
||||
if (property_get_bool("ro.twrp.sar", false))
|
||||
return "/system_root";
|
||||
return "/system";
|
||||
}
|
||||
|
||||
void TWPartitionManager::Remove_Uevent_Devices(const string& Mount_Point) {
|
||||
|
||||
Reference in New Issue
Block a user