Ejemplo n.º 1
0
 public boolean isFrameworkApk(ResTable resTable) {
   for (ResPackage pkg : resTable.listMainPackages()) {
     if (pkg.getId() < 64) {
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 2
0
  public ResPackage loadFrameworkPkg(ResTable resTable, int id, String frameTag)
      throws AndrolibException {
    File apk = getFrameworkApk(id, frameTag);

    LOGGER.info("Loading resource table from file: " + apk);
    ResPackage[] pkgs = getResPackagesFromApk(new ExtFile(apk), resTable, true);

    if (pkgs.length != 1) {
      throw new AndrolibException("Arsc files with zero or multiple packages");
    }

    ResPackage pkg = pkgs[0];
    if (pkg.getId() != id) {
      throw new AndrolibException(
          "Expected pkg of id: " + String.valueOf(id) + ", got: " + pkg.getId());
    }

    resTable.addPackage(pkg, false);
    LOGGER.info("Loaded.");
    return pkg;
  }