use of de.robv.android.xposed.installer.util.InstallZipUtil.ZipCheckResult in project XposedInstaller by rovo89.
the class FrameworkZips method analyze.
@WorkerThread
private static LocalFrameworkZip analyze(File file) {
String filename = file.getName();
ZipFile zipFile = null;
try {
zipFile = new ZipFile(file);
ZipCheckResult zcr = InstallZipUtil.checkZip(zipFile);
if (!zcr.isValidZip()) {
return null;
}
LocalFrameworkZip zip = new LocalFrameworkZip();
ZipEntry entry;
if ((entry = zipFile.getEntry("system/xposed.prop")) != null) {
XposedProp prop = InstallZipUtil.parseXposedProp(zipFile.getInputStream(entry));
if (prop == null || !prop.isCompatible()) {
Log.w(XposedApp.TAG, "ZIP file is not compatible: " + file);
return null;
}
zip.title = "Version " + prop.getVersion();
} else if (filename.startsWith("xposed-uninstaller-")) {
// TODO provide more information inside uninstaller ZIPs
zip.type = Type.UNINSTALLER;
zip.title = "Uninstaller";
int start = "xposed-uninstaller-".length();
int end = filename.lastIndexOf('-');
if (start < end) {
zip.title += " (" + filename.substring(start, end) + ")";
}
} else {
return null;
}
zip.path = file;
return zip;
} catch (IOException e) {
Log.e(XposedApp.TAG, "Errors while checking " + file, e);
return null;
} finally {
if (zipFile != null) {
InstallZipUtil.closeSilently(zipFile);
}
}
}
Aggregations