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
diff --git a/crypto/vold_decrypt/vold_decrypt.cpp b/crypto/vold_decrypt/vold_decrypt.cpp
index ded4e7b..707466e 100644
--- a/crypto/vold_decrypt/vold_decrypt.cpp
+++ b/crypto/vold_decrypt/vold_decrypt.cpp
@@ -1013,14 +1013,14 @@
 		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 @@
 	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");