code: @Override
      public List<InstalledIdentity> getInstalledIdentities() throws PatchingException {
  
          List<InstalledIdentity> installedIdentities;
  
          final File metadataDir = installedImage.getInstallationMetadata();
          if(!metadataDir.exists()) {
              installedIdentities = Collections.singletonList(defaultIdentity);
          } else {
              final String defaultConf = defaultIdentity.getIdentity().getName() + Constants.DOT_CONF;
              final File[] identityConfs = metadataDir.listFiles(new FileFilter() {
                  @Override
                  public boolean accept(File pathname) {
                      return pathname.isFile() &&
                              pathname.getName().endsWith(Constants.DOT_CONF) &&
                              !pathname.getName().equals(defaultConf);
                  }
              });
              if(identityConfs == null || identityConfs.length == 0) {
                  installedIdentities = Collections.singletonList(defaultIdentity);
              } else {
                  installedIdentities = new ArrayList<InstalledIdentity>(identityConfs.length + 1);
                  installedIdentities.add(defaultIdentity);
                  for(File conf : identityConfs) {
                      final Properties props = loadProductConf(conf);
                      String productName = conf.getName();
                      productName = productName.substring(0, productName.length() - Constants.DOT_CONF.length());
                      final String productVersion = props.getProperty(Constants.CURRENT_VERSION);
  
                      InstalledIdentity identity;
                      try {
                          identity = LayersFactory.load(installedImage, new ProductConfig(productName, productVersion, null), moduleRoots, bundleRoots);
                      } catch (IOException e) {
                          throw new PatchingException(PatchLogger.ROOT_LOGGER.failedToLoadInfo(productName), e);
                      }
                      installedIdentities.add(identity);
                  }
              }
          }
          return installedIdentities;
      }
docs: This method will return a list of installed identities for which
  the corresponding .conf file exists under .installation directory.
  The list will also include the default identity even if the .conf
  file has not been created for it.