Add support for Oat versions up to 173

The only relevant differences are some added/removed fields in the
OatHeader that affect the offsets of some fields we use.
This commit is contained in:
Ben Gruver 2019-10-02 16:36:26 -07:00
parent 539353a85c
commit b3b8778ef8
2 changed files with 11 additions and 2 deletions

View File

@ -161,3 +161,6 @@ e35ac04a1a9a22b1c4386b27f3a30cd840aa17b1 - 169
98fb083a30e9b37685f943e2923e65e60e0a0971 - 170
- Removes the interpreter_to_interpreter_bridge_offset_ field in oat header
- Removes the interpreter_to_compiled_code_bridge_offset_ field in oat header
e42a4b95eed312e6f7019645f4c66b2d77254433 - 171
697c47a7ffd4489c4bc4edc229c8123309526286 - 172
6c4ec5c1555aaeddd254750c15554a3c47bfc722 - 173

View File

@ -59,7 +59,7 @@ public class OatFile extends DexBuffer implements MultiDexContainer<DexBackedDex
// These are the "known working" versions that I have manually inspected the source for.
// Later version may or may not work, depending on what changed.
private static final int MIN_OAT_VERSION = 56;
private static final int MAX_OAT_VERSION = 86;
private static final int MAX_OAT_VERSION = 173;
public static final int UNSUPPORTED = 0;
public static final int SUPPORTED = 1;
@ -251,7 +251,13 @@ public class OatFile extends DexBuffer implements MultiDexContainer<DexBackedDex
public OatHeader(int offset) {
this.headerOffset = offset;
if (getVersion() >= 127) {
if (getVersion() >= 170) {
this.keyValueStoreOffset = 14 * 4;
} else if (getVersion() >= 166) {
this.keyValueStoreOffset = 16 * 4;
} else if (getVersion() >= 162) {
this.keyValueStoreOffset = 17 * 4;
} else if (getVersion() >= 127) {
this.keyValueStoreOffset = 19 * 4;
} else {
this.keyValueStoreOffset = 18 * 4;