summaryrefslogtreecommitdiffstats
path: root/cmds/installd/utils.cpp
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2015-04-30 15:58:19 -0700
committerJeff Sharkey <jsharkey@android.com>2015-04-30 16:02:58 -0700
commitd792118c493806eeb24a8203f508e6e18fe93bd7 (patch)
tree4062688e4b0c804601f3ff3f2f962a28e98d5cae /cmds/installd/utils.cpp
parent7a6c5861619ab42f2a34903591ed24a265f68c26 (diff)
downloadframeworks_native-d792118c493806eeb24a8203f508e6e18fe93bd7.zip
frameworks_native-d792118c493806eeb24a8203f508e6e18fe93bd7.tar.gz
frameworks_native-d792118c493806eeb24a8203f508e6e18fe93bd7.tar.bz2
Offer to move both code and data together.
We now move code under /data/app/com.example when a complete move is requested. This really only works for new cluster-style installs that also have native libraries and OAT contained inside. Teach measuring code about cluster-style installs when measuring app footprint. Also offer to measure private data space for all users. Bug: 19993667, 20275578 Change-Id: I6df7b947cb5cc8a4552f56f4b64a661e8512389f
Diffstat (limited to 'cmds/installd/utils.cpp')
-rw-r--r--cmds/installd/utils.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/cmds/installd/utils.cpp b/cmds/installd/utils.cpp
index ba411cd..3f679a2 100644
--- a/cmds/installd/utils.cpp
+++ b/cmds/installd/utils.cpp
@@ -37,16 +37,31 @@ static bool is_valid_filename(const std::string& name) {
}
/**
+ * Create the path name where package app contents should be stored for
+ * the given volume UUID and package name. An empty UUID is assumed to
+ * be internal storage.
+ */
+std::string create_data_app_package_path(const char* volume_uuid,
+ const char* package_name) {
+ CHECK(is_valid_filename(package_name));
+ CHECK(is_valid_package_name(package_name) == 0);
+
+ return StringPrintf("%s/%s",
+ create_data_app_path(volume_uuid).c_str(), package_name);
+}
+
+/**
* Create the path name where package data should be stored for the given
* volume UUID, package name, and user ID. An empty UUID is assumed to be
* internal storage.
*/
-std::string create_package_data_path(const char* volume_uuid,
- const char* package_name, userid_t user) {
+std::string create_data_user_package_path(const char* volume_uuid,
+ userid_t user, const char* package_name) {
CHECK(is_valid_filename(package_name));
CHECK(is_valid_package_name(package_name) == 0);
- return StringPrintf("%s/%s", create_data_user_path(volume_uuid, user).c_str(), package_name);
+ return StringPrintf("%s/%s",
+ create_data_user_path(volume_uuid, user).c_str(), package_name);
}
int create_pkg_path(char path[PKG_PATH_MAX], const char *pkgname,
@@ -56,7 +71,7 @@ int create_pkg_path(char path[PKG_PATH_MAX], const char *pkgname,
return -1;
}
- std::string _tmp(create_package_data_path(nullptr, pkgname, userid) + postfix);
+ std::string _tmp(create_data_user_package_path(nullptr, userid, pkgname) + postfix);
const char* tmp = _tmp.c_str();
if (strlen(tmp) >= PKG_PATH_MAX) {
path[0] = '\0';
@@ -77,6 +92,13 @@ std::string create_data_path(const char* volume_uuid) {
}
/**
+ * Create the path name for app data.
+ */
+std::string create_data_app_path(const char* volume_uuid) {
+ return StringPrintf("%s/app", create_data_path(volume_uuid).c_str());
+}
+
+/**
* Create the path name for user data for a certain userid.
*/
std::string create_data_user_path(const char* volume_uuid, userid_t userid) {