[core] Fix on Android Q- (#585)

This commit is contained in:
LoveSy 2021-05-15 12:39:28 +08:00 committed by GitHub
parent 5032bc0b15
commit c8f2dffbca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 17 deletions

View File

@ -32,7 +32,6 @@ public class LSPApplicationServiceClient implements ILSPApplicationService {
static ILSPApplicationService service = null; static ILSPApplicationService service = null;
static IBinder serviceBinder = null; static IBinder serviceBinder = null;
static String baseCachePath = null;
static String processName = null; static String processName = null;
public static LSPApplicationServiceClient serviceClient = null; public static LSPApplicationServiceClient serviceClient = null;

View File

@ -21,7 +21,9 @@ public class LSPSystemServerService extends ILSPSystemServerService.Stub impleme
binderDied(); binderDied();
} }
private final IServiceCallback serviceCallback = new IServiceCallback.Stub() { public LSPSystemServerService() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
var serviceCallback = new IServiceCallback.Stub() {
@Override @Override
public void onRegistration(String name, IBinder binder) { public void onRegistration(String name, IBinder binder) {
if (name.equals(PROXY_SERVICE_NAME) && binder != null && binder != LSPSystemServerService.this) { if (name.equals(PROXY_SERVICE_NAME) && binder != null && binder != LSPSystemServerService.this) {
@ -36,9 +38,6 @@ public class LSPSystemServerService extends ILSPSystemServerService.Stub impleme
return this; return this;
} }
}; };
public LSPSystemServerService() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
try { try {
getSystemServiceManager().registerForNotifications(PROXY_SERVICE_NAME, serviceCallback); getSystemServiceManager().registerForNotifications(PROXY_SERVICE_NAME, serviceCallback);
} catch (Throwable e) { } catch (Throwable e) {