diff options
Diffstat (limited to 'cmds/installd/installd.h')
-rw-r--r-- | cmds/installd/installd.h | 74 |
1 files changed, 48 insertions, 26 deletions
diff --git a/cmds/installd/installd.h b/cmds/installd/installd.h index a3a5c16..f31bf4f 100644 --- a/cmds/installd/installd.h +++ b/cmds/installd/installd.h @@ -31,6 +31,8 @@ #include <sys/socket.h> #include <sys/types.h> #include <sys/wait.h> +#include <string> +#include <vector> #include <cutils/fs.h> #include <cutils/sockets.h> @@ -40,7 +42,7 @@ #include <private/android_filesystem_config.h> -#if INCLUDE_SYS_MOUNT_FOR_STATFS +#if defined(__APPLE__) #include <sys/mount.h> #else #include <sys/statfs.h> @@ -83,6 +85,13 @@ #define PKG_NAME_MAX 128 /* largest allowed package name */ #define PKG_PATH_MAX 256 /* max size of any path we use */ +/* dexopt needed flags matching those in dalvik.system.DexFile */ +#define DEXOPT_DEX2OAT_NEEDED 1 +#define DEXOPT_PATCHOAT_NEEDED 2 +#define DEXOPT_SELF_PATCHOAT_NEEDED 3 + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) + /* data structures */ typedef struct { @@ -101,6 +110,7 @@ extern dir_rec_t android_app_lib_dir; extern dir_rec_t android_data_dir; extern dir_rec_t android_asec_dir; extern dir_rec_t android_media_dir; +extern dir_rec_t android_mnt_expand_dir; extern dir_rec_array_t android_system_dirs; typedef struct cache_dir_struct { @@ -132,20 +142,22 @@ typedef struct { /* util.c */ -int create_pkg_path_in_dir(char path[PKG_PATH_MAX], - const dir_rec_t* dir, - const char* pkgname, - const char* postfix); +// TODO: rename to create_data_user_package_path +std::string create_package_data_path(const char* volume_uuid, + const char* package_name, userid_t user); int create_pkg_path(char path[PKG_PATH_MAX], const char *pkgname, const char *postfix, userid_t userid); -int create_user_path(char path[PKG_PATH_MAX], - userid_t userid); +std::string create_data_path(const char* volume_uuid); + +std::string create_data_user_path(const char* volume_uuid, userid_t userid); + +std::string create_data_media_path(const char* volume_uuid, userid_t userid); -int create_user_media_path(char path[PKG_PATH_MAX], userid_t userid); +std::vector<userid_t> get_known_users(const char* volume_uuid); int create_user_config_path(char path[PKG_PATH_MAX], userid_t userid); @@ -169,13 +181,13 @@ int copy_dir_files(const char *srcname, const char *dstname, uid_t owner, gid_t int lookup_media_dir(char basepath[PATH_MAX], const char *dir); -int64_t data_disk_free(); +int64_t data_disk_free(const std::string& data_path); cache_t* start_cache_collection(); void add_cache_files(cache_t* cache, const char *basepath, const char *cachedir); -void clear_cache_files(cache_t* cache, int64_t free_size); +void clear_cache_files(const std::string& data_path, cache_t* cache, int64_t free_size); void finish_cache_collection(cache_t* cache); @@ -191,38 +203,48 @@ int validate_apk_path(const char *path); int append_and_increment(char** dst, const char* src, size_t* dst_size); -char *build_string2(char *s1, char *s2); -char *build_string3(char *s1, char *s2, char *s3); +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(userid_t userid); +int ensure_media_user_dirs(const char* uuid, userid_t userid); int ensure_config_user_dirs(userid_t userid); int create_profile_file(const char *pkgname, gid_t gid); void remove_profile_file(const char *pkgname); /* commands.c */ -int install(const char *pkgname, uid_t uid, gid_t gid, const char *seinfo); -int uninstall(const char *pkgname, userid_t userid); +int install(const char *uuid, const char *pkgname, uid_t uid, gid_t gid, const char *seinfo); +int uninstall(const char *uuid, const char *pkgname, userid_t userid); int renamepkg(const char *oldpkgname, const char *newpkgname); -int fix_uid(const char *pkgname, uid_t uid, gid_t gid); -int delete_user_data(const char *pkgname, userid_t userid); -int make_user_data(const char *pkgname, uid_t uid, userid_t userid, const char* seinfo); +int fix_uid(const char *uuid, const char *pkgname, uid_t uid, gid_t gid); +int delete_user_data(const char *uuid, const char *pkgname, userid_t userid); +int make_user_data(const char *uuid, const char *pkgname, uid_t uid, + userid_t userid, const char* seinfo); +int move_user_data(const char* from_uuid, const char *to_uuid, + const char *package_name, appid_t appid, const char* seinfo); int make_user_config(userid_t userid); -int delete_user(userid_t userid); -int delete_cache(const char *pkgname, userid_t userid); -int delete_code_cache(const char *pkgname, userid_t userid); +int delete_user(const char *uuid, userid_t userid); +int delete_cache(const char *uuid, const char *pkgname, userid_t userid); +int delete_code_cache(const char *uuid, const char *pkgname, userid_t userid); int move_dex(const char *src, const char *dst, const char *instruction_set); int rm_dex(const char *path, const char *instruction_set); int protect(char *pkgname, gid_t gid); -int get_size(const char *pkgname, userid_t userid, const char *apkpath, const char *libdirpath, +int get_size(const char *uuid, const char *pkgname, userid_t userid, const char *apkpath, const char *libdirpath, const char *fwdlock_apkpath, const char *asecpath, const char *instruction_set, int64_t *codesize, int64_t *datasize, int64_t *cachesize, int64_t *asecsize); -int free_cache(int64_t free_size); +int free_cache(const char *uuid, int64_t free_size); int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName, - const char *instruction_set, bool vm_safe_mode, bool should_relocate); + const char *instruction_set, int dexopt_needed, bool vm_safe_mode, + bool debuggable, const char* oat_dir); int mark_boot_complete(const char *instruction_set); int movefiles(); -int linklib(const char* target, const char* source, int userId); +int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId); int idmap(const char *target_path, const char *overlay_path, uid_t uid); -int restorecon_data(); +int restorecon_data(const char *uuid, const char* pkgName, const char* seinfo, uid_t uid); +int create_oat_dir(const char* oat_dir, const char *instruction_set); +int rm_package_dir(const char* apk_path); +int calculate_oat_file_path(char path[PKG_PATH_MAX], const char *oat_dir, const char *apk_path, + const char *instruction_set); +int move_package_dir(char path[PKG_PATH_MAX], const char *oat_dir, const char *apk_path, + const char *instruction_set); |