Don't bind-mount optional partitions if they don't exist.

On a device where an additional partition doesn't exist, the mount point
of the partition is a absolute symlink to a directory inside /system. If
we bind-mount that at the corresponding symlink inside chroot, the mount
will follow the symlink and result at the location outside of chroot.

This CL also adds CHECKs to prevent similar things from happening. The
CHECKs are more strict than necessary, as it disallows any symlinks, to
prevent unforeseen situations, while relative symlinks in the path could
actually be fine. We may consider loosen the CHECKs in thee future if
needed.

Bug: 369736135
Test: atest CtsCompilationTestCases:android.compilation.cts.PreRebootDexoptTest
Change-Id: If9facfb2ebe07c5b9e7fc077a115c433ece7a325
1 file changed