Offer to measure disk stats using quotas.

Now we're getting somewhere!  This CL starts using quotactl() to read
UID/GID quota statistics when called with FLAG_USE_QUOTA, otherwise
it continues using the old heavy-weight traversal for calculation.

We now set the recently defined per-app GID used for identifying
cached data, and we use the sticky GID bit on cache directories to
ensure that newly created data inherits the GID for tracking
purposes.  For any existing apps during an upgrade, an initial
bootstrapping case will recursively set this new GID.

This change also shuffles around a bunch of the tedious manual
accounting logic so that we exactly match the new quota statistics.

Test: builds, boots, quota stats match manual stats
Bug: 27948817
Change-Id: I8512c3193ce698f197a3f446e625d6a1c74e7649
diff --git a/cmds/installd/utils.h b/cmds/installd/utils.h
index 4c299fd..ff04118 100644
--- a/cmds/installd/utils.h
+++ b/cmds/installd/utils.h
@@ -86,6 +86,8 @@
         userid_t user, const char* package_name);
 
 std::string create_data_media_path(const char* volume_uuid, userid_t userid);
+std::string create_data_media_package_path(const char* volume_uuid, userid_t userid,
+        const char* data_type, const char* package_name);
 
 std::string create_data_misc_legacy_path(userid_t userid);
 
@@ -93,10 +95,16 @@
 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);
 
+std::string create_data_dalvik_cache_path();
+std::string create_data_misc_foreign_dex_path(userid_t userid);
+
 std::string create_primary_profile(const std::string& profile_dir);
 
 std::vector<userid_t> get_known_users(const char* volume_uuid);
 
+int calculate_tree_size(const std::string& path, int64_t* size,
+        gid_t include_gid = 0, gid_t exclude_gid = 0);
+
 int create_user_config_path(char path[PKG_PATH_MAX], userid_t userid);
 
 int create_move_path(char path[PKG_PATH_MAX],