Prune unused UIDs from su policies

This commit is contained in:
topjohnwu
2022-05-18 01:55:58 -07:00
parent e11508f84d
commit 975b1a5e36
12 changed files with 165 additions and 80 deletions

View File

@ -32,23 +32,13 @@ atomic<bool> denylist_enforced = false;
#define do_kill (zygisk_enabled && denylist_enforced)
static unsigned long long pkg_xml_ino = 0;
static void rescan_apps() {
{
struct stat st{};
stat("/data/system/packages.xml", &st);
if (pkg_xml_ino == st.st_ino) {
// Packages has not changed, do not rescan
return;
}
pkg_xml_ino = st.st_ino;
}
if (!need_pkg_refresh())
return;
LOGD("denylist: rescanning apps\n");
app_id_to_pkgs.clear();
cached_manager_app_id = -1;
auto data_dir = xopen_dir(APP_DATA_DIR);
if (!data_dir)