Include user identifier in external storage paths.

When building external storage paths, always include user in path
to enable cross-user paths and aid debugging.

Each Zygote process continues to only have access to the appropriate
user-specific emulated storage through bind mounts. A second set of
mounts continue supporting legacy /sdcard-style paths. For example,
a process running as owner has these mount points:

/storage/emulated_legacy
/storage/emulated_legacy/Android/obb
/storage/emulated/0
/storage/emulated/obb

This change also creates two nested namespaces around zygote. The
first namespace is created when the zygote starts, and it holds a
single writable tmpfs, since rootfs is ro. The second namespace is
created quickly after forking, and is used to hold the private
user-specific bind mounts. (This design saves us from creating a
tmpfs-per-process.)

Bug: 7131382
Change-Id: Id80403ec956f0bff6997411cb1f82f273c76b85f
2 files changed