From c8f2dffbca36b0a60a4b0788d8d069f1988a3394 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Sat, 15 May 2021 12:39:28 +0800 Subject: [PATCH] [core] Fix on Android Q- (#585) --- .../config/LSPApplicationServiceClient.java | 1 - .../lspd/service/LSPSystemServerService.java | 31 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/core/src/main/java/org/lsposed/lspd/config/LSPApplicationServiceClient.java b/core/src/main/java/org/lsposed/lspd/config/LSPApplicationServiceClient.java index e6650f1a..2b239c80 100644 --- a/core/src/main/java/org/lsposed/lspd/config/LSPApplicationServiceClient.java +++ b/core/src/main/java/org/lsposed/lspd/config/LSPApplicationServiceClient.java @@ -32,7 +32,6 @@ public class LSPApplicationServiceClient implements ILSPApplicationService { static ILSPApplicationService service = null; static IBinder serviceBinder = null; - static String baseCachePath = null; static String processName = null; public static LSPApplicationServiceClient serviceClient = null; diff --git a/core/src/main/java/org/lsposed/lspd/service/LSPSystemServerService.java b/core/src/main/java/org/lsposed/lspd/service/LSPSystemServerService.java index 482e4355..6e9949b0 100644 --- a/core/src/main/java/org/lsposed/lspd/service/LSPSystemServerService.java +++ b/core/src/main/java/org/lsposed/lspd/service/LSPSystemServerService.java @@ -21,24 +21,23 @@ public class LSPSystemServerService extends ILSPSystemServerService.Stub impleme binderDied(); } - private final IServiceCallback serviceCallback = new IServiceCallback.Stub() { - @Override - public void onRegistration(String name, IBinder binder) { - if (name.equals(PROXY_SERVICE_NAME) && binder != null && binder != LSPSystemServerService.this) { - Log.d(TAG, "Register " + name + " " + binder); - originService = binder; - LSPSystemServerService.this.linkToDeath(); - } - } - - @Override - public IBinder asBinder() { - return this; - } - }; - public LSPSystemServerService() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + var serviceCallback = new IServiceCallback.Stub() { + @Override + public void onRegistration(String name, IBinder binder) { + if (name.equals(PROXY_SERVICE_NAME) && binder != null && binder != LSPSystemServerService.this) { + Log.d(TAG, "Register " + name + " " + binder); + originService = binder; + LSPSystemServerService.this.linkToDeath(); + } + } + + @Override + public IBinder asBinder() { + return this; + } + }; try { getSystemServiceManager().registerForNotifications(PROXY_SERVICE_NAME, serviceCallback); } catch (Throwable e) {