Revert "Don't enforce access checks for overloading for targetSdkVersion < 17."

This reverts commit 0fe885202fc2d1e7f3d34c99ae3487a9a6387be1

May be causing http://b/7343420, though I can't reproduce that crash.

Change-Id: Ia3d2a1507602d07699d1f9914e734cc813f97518
diff --git a/vm/Globals.h b/vm/Globals.h
index 3a90ddf..565c92a 100644
--- a/vm/Globals.h
+++ b/vm/Globals.h
@@ -124,8 +124,6 @@
     void        (*abortHook)(void);
     bool        (*isSensitiveThreadHook)(void);
 
-    int targetSdkVersion;
-
     int         jniGrefLimit;       // 0 means no limit
     char*       jniTrace;
     bool        reduceSignals;
diff --git a/vm/native/dalvik_system_VMRuntime.cpp b/vm/native/dalvik_system_VMRuntime.cpp
index 0195a8c..72bad29 100644
--- a/vm/native/dalvik_system_VMRuntime.cpp
+++ b/vm/native/dalvik_system_VMRuntime.cpp
@@ -191,10 +191,10 @@
     // This is the target SDK version of the app we're about to run.
     // Note that this value may be CUR_DEVELOPMENT (10000).
     // Note that this value may be 0, meaning "current".
-    gDvm.targetSdkVersion = args[1];
-    if (gDvm.targetSdkVersion > 0 && gDvm.targetSdkVersion <= 13 /* honeycomb-mr2 */) {
+    int targetSdkVersion = args[1];
+    if (targetSdkVersion > 0 && targetSdkVersion <= 13 /* honeycomb-mr2 */) {
         // TODO: running with CheckJNI should override this and force you to obey the strictest rules.
-        ALOGI("Turning on JNI app bug workarounds for target SDK version %i...", gDvm.targetSdkVersion);
+        ALOGI("Turning on JNI app bug workarounds for target SDK version %i...", targetSdkVersion);
         gDvmJni.workAroundAppJniBugs = true;
     }
     RETURN_VOID();
diff --git a/vm/oo/Class.cpp b/vm/oo/Class.cpp
index 17c9ff8..eb816b0 100644
--- a/vm/oo/Class.cpp
+++ b/vm/oo/Class.cpp
@@ -2914,30 +2914,24 @@
                 Method* superMeth = clazz->vtable[si];
 
                 if (dvmCompareMethodNamesAndProtos(localMeth, superMeth) == 0) {
-                    // Some apps were relying on us not checking access: http://b/7301030
-                    bool isPreJbMr1 = (gDvm.targetSdkVersion > 0 && gDvm.targetSdkVersion < 17);
-                    bool isAccessible = dvmCheckMethodAccess(clazz, superMeth);
-                    if (isPreJbMr1 || isAccessible) {
+                    if (dvmCheckMethodAccess(clazz, superMeth)) {
+                        /* verify */
                         if (dvmIsFinalMethod(superMeth)) {
                             ALOGW("Method %s.%s overrides final %s.%s",
-                                  localMeth->clazz->descriptor, localMeth->name,
-                                  superMeth->clazz->descriptor, superMeth->name);
+                                localMeth->clazz->descriptor, localMeth->name,
+                                superMeth->clazz->descriptor, superMeth->name);
                             goto bail;
                         }
-
-                        // Warn if we may have just worked around broken code...
-                        if (!isAccessible) {
-                            ALOGW("in older Android releases, method %s.%s would have incorrectly "
-                                  "overridden package-private method with same name in %s",
-                                  localMeth->clazz->descriptor, localMeth->name,
-                                  superMeth->clazz->descriptor);
-                        }
-
                         clazz->vtable[si] = localMeth;
                         localMeth->methodIndex = (u2) si;
                         //ALOGV("+++   override %s.%s (slot %d)",
                         //    clazz->descriptor, localMeth->name, si);
                         break;
+                    } else {
+                        ALOGW("in older versions of dalvik, method %s.%s would have incorrectly "
+                              "overridden package-private method with same name in %s",
+                              localMeth->clazz->descriptor, localMeth->name,
+                              superMeth->clazz->descriptor);
                     }
                 }
             }