Loading cmds/installd/InstalldNativeService.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -2010,6 +2010,10 @@ binder::Status InstalldNativeService::getAppSize(const std::optional<std::string const std::vector<std::string>& codePaths, std::vector<int64_t>* _aidl_return) { ENFORCE_UID(AID_SYSTEM); CHECK_ARGUMENT_UUID(uuid); if (packageNames.size() != ceDataInodes.size()) { return exception(binder::Status::EX_ILLEGAL_ARGUMENT, "packageNames/ceDataInodes size mismatch."); } for (const auto& packageName : packageNames) { CHECK_ARGUMENT_PACKAGE_NAME(packageName); } Loading cmds/installd/tests/installd_service_test.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -485,6 +485,19 @@ TEST_F(ServiceTest, GetAppSize) { system(removeCommand.c_str()); } } TEST_F(ServiceTest, GetAppSizeWrongSizes) { int32_t externalStorageAppId = -1; std::vector<int64_t> externalStorageSize; std::vector<std::string> codePaths; std::vector<std::string> packageNames = {"package1", "package2"}; std::vector<int64_t> ceDataInodes = {0}; EXPECT_BINDER_FAIL(service->getAppSize(std::nullopt, packageNames, 0, InstalldNativeService::FLAG_USE_QUOTA, externalStorageAppId, ceDataInodes, codePaths, &externalStorageSize)); } static bool mkdirs(const std::string& path, mode_t mode) { struct stat sb; if (stat(path.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode)) { Loading Loading
cmds/installd/InstalldNativeService.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -2010,6 +2010,10 @@ binder::Status InstalldNativeService::getAppSize(const std::optional<std::string const std::vector<std::string>& codePaths, std::vector<int64_t>* _aidl_return) { ENFORCE_UID(AID_SYSTEM); CHECK_ARGUMENT_UUID(uuid); if (packageNames.size() != ceDataInodes.size()) { return exception(binder::Status::EX_ILLEGAL_ARGUMENT, "packageNames/ceDataInodes size mismatch."); } for (const auto& packageName : packageNames) { CHECK_ARGUMENT_PACKAGE_NAME(packageName); } Loading
cmds/installd/tests/installd_service_test.cpp +13 −0 Original line number Diff line number Diff line Loading @@ -485,6 +485,19 @@ TEST_F(ServiceTest, GetAppSize) { system(removeCommand.c_str()); } } TEST_F(ServiceTest, GetAppSizeWrongSizes) { int32_t externalStorageAppId = -1; std::vector<int64_t> externalStorageSize; std::vector<std::string> codePaths; std::vector<std::string> packageNames = {"package1", "package2"}; std::vector<int64_t> ceDataInodes = {0}; EXPECT_BINDER_FAIL(service->getAppSize(std::nullopt, packageNames, 0, InstalldNativeService::FLAG_USE_QUOTA, externalStorageAppId, ceDataInodes, codePaths, &externalStorageSize)); } static bool mkdirs(const std::string& path, mode_t mode) { struct stat sb; if (stat(path.c_str(), &sb) != -1 && S_ISDIR(sb.st_mode)) { Loading