Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit ce6d176

Browse files
authored
Merge pull request #120 from google/synthetic-accessors
Synthetic accessors
2 parents b934e72 + d62c457 commit ce6d176

File tree

9 files changed

+600
-425
lines changed

9 files changed

+600
-425
lines changed

ClassySharkWS/src/com/google/classyshark/Version.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@
2121
*/
2222
public class Version {
2323

24-
public static final int MAJOR = 6;
25-
public static final int MINOR = 7;
24+
public static final int MAJOR = 7;
25+
public static final int MINOR = 0;
2626
}

ClassySharkWS/src/com/google/classyshark/silverghost/contentreader/apk/ApkReader.java

+3-100
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,11 @@
1818

1919
import com.google.classyshark.silverghost.contentreader.BinaryContentReader;
2020
import com.google.classyshark.silverghost.contentreader.ContentReader;
21-
import com.google.classyshark.silverghost.contentreader.dex.DexReader;
22-
import com.google.classyshark.silverghost.translator.xml.XmlDecompressor;
23-
24-
import com.google.classyshark.silverghost.io.SherlockHash;
25-
2621
import java.io.File;
27-
import java.io.FileInputStream;
2822
import java.util.ArrayList;
2923
import java.util.List;
30-
import java.util.zip.ZipEntry;
31-
import java.util.zip.ZipInputStream;
24+
25+
import static com.google.classyshark.silverghost.translator.java.dex.Multidex.readClassNamesFromMultidex;
3226

3327
public class ApkReader implements BinaryContentReader {
3428

@@ -44,7 +38,7 @@ public ApkReader(File binaryArchive) {
4438
public void read() {
4539
readClassNamesFromMultidex(binaryArchive, allClassNames, components);
4640

47-
// TODO add check for manifest
41+
// TODO add isPrivate for manifest
4842
// allClassNames.add(6, "AndroidManifest.xml");
4943
}
5044

@@ -58,95 +52,4 @@ public List<ContentReader.Component> getComponents() {
5852
// TODO add manifest here
5953
return components;
6054
}
61-
62-
private static void readClassNamesFromMultidex(File binaryArchiveFile,
63-
List<String> classNames,
64-
List<ContentReader.Component> components) {
65-
ZipInputStream zipInputStream;
66-
try {
67-
zipInputStream = new ZipInputStream(new FileInputStream(
68-
binaryArchiveFile));
69-
70-
ZipEntry zipEntry;
71-
72-
int dexIndex = 0;
73-
while (true) {
74-
zipEntry = zipInputStream.getNextEntry();
75-
76-
if (zipEntry == null) {
77-
break;
78-
}
79-
80-
if (zipEntry.getName().endsWith(".xml")) {
81-
classNames.add(zipEntry.getName());
82-
}
83-
84-
if (zipEntry.getName().endsWith(".dex")) {
85-
String fName = "classes";
86-
if(dexIndex > 0) {
87-
fName = fName + dexIndex;
88-
}
89-
String ext = "dex";
90-
91-
File file = SherlockHash.INSTANCE.getFileFromZipStream(binaryArchiveFile,
92-
zipInputStream, fName, ext);
93-
94-
List<String> classesAtDex =
95-
DexReader.readClassNamesFromDex(file);
96-
97-
classNames.add(fName + ".dex");
98-
classNames.addAll(classesAtDex);
99-
dexIndex++;
100-
}
101-
if (zipEntry.getName().startsWith("lib")) {
102-
components.add(
103-
new ContentReader.Component(zipEntry.getName(),
104-
ContentReader.ARCHIVE_COMPONENT.NATIVE_LIBRARY));
105-
}
106-
107-
// Dynamic dex loading
108-
if (zipEntry.getName().endsWith("jar") || zipEntry.getName().endsWith("zip")) {
109-
String fName = "inner_zip";
110-
String ext = "zip";
111-
112-
File innerZip = SherlockHash.INSTANCE.getFileFromZipStream(binaryArchiveFile,
113-
zipInputStream, fName, ext);
114-
115-
// so far we have a zip file
116-
ZipInputStream fromInnerZip = new ZipInputStream(new FileInputStream(
117-
innerZip));
118-
119-
ZipEntry innerZipEntry;
120-
121-
while (true) {
122-
innerZipEntry = fromInnerZip.getNextEntry();
123-
124-
if (innerZipEntry == null) {
125-
break;
126-
}
127-
128-
if (innerZipEntry.getName().endsWith(".dex")) {
129-
fName = "inner_zip_classes" + dexIndex;
130-
ext = "dex";
131-
File tempDexFile =
132-
SherlockHash.INSTANCE.getFileFromZipStream(binaryArchiveFile,
133-
fromInnerZip, fName, ext);
134-
135-
List<String> classesAtDex =
136-
DexReader.readClassNamesFromDex(tempDexFile);
137-
138-
String name = zipEntry.getName() + "###" + innerZipEntry.getName();
139-
140-
classNames.add(name);
141-
classNames.addAll(classesAtDex);
142-
}
143-
}
144-
}
145-
}
146-
zipInputStream.close();
147-
148-
} catch (Exception e) {
149-
e.printStackTrace();
150-
}
151-
}
15255
}

0 commit comments

Comments
 (0)