Merge "Add a placeholder ART version number / api level for aosp/master." am: cb5c5daefc am: 6bcd17ae3b
am: a36ece5838

Change-Id: I12e99edfe1127a28307aa939053d0db2bb5c48a0
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/Opcode.java b/dexlib2/src/main/java/org/jf/dexlib2/Opcode.java
index 138c6c6..843550f 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/Opcode.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/Opcode.java
@@ -305,8 +305,8 @@
     SPARSE_SWITCH_PAYLOAD(0x200, "sparse-switch-payload", ReferenceType.NONE, Format.SparseSwitchPayload, 0),
     ARRAY_PAYLOAD(0x300, "array-payload", ReferenceType.NONE, Format.ArrayPayload, 0),
 
-    INVOKE_POLYMORPHIC(firstApi(0xfa, 26), "invoke-polymorphic", ReferenceType.METHOD, ReferenceType.METHOD_PROTO, Format.Format45cc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT),
-    INVOKE_POLYMORPHIC_RANGE(firstApi(0xfb, 26), "invoke-polymorphic/range", ReferenceType.METHOD, ReferenceType.METHOD_PROTO, Format.Format4rcc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT);
+    INVOKE_POLYMORPHIC(firstArtVersion(0xfa, 87), "invoke-polymorphic", ReferenceType.METHOD, ReferenceType.METHOD_PROTO, Format.Format45cc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT),
+    INVOKE_POLYMORPHIC_RANGE(firstArtVersion(0xfb, 87), "invoke-polymorphic/range", ReferenceType.METHOD, ReferenceType.METHOD_PROTO, Format.Format4rcc, Opcode.CAN_THROW | Opcode.CAN_CONTINUE | Opcode.SETS_RESULT);
 
     //if the instruction can throw an exception
     public static final int CAN_THROW = 0x1;
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/Opcodes.java b/dexlib2/src/main/java/org/jf/dexlib2/Opcodes.java
index 9f7d128..a137dee 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/Opcodes.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/Opcodes.java
@@ -101,9 +101,9 @@
 
         int version;
         if (isArt()) {
-            version = artVersion;
+            version = this.artVersion;
         } else {
-            version = api;
+            version = this.api;
         }
 
         for (Opcode opcode: Opcode.values()) {
diff --git a/dexlib2/src/main/java/org/jf/dexlib2/VersionMap.java b/dexlib2/src/main/java/org/jf/dexlib2/VersionMap.java
index e0e1a6b..b358187 100644
--- a/dexlib2/src/main/java/org/jf/dexlib2/VersionMap.java
+++ b/dexlib2/src/main/java/org/jf/dexlib2/VersionMap.java
@@ -35,6 +35,12 @@
     public static final int NO_VERSION = -1;
 
     public static int mapArtVersionToApi(int artVersion) {
+        // NOTE: Art version 87 and api level 26 do not correspond to any
+        // particular android release and represent the current (as of
+        // October 2016) state of aosp/master.
+        if (artVersion >= 87) {
+            return 26;
+        }
         if (artVersion >= 79) {
             return 24;
         }
@@ -62,10 +68,15 @@
             case 23:
                 return 64;
             case 24:
+            case 25:
                 return 79;
         }
-        if (api > 24) {
-            return 79;
+
+        // NOTE: Art version 87 and api level 26 do not correspond to any
+        // particular android release and represent the current (as of
+        // October 2016) state of aosp/master.
+        if (api > 25) {
+            return 87;
         }
         return NO_VERSION;
     }