More device-encrypted directory work.

Unify package directory creation logic, and always create user_de
directories to be ready for emulation mode.  Also clean up the new
user_de directories on user deletion, package uninstallation, and
data clearing.  Also run restorecon over the new user_de paths.

Bug: 22358539
Change-Id: I65ab1562db8455dae6e99dbd8965409b1bf3c6b0
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp
index bd09d92..549a420 100644
--- a/cmds/installd/utils.cpp
+++ b/cmds/installd/utils.cpp
@@ -305,6 +305,14 @@
     return result;
 }
 
+int delete_dir_contents(const std::string& pathname) {
+    return delete_dir_contents(pathname.c_str(), 0, NULL);
+}
+
+int delete_dir_contents_and_dir(const std::string& pathname) {
+    return delete_dir_contents(pathname.c_str(), 1, NULL);
+}
+
 int delete_dir_contents(const char *pathname,
                         int also_delete_dir,
                         int (*exclusion_predicate)(const char*, const int))