code: private void buildInstalledPackagesCache(Context context) {
          final List<PackageInfo> installedPackages =
                  context.getPackageManager().getInstalledPackages(0);
  
          for (PackageInfo installedPackage : installedPackages) {
              addInstalledPackageToCache(installedPackage.packageName);
          }
      }
docs: Builds a cache of installed packages.