Loading cmds/installd/commands.cpp +11 −11 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int appid_t appid, const char* seinfo, int target_sdk_version) { uid_t uid = multiuser_get_uid(userid, appid); int target_mode = target_sdk_version >= MIN_RESTRICTED_HOME_SDK_VERSION ? 0700 : 0751; if (flags & FLAG_CE_STORAGE) { if (flags & FLAG_STORAGE_CE) { auto path = create_data_user_package_path(uuid, userid, pkgname); if (fs_prepare_dir_strict(path.c_str(), target_mode, uid, uid) != 0) { PLOG(ERROR) << "Failed to prepare " << path; Loading @@ -68,7 +68,7 @@ int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int return -1; } } if (flags & FLAG_DE_STORAGE) { if (flags & FLAG_STORAGE_DE) { auto path = create_data_user_de_package_path(uuid, userid, pkgname); if (fs_prepare_dir_strict(path.c_str(), target_mode, uid, uid) == -1) { PLOG(ERROR) << "Failed to prepare " << path; Loading @@ -93,13 +93,13 @@ int clear_app_data(const char *uuid, const char *pkgname, userid_t userid, int f } int res = 0; if (flags & FLAG_CE_STORAGE) { if (flags & FLAG_STORAGE_CE) { auto path = create_data_user_package_path(uuid, userid, pkgname) + suffix; if (access(path.c_str(), F_OK) == 0) { res |= delete_dir_contents(path); } } if (flags & FLAG_DE_STORAGE) { if (flags & FLAG_STORAGE_DE) { auto path = create_data_user_de_package_path(uuid, userid, pkgname) + suffix; if (access(path.c_str(), F_OK) == 0) { // TODO: include result once 25796509 is fixed Loading @@ -111,11 +111,11 @@ int clear_app_data(const char *uuid, const char *pkgname, userid_t userid, int f int destroy_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags) { int res = 0; if (flags & FLAG_CE_STORAGE) { if (flags & FLAG_STORAGE_CE) { res |= delete_dir_contents_and_dir( create_data_user_package_path(uuid, userid, pkgname)); } if (flags & FLAG_DE_STORAGE) { if (flags & FLAG_STORAGE_DE) { // TODO: include result once 25796509 is fixed delete_dir_contents_and_dir( create_data_user_de_package_path(uuid, userid, pkgname)); Loading Loading @@ -178,7 +178,7 @@ int move_complete_app(const char *from_uuid, const char *to_uuid, const char *pa goto fail; } if (create_app_data(to_uuid, package_name, user, FLAG_CE_STORAGE | FLAG_DE_STORAGE, if (create_app_data(to_uuid, package_name, user, FLAG_STORAGE_CE | FLAG_STORAGE_DE, appid, seinfo, target_sdk_version) != 0) { LOG(ERROR) << "Failed to create package target " << to; goto fail; Loading @@ -204,7 +204,7 @@ int move_complete_app(const char *from_uuid, const char *to_uuid, const char *pa goto fail; } if (restorecon_app_data(to_uuid, package_name, user, FLAG_CE_STORAGE | FLAG_DE_STORAGE, if (restorecon_app_data(to_uuid, package_name, user, FLAG_STORAGE_CE | FLAG_STORAGE_DE, appid, seinfo) != 0) { LOG(ERROR) << "Failed to restorecon"; goto fail; Loading Loading @@ -453,7 +453,7 @@ int get_app_size(const char *uuid, const char *pkgname, int userid, int flags, for (auto user : users) { // TODO: handle user_de directories if (!(flags & FLAG_CE_STORAGE)) continue; if (!(flags & FLAG_STORAGE_CE)) continue; std::string _pkgdir(create_data_user_package_path(uuid, user, pkgname)); const char* pkgdir = _pkgdir.c_str(); Loading Loading @@ -1482,14 +1482,14 @@ int restorecon_app_data(const char* uuid, const char* pkgName, userid_t userid, } uid_t uid = multiuser_get_uid(userid, appid); if (flags & FLAG_CE_STORAGE) { if (flags & FLAG_STORAGE_CE) { auto path = create_data_user_package_path(uuid, userid, pkgName); if (selinux_android_restorecon_pkgdir(path.c_str(), seinfo, uid, seflags) < 0) { PLOG(ERROR) << "restorecon failed for " << path; res = -1; } } if (flags & FLAG_DE_STORAGE) { if (flags & FLAG_STORAGE_DE) { auto path = create_data_user_de_package_path(uuid, userid, pkgName); if (selinux_android_restorecon_pkgdir(path.c_str(), seinfo, uid, seflags) < 0) { PLOG(ERROR) << "restorecon failed for " << path; Loading cmds/installd/installd_constants.h +7 −4 Original line number Diff line number Diff line Loading @@ -56,10 +56,13 @@ constexpr const char* IDMAP_SUFFIX = "@idmap"; constexpr size_t PKG_NAME_MAX = 128u; /* largest allowed package name */ constexpr size_t PKG_PATH_MAX = 256u; /* max size of any path we use */ constexpr int FLAG_DE_STORAGE = 1 << 0; constexpr int FLAG_CE_STORAGE = 1 << 1; constexpr int FLAG_CLEAR_CACHE_ONLY = 1 << 2; constexpr int FLAG_CLEAR_CODE_CACHE_ONLY = 1 << 3; // NOTE: keep in sync with StorageManager constexpr int FLAG_STORAGE_DE = 1 << 0; constexpr int FLAG_STORAGE_CE = 1 << 1; // NOTE: keep in sync with Installer constexpr int FLAG_CLEAR_CACHE_ONLY = 1 << 8; constexpr int FLAG_CLEAR_CODE_CACHE_ONLY = 1 << 9; /* dexopt needed flags matching those in dalvik.system.DexFile */ constexpr int DEXOPT_DEX2OAT_NEEDED = 1; Loading Loading
cmds/installd/commands.cpp +11 −11 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int appid_t appid, const char* seinfo, int target_sdk_version) { uid_t uid = multiuser_get_uid(userid, appid); int target_mode = target_sdk_version >= MIN_RESTRICTED_HOME_SDK_VERSION ? 0700 : 0751; if (flags & FLAG_CE_STORAGE) { if (flags & FLAG_STORAGE_CE) { auto path = create_data_user_package_path(uuid, userid, pkgname); if (fs_prepare_dir_strict(path.c_str(), target_mode, uid, uid) != 0) { PLOG(ERROR) << "Failed to prepare " << path; Loading @@ -68,7 +68,7 @@ int create_app_data(const char *uuid, const char *pkgname, userid_t userid, int return -1; } } if (flags & FLAG_DE_STORAGE) { if (flags & FLAG_STORAGE_DE) { auto path = create_data_user_de_package_path(uuid, userid, pkgname); if (fs_prepare_dir_strict(path.c_str(), target_mode, uid, uid) == -1) { PLOG(ERROR) << "Failed to prepare " << path; Loading @@ -93,13 +93,13 @@ int clear_app_data(const char *uuid, const char *pkgname, userid_t userid, int f } int res = 0; if (flags & FLAG_CE_STORAGE) { if (flags & FLAG_STORAGE_CE) { auto path = create_data_user_package_path(uuid, userid, pkgname) + suffix; if (access(path.c_str(), F_OK) == 0) { res |= delete_dir_contents(path); } } if (flags & FLAG_DE_STORAGE) { if (flags & FLAG_STORAGE_DE) { auto path = create_data_user_de_package_path(uuid, userid, pkgname) + suffix; if (access(path.c_str(), F_OK) == 0) { // TODO: include result once 25796509 is fixed Loading @@ -111,11 +111,11 @@ int clear_app_data(const char *uuid, const char *pkgname, userid_t userid, int f int destroy_app_data(const char *uuid, const char *pkgname, userid_t userid, int flags) { int res = 0; if (flags & FLAG_CE_STORAGE) { if (flags & FLAG_STORAGE_CE) { res |= delete_dir_contents_and_dir( create_data_user_package_path(uuid, userid, pkgname)); } if (flags & FLAG_DE_STORAGE) { if (flags & FLAG_STORAGE_DE) { // TODO: include result once 25796509 is fixed delete_dir_contents_and_dir( create_data_user_de_package_path(uuid, userid, pkgname)); Loading Loading @@ -178,7 +178,7 @@ int move_complete_app(const char *from_uuid, const char *to_uuid, const char *pa goto fail; } if (create_app_data(to_uuid, package_name, user, FLAG_CE_STORAGE | FLAG_DE_STORAGE, if (create_app_data(to_uuid, package_name, user, FLAG_STORAGE_CE | FLAG_STORAGE_DE, appid, seinfo, target_sdk_version) != 0) { LOG(ERROR) << "Failed to create package target " << to; goto fail; Loading @@ -204,7 +204,7 @@ int move_complete_app(const char *from_uuid, const char *to_uuid, const char *pa goto fail; } if (restorecon_app_data(to_uuid, package_name, user, FLAG_CE_STORAGE | FLAG_DE_STORAGE, if (restorecon_app_data(to_uuid, package_name, user, FLAG_STORAGE_CE | FLAG_STORAGE_DE, appid, seinfo) != 0) { LOG(ERROR) << "Failed to restorecon"; goto fail; Loading Loading @@ -453,7 +453,7 @@ int get_app_size(const char *uuid, const char *pkgname, int userid, int flags, for (auto user : users) { // TODO: handle user_de directories if (!(flags & FLAG_CE_STORAGE)) continue; if (!(flags & FLAG_STORAGE_CE)) continue; std::string _pkgdir(create_data_user_package_path(uuid, user, pkgname)); const char* pkgdir = _pkgdir.c_str(); Loading Loading @@ -1482,14 +1482,14 @@ int restorecon_app_data(const char* uuid, const char* pkgName, userid_t userid, } uid_t uid = multiuser_get_uid(userid, appid); if (flags & FLAG_CE_STORAGE) { if (flags & FLAG_STORAGE_CE) { auto path = create_data_user_package_path(uuid, userid, pkgName); if (selinux_android_restorecon_pkgdir(path.c_str(), seinfo, uid, seflags) < 0) { PLOG(ERROR) << "restorecon failed for " << path; res = -1; } } if (flags & FLAG_DE_STORAGE) { if (flags & FLAG_STORAGE_DE) { auto path = create_data_user_de_package_path(uuid, userid, pkgName); if (selinux_android_restorecon_pkgdir(path.c_str(), seinfo, uid, seflags) < 0) { PLOG(ERROR) << "restorecon failed for " << path; Loading
cmds/installd/installd_constants.h +7 −4 Original line number Diff line number Diff line Loading @@ -56,10 +56,13 @@ constexpr const char* IDMAP_SUFFIX = "@idmap"; constexpr size_t PKG_NAME_MAX = 128u; /* largest allowed package name */ constexpr size_t PKG_PATH_MAX = 256u; /* max size of any path we use */ constexpr int FLAG_DE_STORAGE = 1 << 0; constexpr int FLAG_CE_STORAGE = 1 << 1; constexpr int FLAG_CLEAR_CACHE_ONLY = 1 << 2; constexpr int FLAG_CLEAR_CODE_CACHE_ONLY = 1 << 3; // NOTE: keep in sync with StorageManager constexpr int FLAG_STORAGE_DE = 1 << 0; constexpr int FLAG_STORAGE_CE = 1 << 1; // NOTE: keep in sync with Installer constexpr int FLAG_CLEAR_CACHE_ONLY = 1 << 8; constexpr int FLAG_CLEAR_CODE_CACHE_ONLY = 1 << 9; /* dexopt needed flags matching those in dalvik.system.DexFile */ constexpr int DEXOPT_DEX2OAT_NEEDED = 1; Loading