diff --git a/core/src/main/java/org/lsposed/lspd/service/LSPApplicationService.java b/core/src/main/java/org/lsposed/lspd/service/LSPApplicationService.java index e03cea52..663f09f0 100644 --- a/core/src/main/java/org/lsposed/lspd/service/LSPApplicationService.java +++ b/core/src/main/java/org/lsposed/lspd/service/LSPApplicationService.java @@ -19,9 +19,13 @@ package org.lsposed.lspd.service; +import static org.lsposed.lspd.service.ServiceManager.TAG; + import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; +import android.os.SystemProperties; +import android.text.TextUtils; import android.util.Log; import android.util.Pair; @@ -29,13 +33,12 @@ import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import static org.lsposed.lspd.service.ServiceManager.TAG; - public class LSPApplicationService extends ILSPApplicationService.Stub { // private final static Set> cache = ConcurrentHashMap.newKeySet(); private final static Map handles = new ConcurrentHashMap<>(); private final static Set recipients = ConcurrentHashMap.newKeySet(); + private final static boolean isMIUI = !TextUtils.isEmpty(SystemProperties.get("ro.miui.ui.version.name")); public boolean registerHeartBeat(int uid, int pid, IBinder handle) { try { @@ -103,7 +106,9 @@ public class LSPApplicationService extends ILSPApplicationService.Stub { ensureRegistered(); if (ConfigManager.getInstance().isManager(getCallingUid())) { var service = ServiceManager.getManagerService(); - service.new ManagerGuard(handles.get(getCallingPid())); + if (isMIUI) { + service.new ManagerGuard(handles.get(getCallingPid())); + } return service; } return null; diff --git a/hiddenapi-stubs/src/main/java/android/os/SystemProperties.java b/hiddenapi-stubs/src/main/java/android/os/SystemProperties.java new file mode 100644 index 00000000..90bcf30d --- /dev/null +++ b/hiddenapi-stubs/src/main/java/android/os/SystemProperties.java @@ -0,0 +1,11 @@ +package android.os; + +public class SystemProperties { + public static String get(String key) { + throw new UnsupportedOperationException("Stub"); + } + + public static void set(String key, String val) { + throw new UnsupportedOperationException("Stub"); + } +}