From 6ac30afd698be67d422e6c0daff6e4488578a0b4 Mon Sep 17 00:00:00 2001 From: Captain Throwback Date: Thu, 21 Jun 2018 10:57:12 -0400 Subject: vold_decrypt: use ANDROID_ROOT for additional compatibility Rather than using hard-coded system, use ANDROID_ROOT environment variable to allow AB devices to mount system_root at a custom path. This allows the /system path to be bind mounted from $ANDROID_ROOT/system so that the vold_decrypt paths can remain unchanged. Change-Id: I9a7b13385e43f169f1df4c75b2a003fc6913952c --- crypto/vold_decrypt/vold_decrypt.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/crypto/vold_decrypt/vold_decrypt.cpp b/crypto/vold_decrypt/vold_decrypt.cpp index ded4e7b67..707466e4c 100644 --- a/crypto/vold_decrypt/vold_decrypt.cpp +++ b/crypto/vold_decrypt/vold_decrypt.cpp @@ -1013,14 +1013,14 @@ int Vold_Decrypt_Core(const string& Password) { return VD_ERR_PASSWORD_EMPTY; } - // Mount system and check for vold and vdc - if (!PartitionManager.Mount_By_Path("/system", true)) { + // Mount ANDROID_ROOT and check for vold and vdc + if (!PartitionManager.Mount_By_Path(PartitionManager.Get_Android_Root_Path(), true)) { return VD_ERR_UNABLE_TO_MOUNT_SYSTEM; - } else if (!TWFunc::Path_Exists("/system/bin/vold")) { - LOGINFO("ERROR: /system/bin/vold not found, aborting.\n"); + } else if ((!TWFunc::Path_Exists("/system/bin/vold")) && (!TWFunc::Path_Exists(PartitionManager.Get_Android_Root_Path() + "/system/bin/vold"))) { + LOGINFO("ERROR: vold not found, aborting.\n"); return VD_ERR_MISSING_VOLD; - } else if (!TWFunc::Path_Exists("/system/bin/vdc")) { - LOGINFO("ERROR: /system/bin/vdc not found, aborting.\n"); + } else if ((!TWFunc::Path_Exists("/system/bin/vdc")) && (!TWFunc::Path_Exists(PartitionManager.Get_Android_Root_Path() + "/system/bin/vdc"))) { + LOGINFO("ERROR: vdc not found, aborting.\n"); return VD_ERR_MISSING_VDC; } @@ -1109,11 +1109,11 @@ int Vold_Decrypt_Core(const string& Password) { if (is_fstab_symlinked) Restore_Recovery_Fstab(); - if (!PartitionManager.UnMount_By_Path("/system", true)) { - // PartitionManager failed to unmount /system, this should not happen, + if (!PartitionManager.UnMount_By_Path(PartitionManager.Get_Android_Root_Path(), true)) { + // PartitionManager failed to unmount ANDROID_ROOT, this should not happen, // but in case it does, do a lazy unmount - LOGINFO("WARNING: system could not be unmounted normally!\n"); - umount2("/system", MNT_DETACH); + LOGINFO("WARNING: '%s' could not be unmounted normally!\n", PartitionManager.Get_Android_Root_Path().c_str()); + umount2(PartitionManager.Get_Android_Root_Path().c_str(), MNT_DETACH); } LOGINFO("Finished.\n"); -- cgit v1.2.3