Loading cmds/installd/InstalldNativeService.cpp +11 −12 Original line number Diff line number Diff line Loading @@ -1103,7 +1103,7 @@ binder::Status InstalldNativeService::destroyAppDataSnapshot( binder::Status InstalldNativeService::moveCompleteApp(const std::unique_ptr<std::string>& fromUuid, const std::unique_ptr<std::string>& toUuid, const std::string& packageName, const std::string& dataAppName, int32_t appId, const std::string& seInfo, int32_t appId, const std::string& seInfo, int32_t targetSdkVersion, const std::string& fromCodePath) { ENFORCE_UID(AID_SYSTEM); CHECK_ARGUMENT_UUID(fromUuid); Loading @@ -1114,24 +1114,24 @@ binder::Status InstalldNativeService::moveCompleteApp(const std::unique_ptr<std: const char* from_uuid = fromUuid ? fromUuid->c_str() : nullptr; const char* to_uuid = toUuid ? toUuid->c_str() : nullptr; const char* package_name = packageName.c_str(); const char* data_app_name = dataAppName.c_str(); binder::Status res = ok(); std::vector<userid_t> users = get_known_users(from_uuid); auto to_app_package_path_parent = create_data_app_path(to_uuid); auto to_app_package_path = StringPrintf("%s/%s", to_app_package_path_parent.c_str(), android::base::Basename(fromCodePath).c_str()); // Copy app { auto to = create_data_app_package_path(to_uuid, data_app_name); auto to_parent = create_data_app_path(to_uuid); int rc = copy_directory_recursive(fromCodePath.c_str(), to_parent.c_str()); int rc = copy_directory_recursive(fromCodePath.c_str(), to_app_package_path_parent.c_str()); if (rc != 0) { res = error(rc, "Failed copying " + fromCodePath + " to " + to); res = error(rc, "Failed copying " + fromCodePath + " to " + to_app_package_path); goto fail; } if (selinux_android_restorecon(to.c_str(), SELINUX_ANDROID_RESTORECON_RECURSE) != 0) { res = error("Failed to restorecon " + to); if (selinux_android_restorecon(to_app_package_path.c_str(), SELINUX_ANDROID_RESTORECON_RECURSE) != 0) { res = error("Failed to restorecon " + to_app_package_path); goto fail; } } Loading Loading @@ -1188,9 +1188,8 @@ binder::Status InstalldNativeService::moveCompleteApp(const std::unique_ptr<std: fail: // Nuke everything we might have already copied { auto to = create_data_app_package_path(to_uuid, data_app_name); if (delete_dir_contents(to.c_str(), 1, nullptr) != 0) { LOG(WARNING) << "Failed to rollback " << to; if (delete_dir_contents(to_app_package_path.c_str(), 1, nullptr) != 0) { LOG(WARNING) << "Failed to rollback " << to_app_package_path; } } for (auto user : users) { Loading cmds/installd/InstalldNativeService.h +1 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ public: binder::Status moveCompleteApp(const std::unique_ptr<std::string>& fromUuid, const std::unique_ptr<std::string>& toUuid, const std::string& packageName, const std::string& dataAppName, int32_t appId, const std::string& seInfo, int32_t appId, const std::string& seInfo, int32_t targetSdkVersion, const std::string& fromCodePath); binder::Status dexopt(const std::string& apkPath, int32_t uid, Loading cmds/installd/binder/android/os/IInstalld.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ interface IInstalld { void setAppQuota(@nullable @utf8InCpp String uuid, int userId, int appId, long cacheQuota); void moveCompleteApp(@nullable @utf8InCpp String fromUuid, @nullable @utf8InCpp String toUuid, @utf8InCpp String packageName, @utf8InCpp String dataAppName, int appId, @utf8InCpp String packageName, int appId, @utf8InCpp String seInfo, int targetSdkVersion, @utf8InCpp String fromCodePath); void dexopt(@utf8InCpp String apkPath, int uid, @nullable @utf8InCpp String packageName, Loading cmds/installd/tests/installd_utils_test.cpp +0 −7 Original line number Diff line number Diff line Loading @@ -331,13 +331,6 @@ TEST_F(UtilsTest, CreateDataMediaPath) { create_data_media_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", 10)); } TEST_F(UtilsTest, CreateDataAppPackagePath) { EXPECT_EQ("/data/app/com.example", create_data_app_package_path(nullptr, "com.example")); EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/app/com.example", create_data_app_package_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", "com.example")); } TEST_F(UtilsTest, CreateDataUserPackagePath) { EXPECT_EQ("/data/data/com.example", create_data_user_ce_package_path(nullptr, 0, "com.example")); EXPECT_EQ("/data/user/10/com.example", create_data_user_ce_package_path(nullptr, 10, "com.example")); Loading cmds/installd/utils.cpp +0 −12 Original line number Diff line number Diff line Loading @@ -99,18 +99,6 @@ static std::string resolve_ce_path_by_inode_or_fallback(const std::string& root_ } } /** * 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_package_name(package_name); 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 Loading Loading
cmds/installd/InstalldNativeService.cpp +11 −12 Original line number Diff line number Diff line Loading @@ -1103,7 +1103,7 @@ binder::Status InstalldNativeService::destroyAppDataSnapshot( binder::Status InstalldNativeService::moveCompleteApp(const std::unique_ptr<std::string>& fromUuid, const std::unique_ptr<std::string>& toUuid, const std::string& packageName, const std::string& dataAppName, int32_t appId, const std::string& seInfo, int32_t appId, const std::string& seInfo, int32_t targetSdkVersion, const std::string& fromCodePath) { ENFORCE_UID(AID_SYSTEM); CHECK_ARGUMENT_UUID(fromUuid); Loading @@ -1114,24 +1114,24 @@ binder::Status InstalldNativeService::moveCompleteApp(const std::unique_ptr<std: const char* from_uuid = fromUuid ? fromUuid->c_str() : nullptr; const char* to_uuid = toUuid ? toUuid->c_str() : nullptr; const char* package_name = packageName.c_str(); const char* data_app_name = dataAppName.c_str(); binder::Status res = ok(); std::vector<userid_t> users = get_known_users(from_uuid); auto to_app_package_path_parent = create_data_app_path(to_uuid); auto to_app_package_path = StringPrintf("%s/%s", to_app_package_path_parent.c_str(), android::base::Basename(fromCodePath).c_str()); // Copy app { auto to = create_data_app_package_path(to_uuid, data_app_name); auto to_parent = create_data_app_path(to_uuid); int rc = copy_directory_recursive(fromCodePath.c_str(), to_parent.c_str()); int rc = copy_directory_recursive(fromCodePath.c_str(), to_app_package_path_parent.c_str()); if (rc != 0) { res = error(rc, "Failed copying " + fromCodePath + " to " + to); res = error(rc, "Failed copying " + fromCodePath + " to " + to_app_package_path); goto fail; } if (selinux_android_restorecon(to.c_str(), SELINUX_ANDROID_RESTORECON_RECURSE) != 0) { res = error("Failed to restorecon " + to); if (selinux_android_restorecon(to_app_package_path.c_str(), SELINUX_ANDROID_RESTORECON_RECURSE) != 0) { res = error("Failed to restorecon " + to_app_package_path); goto fail; } } Loading Loading @@ -1188,9 +1188,8 @@ binder::Status InstalldNativeService::moveCompleteApp(const std::unique_ptr<std: fail: // Nuke everything we might have already copied { auto to = create_data_app_package_path(to_uuid, data_app_name); if (delete_dir_contents(to.c_str(), 1, nullptr) != 0) { LOG(WARNING) << "Failed to rollback " << to; if (delete_dir_contents(to_app_package_path.c_str(), 1, nullptr) != 0) { LOG(WARNING) << "Failed to rollback " << to_app_package_path; } } for (auto user : users) { Loading
cmds/installd/InstalldNativeService.h +1 −1 Original line number Diff line number Diff line Loading @@ -96,7 +96,7 @@ public: binder::Status moveCompleteApp(const std::unique_ptr<std::string>& fromUuid, const std::unique_ptr<std::string>& toUuid, const std::string& packageName, const std::string& dataAppName, int32_t appId, const std::string& seInfo, int32_t appId, const std::string& seInfo, int32_t targetSdkVersion, const std::string& fromCodePath); binder::Status dexopt(const std::string& apkPath, int32_t uid, Loading
cmds/installd/binder/android/os/IInstalld.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ interface IInstalld { void setAppQuota(@nullable @utf8InCpp String uuid, int userId, int appId, long cacheQuota); void moveCompleteApp(@nullable @utf8InCpp String fromUuid, @nullable @utf8InCpp String toUuid, @utf8InCpp String packageName, @utf8InCpp String dataAppName, int appId, @utf8InCpp String packageName, int appId, @utf8InCpp String seInfo, int targetSdkVersion, @utf8InCpp String fromCodePath); void dexopt(@utf8InCpp String apkPath, int uid, @nullable @utf8InCpp String packageName, Loading
cmds/installd/tests/installd_utils_test.cpp +0 −7 Original line number Diff line number Diff line Loading @@ -331,13 +331,6 @@ TEST_F(UtilsTest, CreateDataMediaPath) { create_data_media_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", 10)); } TEST_F(UtilsTest, CreateDataAppPackagePath) { EXPECT_EQ("/data/app/com.example", create_data_app_package_path(nullptr, "com.example")); EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/app/com.example", create_data_app_package_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", "com.example")); } TEST_F(UtilsTest, CreateDataUserPackagePath) { EXPECT_EQ("/data/data/com.example", create_data_user_ce_package_path(nullptr, 0, "com.example")); EXPECT_EQ("/data/user/10/com.example", create_data_user_ce_package_path(nullptr, 10, "com.example")); Loading
cmds/installd/utils.cpp +0 −12 Original line number Diff line number Diff line Loading @@ -99,18 +99,6 @@ static std::string resolve_ce_path_by_inode_or_fallback(const std::string& root_ } } /** * 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_package_name(package_name); 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 Loading