code: public static PackageInfo getServicePackageInfo(Context context, String targetPackage) throws NameNotFoundException {
          PackageManager manager = context.getPackageManager();
          return manager.getPackageInfo(targetPackage, PackageManager.GET_SERVICES);
      }
docs: Get the {@link android.content.pm.PackageInfo} that contains all service declaration for the context.
  @param context the context.
  @param targetPackage the target package name.
  @return the {@link android.content.pm.PackageInfo}.
  @throws NameNotFoundException if no package found.