private ResolveInfo handleCheckService(Object original, Method method, Object[] args) throws Exception {
            ResolveInfo resolveInfo = (ResolveInfo) method.invoke(original, args);
            if (resolveInfo == null) {
                XLog.v("AMSPackageInternalHooks handleCheckService, resolveInfo is null...");
                return null;
            }
            ServiceInfo serviceInfo = resolveInfo.serviceInfo;
            if (serviceInfo == null) {
                XLog.v("AMSPackageInternalHooks handleCheckService, serviceInfo is null...");
                return resolveInfo;
            }
            ComponentName resolvedName = serviceInfo.getComponentName();
            if (resolvedName == null) {
                XLog.v("AMSPackageInternalHooks handleCheckService, resolvedName is null...");
                return resolveInfo;
            }

            Intent intent = (Intent) args[0];
            int callingUid = (int) args[args.length - 1];
            int userId = (int) args[args.length - 2];
            XLog.v("AMSPackageInternalHooks handleCheckService, resolvedName: %s, callingUid: %s, userId: %s, intent: %s",
                    resolvedName, callingUid, userId, intent);

            boolean res = BootStrap.THANOS_X
                    .getActivityManagerService()
                    .checkService(intent, resolvedName, callingUid, userId);
            if (!res) {
                return null;
            }
            return resolveInfo;
        }
We provide this hook to interrupt Android Services startup.
AMS calls ActiveServices to bind or start a Service, PackageManagerInternal#resolveService
will be called while ActiveServices retrieveServiceLocked.
<p>
So, here we proxy PackageManagerInternal and return null if the Service should not be start.
android/android_framework/patch-magisk/patch-framework/src/main/java/github/tornaco/thanox/android/server/patch/framework/hooks/am/AMSPackageInternalHooks.java