Consistent creation/destruction of user data.

Preparing and destroying users currently needs to be split across
installd, system_server, and vold, since no single party has all the
required SELinux permissions.

Start passing down flags so we only prepare/destroy storage areas
that have keys currently installed.

Add delete_dir_contents_and_dir() argument to ignore ENOENT, since
all we care about is the directory being gone.

Bug: 27896918
Change-Id: Ia1cccc9b35e6ff09e3ca50effeab676157b856e8
diff --git a/cmds/installd/utils.h b/cmds/installd/utils.h
index 9d9a423..477baea 100644
--- a/cmds/installd/utils.h
+++ b/cmds/installd/utils.h
@@ -85,6 +85,8 @@
 
 std::string create_data_media_path(const char* volume_uuid, userid_t userid);
 
+std::string create_data_misc_legacy_path(userid_t userid);
+
 std::string create_data_user_profiles_path(userid_t userid);
 std::string create_data_user_profile_package_path(userid_t user, const char* package_name);
 std::string create_data_ref_profile_package_path(const char* package_name);
@@ -140,8 +142,6 @@
 char *build_string2(const char *s1, const char *s2);
 char *build_string3(const char *s1, const char *s2, const char *s3);
 
-int ensure_dir(const char* path, mode_t mode, uid_t uid, gid_t gid);
-int ensure_media_user_dirs(const char* uuid, userid_t userid);
 int ensure_config_user_dirs(userid_t userid);
 
 int wait_child(pid_t pid);