ART: Fix preverified setting in VerifyClass

Make sure soft-failed classes cannot set methods to pre-verified.

Bug: 16828525, 17465185
Change-Id: I09c0a68ca722978459741311148eae7614f9ca49
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 40414cf..ed5c843 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3411,11 +3411,13 @@
   ObjectLock<mirror::Class> lock(self, klass);
 
   // Don't attempt to re-verify if already sufficiently verified.
-  if (klass->IsVerified() ||
-      (klass->IsCompileTimeVerified() && Runtime::Current()->IsCompiler())) {
+  if (klass->IsVerified()) {
     EnsurePreverifiedMethods(klass);
     return;
   }
+  if (klass->IsCompileTimeVerified() && Runtime::Current()->IsCompiler()) {
+    return;
+  }
 
   // The class might already be erroneous, for example at compile time if we attempted to verify
   // this class as a parent to another.
@@ -3522,6 +3524,9 @@
         klass->SetStatus(mirror::Class::kStatusRetryVerificationAtRuntime, self);
       } else {
         klass->SetStatus(mirror::Class::kStatusVerified, self);
+        // As this is a fake verified status, make sure the methods are _not_ marked preverified
+        // later.
+        klass->SetAccessFlags(klass->GetAccessFlags() | kAccPreverified);
       }
     }
   } else {