Don't report errors when trying to delete a non-existing profile dir
Also, put destroy_app_current_profiles behind FLAG_STORAGE_DE flag.
Bug: 27081617
Change-Id: Ib8b9ff292784c659259ceb4339b803e3580da7ed
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index 8350da7..ff5a3b8 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -235,7 +235,9 @@
}
static int destroy_app_current_profiles(const char *pkgname, userid_t userid) {
- return delete_dir_contents_and_dir(create_data_user_profile_package_path(userid, pkgname));
+ return delete_dir_contents_and_dir(
+ create_data_user_profile_package_path(userid, pkgname),
+ /*ignore_if_missing*/ true);
}
int destroy_app_profiles(const char *pkgname) {
@@ -244,7 +246,9 @@
for (auto user : users) {
result |= destroy_app_current_profiles(pkgname, user);
}
- result |= delete_dir_contents_and_dir(create_data_ref_profile_package_path(pkgname));
+ result |= delete_dir_contents_and_dir(
+ create_data_ref_profile_package_path(pkgname),
+ /*ignore_if_missing*/ true);
return result;
}
@@ -257,8 +261,8 @@
if (flags & FLAG_STORAGE_DE) {
res |= delete_dir_contents_and_dir(
create_data_user_de_package_path(uuid, userid, pkgname));
+ destroy_app_current_profiles(pkgname, userid);
}
- destroy_app_current_profiles(pkgname, userid);
return res;
}