Removes general access bit hack

- fixed in aosp: android_libcore/commit/25681be69e19a834b00cfbf54cd99ac13f12b9ff
 - reverts 42f69fd745
 - reverts 47a5eac0b0
 - fixes googlecode issue 744
This commit is contained in:
Connor Tumbleson
2015-01-21 07:12:26 -06:00
parent e281f81546
commit 81e6af093b
8 changed files with 25 additions and 95 deletions

View File

@ -35,6 +35,8 @@ import java.util.*;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.nio.file.Files;
import java.util.zip.ZipFile;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
@ -174,7 +176,7 @@ public class Androlib {
// with regular looping of apkFile for easy copy
try {
Directory unk = apkFile.getDirectory();
ZipExtFile apkZipFile = new ZipExtFile(apkFile.getAbsolutePath());
ZipFile apkZipFile = new ZipFile(apkFile.getAbsolutePath());
// loop all items in container recursively, ignoring any that are pre-defined by aapt
Set<String> files = unk.getFiles(true);
@ -184,8 +186,6 @@ public class Androlib {
// copy file out of archive into special "unknown" folder
unk.copyToDir(unknownOut, file);
try {
// ignore encryption
apkZipFile.getEntry(file).getGeneralPurposeBit().useEncryption(false);
invZipFile = apkZipFile.getEntry(file);
// lets record the name of the file, and its compression type

View File

@ -24,16 +24,15 @@ import brut.androlib.res.data.ResTable;
import brut.androlib.res.util.ExtFile;
import brut.common.BrutException;
import brut.directory.DirectoryException;
import brut.directory.ZipExtFile;
import brut.util.OS;
import com.google.common.base.Strings;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.logging.Logger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
/**
* @author Ryszard Wiśniewski <brut.alll@gmail.com>
@ -196,13 +195,13 @@ public class ApkDecoder {
public void setCompressionMode() throws AndrolibException, IOException {
// read the resources.arsc checking for STORED vs DEFLATE
// this will determine whether we compress on rebuild or not.
ZipExtFile zef = new ZipExtFile(mApkFile.getAbsolutePath());
ZipArchiveEntry ze = zef.getEntry("resources.arsc");
ZipFile zf = new ZipFile(mApkFile.getAbsolutePath());
ZipEntry ze = zf.getEntry("resources.arsc");
if (ze != null) {
int compression = ze.getMethod();
mCompressResources = (compression == ZipEntry.DEFLATED);
}
zef.close();
zf.close();
}
public void setTargetSdkVersion() throws AndrolibException, IOException {

View File

@ -42,8 +42,6 @@ import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@ -665,10 +663,10 @@ final public class AndrolibResources {
public void installFramework(File frameFile, String tag)
throws AndrolibException {
InputStream in = null;
ZipArchiveOutputStream out = null;
ZipOutputStream out = null;
try {
ZipExtFile zip = new ZipExtFile(frameFile);
ZipArchiveEntry entry = zip.getEntry("resources.arsc");
ZipFile zip = new ZipFile(frameFile);
ZipEntry entry = zip.getEntry("resources.arsc");
if (entry == null) {
throw new AndrolibException("Can't find resources.arsc file");
@ -685,21 +683,17 @@ final public class AndrolibResources {
+ (tag == null ? "" : '-' + tag)
+ ".apk");
out = new ZipArchiveOutputStream(new FileOutputStream(outFile));
out = new ZipOutputStream(new FileOutputStream(outFile));
out.setMethod(ZipOutputStream.STORED);
CRC32 crc = new CRC32();
crc.update(data);
entry = new ZipArchiveEntry("resources.arsc");
entry = new ZipEntry("resources.arsc");
entry.setSize(data.length);
entry.setCrc(crc.getValue());
out.putArchiveEntry(entry);
out.putNextEntry(entry);
out.write(data);
out.closeArchiveEntry();
zip.close();
LOGGER.info("Framework installed to: " + outFile);
} catch (ZipException ex) {
throw new AndrolibException(ex);
} catch (IOException ex) {
throw new AndrolibException(ex);
} finally {