From 6ecc04a4dffad72d64c781f12eab31bb2efed8e5 Mon Sep 17 00:00:00 2001 From: canyie Date: Fri, 20 Jan 2023 13:11:37 +0800 Subject: [PATCH] Fix auto install stub --- native/src/core/package.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/native/src/core/package.cpp b/native/src/core/package.cpp index 75f3e5af0..0617429e0 100644 --- a/native/src/core/package.cpp +++ b/native/src/core/package.cpp @@ -119,20 +119,19 @@ int get_manager(int user_id, string *pkg, bool install) { }; if (skip_mgr_check.test_and_set()) { - if (mgr_app_id < 0) { - goto not_found; - } - // Just need to check whether the app is installed in the user - const char *name = mgr_pkg->empty() ? JAVA_PACKAGE_NAME : mgr_pkg->data(); - ssprintf(app_path, sizeof(app_path), "%s/%d/%s", APP_DATA_DIR, user_id, name); - if (access(app_path, F_OK) == 0) { - // Always check dyn signature for repackaged app - if (!mgr_pkg->empty() && !check_dyn(user_id)) + if (mgr_app_id >= 0) { + // Just need to check whether the app is installed in the user + const char *name = mgr_pkg->empty() ? JAVA_PACKAGE_NAME : mgr_pkg->data(); + ssprintf(app_path, sizeof(app_path), "%s/%d/%s", APP_DATA_DIR, user_id, name); + if (access(app_path, F_OK) == 0) { + // Always check dyn signature for repackaged app + if (!mgr_pkg->empty() && !check_dyn(user_id)) + goto not_found; + if (pkg) *pkg = name; + return user_id * AID_USER_OFFSET + mgr_app_id; + } else { goto not_found; - if (pkg) *pkg = name; - return user_id * AID_USER_OFFSET + mgr_app_id; - } else { - goto not_found; + } } } else { // Here, we want to actually find the manager app and cache the results.