@NonNull
    public static ArrayList<ServiceInfo> getServices(Context context, String pkg) {
        PackageManager pm = context.getPackageManager();
        try {
            PackageInfo packageInfo = null;
            if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
                packageInfo = pm.getPackageInfo(pkg, GET_SERVICES | PackageManager.MATCH_DISABLED_COMPONENTS);
            } else {
                packageInfo = pm.getPackageInfo(pkg, GET_SERVICES | PackageManager.GET_DISABLED_COMPONENTS);
            }
            if (packageInfo == null) return Lists.newArrayListWithCapacity(0);
            ServiceInfo[] serviceInfoArray = packageInfo.services;
            if (serviceInfoArray == null || serviceInfoArray.length == 0)
                return Lists.newArrayListWithCapacity(0);
            return Lists.newArrayList(serviceInfoArray);
        } catch (Exception e) {
            XLog.e("getServices: " + Log.getStackTraceString(e));
            return Lists.newArrayListWithCapacity(0);
        }
    }
Those that has not service and broadcast and no activity.
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/pm/ComponentUtil.java