summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alex Buynytskyy <alexbuy@google.com> 2022-02-15 08:59:36 -0800
committer Alex Buynytskyy <alexbuy@google.com> 2022-02-16 07:40:27 +0000
commit5cb2526843d0f4981f8b3356597e62772b664140 (patch)
treec4e2ce41df5d75d245b458e577ef40d3aa47cf51
parentd7bb61285f8016e7e5321d032b91a31e0f432712 (diff)
Remove rename/delete for external storage.
Apparently installd does not have permission to do so. Bug: 219579713 Bug: 219588776 Bug: 219650739 Test: atest ExternalStorageHostTest PackageSettingTest Change-Id: I66b3bdfe299c2395ecc2f71cd1ffc88881d4d48c
-rw-r--r--cmds/installd/InstalldNativeService.cpp16
-rw-r--r--cmds/installd/utils.h2
2 files changed, 9 insertions, 9 deletions
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 953847eb28..91f7d3b8fc 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -994,15 +994,15 @@ binder::Status InstalldNativeService::destroyAppData(const std::optional<std::st
}
auto path = StringPrintf("%s/Android/data/%s", extPath.c_str(), pkgname);
- if (rename_delete_dir_contents_and_dir(path, true) != 0) {
+ if (delete_dir_contents_and_dir(path, true) != 0) {
res = error("Failed to delete contents of " + path);
}
path = StringPrintf("%s/Android/media/%s", extPath.c_str(), pkgname);
- if (rename_delete_dir_contents_and_dir(path, true) != 0) {
+ if (delete_dir_contents_and_dir(path, true) != 0) {
res = error("Failed to delete contents of " + path);
}
path = StringPrintf("%s/Android/obb/%s", extPath.c_str(), pkgname);
- if (rename_delete_dir_contents_and_dir(path, true) != 0) {
+ if (delete_dir_contents_and_dir(path, true) != 0) {
res = error("Failed to delete contents of " + path);
}
}
@@ -1550,27 +1550,27 @@ binder::Status InstalldNativeService::destroyUserData(const std::optional<std::s
binder::Status res = ok();
if (flags & FLAG_STORAGE_DE) {
auto path = create_data_user_de_path(uuid_, userId);
- if (rename_delete_dir_contents_and_dir(path, true) != 0) {
+ if (delete_dir_contents_and_dir(path, true) != 0) {
res = error("Failed to delete " + path);
}
if (uuid_ == nullptr) {
path = create_data_misc_legacy_path(userId);
- if (rename_delete_dir_contents_and_dir(path, true) != 0) {
+ if (delete_dir_contents_and_dir(path, true) != 0) {
res = error("Failed to delete " + path);
}
path = create_primary_cur_profile_dir_path(userId);
- if (rename_delete_dir_contents_and_dir(path, true) != 0) {
+ if (delete_dir_contents_and_dir(path, true) != 0) {
res = error("Failed to delete " + path);
}
}
}
if (flags & FLAG_STORAGE_CE) {
auto path = create_data_user_ce_path(uuid_, userId);
- if (rename_delete_dir_contents_and_dir(path, true) != 0) {
+ if (delete_dir_contents_and_dir(path, true) != 0) {
res = error("Failed to delete " + path);
}
path = findDataMediaPath(uuid, userId);
- if (rename_delete_dir_contents_and_dir(path, true) != 0) {
+ if (delete_dir_contents_and_dir(path, true) != 0) {
res = error("Failed to delete " + path);
}
}
diff --git a/cmds/installd/utils.h b/cmds/installd/utils.h
index ffde56233e..04f3bc93a6 100644
--- a/cmds/installd/utils.h
+++ b/cmds/installd/utils.h
@@ -121,7 +121,7 @@ int delete_dir_contents(const std::string& pathname, bool ignore_if_missing = fa
int delete_dir_contents_and_dir(const std::string& pathname, bool ignore_if_missing = false);
bool is_renamed_deleted_dir(std::string_view path);
-int rename_delete_dir_contents_and_dir(const std::string& pathname, bool ignore_if_missing = false);
+int rename_delete_dir_contents_and_dir(const std::string& pathname, bool ignore_if_missing = true);
void cleanup_invalid_package_dirs_under_path(const std::string& pathname);