private static Map<String,SoInfo> findProvidedLibraries(JarFile apk){
  Pattern libPattern=Pattern.compile("^lib/([^/]+)/([^/]+\\.so)$");
  HashMap<String,SoInfo> providedLibraries=new HashMap<>();
  String[] supportedAbis=SysUtil.getSupportedAbis();
  Enumeration<JarEntry> entries=apk.entries();
  while (entries.hasMoreElements()) {
    JarEntry entry=entries.nextElement();
    Matcher m=libPattern.matcher(entry.getName());
    if (m.matches()) {
      String libraryAbi=m.group(1);
      String soName=m.group(2);
      int abiScore=SysUtil.findAbiScore(supportedAbis,libraryAbi);
      if (abiScore >= 0) {
        SoInfo so=providedLibraries.get(soName);
        if (so == null || abiScore < so.abiScore) {
          providedLibraries.put(soName,new SoInfo(soName,entry,abiScore));
        }
      }
    }
  }
  return providedLibraries;
}

private static Map < String , SoInfo > findProvidedLibraries ( JarFile apk ) { Pattern libPattern = Pattern . compile ( "^lib/([^/]+)/([^/]+\\.so)$" ) ; HashMap < String , SoInfo > providedLibraries = new HashMap < > ( ) ; String [ ] supportedAbis = SysUtil . getSupportedAbis ( ) ; Enumeration < JarEntry > entries = apk . entries ( ) ; while ( entries . hasMoreElements ( ) ) { JarEntry entry = entries . nextElement ( ) ; Matcher m = libPattern . matcher ( entry . getName ( ) ) ; if ( m . matches ( ) ) { String libraryAbi = m . group ( 1 ) ; String soName = m . group ( 2 ) ; int abiScore = SysUtil . findAbiScore ( supportedAbis , libraryAbi ) ; if ( abiScore >= 0 ) { SoInfo so = providedLibraries . get ( soName ) ; if ( so == null || abiScore < so . abiScore ) { providedLibraries . put ( soName , new SoInfo ( soName , entry , abiScore ) ) ; } } } } return providedLibraries ; }
find the shared libraries provided in this apk and supported on this system . each returend soinfo points to the most preferred version of that library bundled with the given apk : for example , if we ' re on an armv7 - a system and we have both arm and armv7 - a versions of libfoo , the returned entry for libfoo points to the armv7 - a version of libfoo . the caller owns the returned value and may mutate it .
