Do not clean profiles unconditonally during app data clean up
The goal is to enable profiles to be persisted across OTAs.
This CL makes profile removal a dedicated path which will be called by
PackageManger during an app update or uninstall.
Profiles are cleared when:
- requested to do a full clean up of application data files
- specifically requested to clear them (e.g. app updates)
Profiles are destroyed (includes profile directory removal)
- for each user individually when its application data is destroyed
- for all users if the package gets uninstalled.
Bug: 27081617
Bug: 27688727
Change-Id: Id53c7625011af3cdbe8a58ac0982982fa461e5fd
diff --git a/cmds/installd/installd.cpp b/cmds/installd/installd.cpp
index 2bf27a2..0bb0c3c 100644
--- a/cmds/installd/installd.cpp
+++ b/cmds/installd/installd.cpp
@@ -341,10 +341,16 @@
return rm_package_dir(arg[0]);
}
-static int do_rm_profiles(char **arg, char reply[REPLY_MAX] ATTRIBUTE_UNUSED)
+static int do_clear_app_profiles(char **arg, char reply[REPLY_MAX] ATTRIBUTE_UNUSED)
{
/* package_name */
- return rm_profiles(arg[0]);
+ return clear_app_profiles(arg[0]);
+}
+
+static int do_destroy_app_profiles(char **arg, char reply[REPLY_MAX] ATTRIBUTE_UNUSED)
+{
+ /* package_name */
+ return destroy_app_profiles(arg[0]);
}
static int do_link_file(char **arg, char reply[REPLY_MAX] ATTRIBUTE_UNUSED)
@@ -385,7 +391,8 @@
{ "idmap", 3, do_idmap },
{ "createoatdir", 2, do_create_oat_dir },
{ "rmpackagedir", 1, do_rm_package_dir },
- { "rmprofiles", 1, do_rm_profiles },
+ { "clear_app_profiles", 1, do_clear_app_profiles },
+ { "destroy_app_profiles", 1, do_destroy_app_profiles },
{ "linkfile", 3, do_link_file },
{ "move_ab", 3, do_move_ab },
};