mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-12 06:01:59 +00:00
Proper package state management
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -319,6 +319,7 @@ static void get_process_info(int client, const sock_cred *cred) {
|
||||
|
||||
uint32_t flags = 0;
|
||||
|
||||
check_pkg_refresh();
|
||||
if (is_deny_target(uid, process)) {
|
||||
flags |= PROCESS_ON_DENYLIST;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user