From 75dd76e30772f17943326dbeaad31dce619ad4b7 Mon Sep 17 00:00:00 2001 From: houvven Date: Thu, 16 May 2024 16:09:14 +0800 Subject: [PATCH] When the uid fails to be obtained, an exception is thrown --- .../main/java/io/github/houvven/lservice/LServiceBridge.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lservice/src/main/java/io/github/houvven/lservice/LServiceBridge.java b/lservice/src/main/java/io/github/houvven/lservice/LServiceBridge.java index 5ca9acd..6b90857 100644 --- a/lservice/src/main/java/io/github/houvven/lservice/LServiceBridge.java +++ b/lservice/src/main/java/io/github/houvven/lservice/LServiceBridge.java @@ -30,6 +30,9 @@ public LServiceBridge(Context ctx, String apkPath) { this.pm = ctx.getPackageManager(); try { int uid = getUid(apkPath); + if (uid == -1) { + throw new RuntimeException("get uid failed."); + } Os.setuid(uid); if (isInstalledAutomatically) { // 异步执行