Snap for 5135467 from d159521daac233a82b235c7a6baeb7e3d3c498a0 to pi-qpr2-release

Change-Id: Ic843df3a1eb7d688ed635348b051fb73d67dae46
diff --git a/dx/tests/run-test b/dx/tests/run-test
index f205c46..a781d8d 100755
--- a/dx/tests/run-test
+++ b/dx/tests/run-test
@@ -54,6 +54,7 @@
 expected="expected.txt"
 output="out.txt"
 
+clean_on_exit="yes"
 dev_mode="no"
 update_mode="no"
 tmpdir=/tmp/test-$$
@@ -61,7 +62,8 @@
 
 while [[ "x$1" = "x-"* ]]; do
     case $1 in
-         --dev) dev_mode="yes" ;;
+        --dev) dev_mode="yes" ;;
+        --no-clean) clean_on_exit="no" ;;
          --output_dir)
              tmpdir=$2
              shift ;;
@@ -156,7 +158,11 @@
 
 if [ "$good" = "yes" ]; then
     cd "$oldwd"
-    rm -rf "$tmpdir"
+    if [ "$clean_on_exit" = "yes" ]; then
+        rm -rf "$tmpdir"
+    else
+        echo "Test artifacts left in $tmpdir"
+    fi
     exit 0
 fi
 
diff --git a/libdex/DexOpcodes.h b/libdex/DexOpcodes.h
index 1c684ab..f4dcd6b 100644
--- a/libdex/DexOpcodes.h
+++ b/libdex/DexOpcodes.h
@@ -609,11 +609,7 @@
      * that data tables get generated in a consistent way.
      */
     int lowByte = codeUnit & 0xff;
-    if (lowByte != 0xff) {
-        return (Opcode) lowByte;
-    } else {
-        return (Opcode) ((codeUnit >> 8) | 0x100);
-    }
+    return (Opcode) lowByte;
 }
 
 /*
diff --git a/libdex/DexSwapVerify.cpp b/libdex/DexSwapVerify.cpp
index 8836ab2..1f8eed8 100644
--- a/libdex/DexSwapVerify.cpp
+++ b/libdex/DexSwapVerify.cpp
@@ -2908,7 +2908,8 @@
     if ((memcmp(version, DEX_MAGIC_VERS, 4) != 0) &&
         (memcmp(version, DEX_MAGIC_VERS_API_13, 4) != 0) &&
         (memcmp(version, DEX_MAGIC_VERS_37, 4) != 0) &&
-        (memcmp(version, DEX_MAGIC_VERS_38, 4) != 0)) {
+        (memcmp(version, DEX_MAGIC_VERS_38, 4) != 0) &&
+        (memcmp(version, DEX_MAGIC_VERS_39, 4) != 0)) {
         /*
          * Magic was correct, but this is an unsupported older or
          * newer format variant.