Proper package state management

This commit is contained in:
topjohnwu
2022-05-29 23:31:57 -07:00
parent 4ea8bd0229
commit d0c4226997
7 changed files with 22 additions and 24 deletions

View File

@ -14,6 +14,8 @@
using namespace std;
atomic_flag skip_pkg_rescan;
// For the following data structures:
// If package name == ISOLATED_MAGIC, or app ID == -1, it means isolated service
@ -33,9 +35,6 @@ atomic<bool> denylist_enforced = false;
#define do_kill (zygisk_enabled && denylist_enforced)
static void rescan_apps() {
if (!need_pkg_refresh())
return;
LOGD("denylist: rescanning apps\n");
app_id_to_pkgs.clear();
@ -386,7 +385,8 @@ bool is_deny_target(int uid, string_view process) {
if (!ensure_data())
return false;
rescan_apps();
if (!skip_pkg_rescan.test_and_set())
rescan_apps();
int app_id = to_app_id(uid);
if (app_id >= 90000) {