From 4c521abe672b54cd8e36dd8c1ff00a8c83af560f Mon Sep 17 00:00:00 2001 From: fankesyooni Date: Thu, 22 Sep 2022 11:06:42 +0800 Subject: [PATCH] Modify add try catch on findUserId function in AppParasitics --- .../yukihookapi/hook/xposed/parasitic/AppParasitics.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt index a2d408cd..9f1ec984 100644 --- a/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt +++ b/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt @@ -122,11 +122,12 @@ internal object AppParasitics { * @param packageName 当前包名 * @return [Int] */ - internal fun findUserId(packageName: String) = + internal fun findUserId(packageName: String) = runCatching { UserHandleClass.method { name = "getUserId" param(IntType) }.ignored().get().int(systemContext.packageManager.getApplicationInfo(packageName, PackageManager.GET_ACTIVITIES).uid) + }.getOrNull() ?: 0 /** * Hook 模块 APP 相关功能 - 包括自身激活状态、Resources Hook 支持状态以及 [SharedPreferences]