Remove OatFileAssistant IsOutOfDate, IsUpToDate, and NeedsRelocation.

Relatively recent design changes made these functions equivalent to
the Status function. Prefer to use the Status function instead to
simplify the OatFileAssistant API, especially in preparation for
expanding the number of possible Status results.

Bug: 30937355
Test: oat_file_assistant_test

Change-Id: Idfd594729210257f693f03ca823a8d54e74034c5
diff --git a/runtime/oat_file_assistant.cc b/runtime/oat_file_assistant.cc
index bb52c75..b92e050 100644
--- a/runtime/oat_file_assistant.cc
+++ b/runtime/oat_file_assistant.cc
@@ -137,7 +137,7 @@
 
 OatFileAssistant::DexOptNeeded
 OatFileAssistant::GetDexOptNeeded(CompilerFilter::Filter target, bool profile_changed) {
-  if (!oat_.IsOutOfDate()) {
+  if (oat_.Status() != kOatOutOfDate) {
     DexOptNeeded dexopt_needed = oat_.GetDexOptNeeded(target, profile_changed);
     if (dexopt_needed == kPatchOatNeeded) {
       dexopt_needed = kSelfPatchOatNeeded;
@@ -170,7 +170,7 @@
 }
 
 bool OatFileAssistant::IsUpToDate() {
-  return OatFileIsUpToDate() || OdexFileIsUpToDate();
+  return oat_.Status() == kOatUpToDate || odex_.Status() == kOatUpToDate;
 }
 
 OatFileAssistant::ResultOfAttemptToUpdate
@@ -190,7 +190,7 @@
 }
 
 std::unique_ptr<OatFile> OatFileAssistant::GetBestOatFile() {
-  if (!oat_.IsOutOfDate()) {
+  if (oat_.Status() != kOatOutOfDate) {
     return oat_.ReleaseFileForUse();
   }
   return odex_.ReleaseFileForUse();
@@ -255,18 +255,6 @@
   return odex_.Status();
 }
 
-bool OatFileAssistant::OdexFileIsOutOfDate() {
-  return odex_.IsOutOfDate();
-}
-
-bool OatFileAssistant::OdexFileNeedsRelocation() {
-  return odex_.NeedsRelocation();
-}
-
-bool OatFileAssistant::OdexFileIsUpToDate() {
-  return odex_.IsUpToDate();
-}
-
 CompilerFilter::Filter OatFileAssistant::OdexFileCompilerFilter() {
   return odex_.CompilerFilter();
 }
@@ -283,18 +271,6 @@
   return oat_.Status();
 }
 
-bool OatFileAssistant::OatFileIsOutOfDate() {
-  return oat_.IsOutOfDate();
-}
-
-bool OatFileAssistant::OatFileNeedsRelocation() {
-  return oat_.NeedsRelocation();
-}
-
-bool OatFileAssistant::OatFileIsUpToDate() {
-  return oat_.IsUpToDate();
-}
-
 CompilerFilter::Filter OatFileAssistant::OatFileCompilerFilter() {
   return oat_.CompilerFilter();
 }
@@ -810,18 +786,6 @@
   return status_;
 }
 
-bool OatFileAssistant::OatFileInfo::IsOutOfDate() {
-  return Status() == kOatOutOfDate;
-}
-
-bool OatFileAssistant::OatFileInfo::NeedsRelocation() {
-  return Status() == kOatNeedsRelocation;
-}
-
-bool OatFileAssistant::OatFileInfo::IsUpToDate() {
-  return Status() == kOatUpToDate;
-}
-
 CompilerFilter::Filter OatFileAssistant::OatFileInfo::CompilerFilter() {
   const OatFile* file = GetFile();
   CHECK(file != nullptr);
@@ -832,25 +796,26 @@
     CompilerFilter::Filter target, bool profile_changed) {
   bool compilation_desired = CompilerFilter::IsBytecodeCompilationEnabled(target);
 
-  // See if the oat file is in good shape as is.
-  bool okay = CompilerFilterIsOkay(target, profile_changed);
-  if (okay) {
-    if (compilation_desired) {
-      if (IsUpToDate()) {
+  if (CompilerFilterIsOkay(target, profile_changed)) {
+    if (Status() == kOatUpToDate) {
+      // The oat file is in good shape as is.
+      return kNoDexOptNeeded;
+    }
+
+    if (Status() == kOatNeedsRelocation) {
+      if (!compilation_desired) {
+        // If no compilation is desired, then it doesn't matter if the oat
+        // file needs relocation. It's in good shape as is.
         return kNoDexOptNeeded;
       }
-    } else {
-      if (!IsOutOfDate()) {
-        return kNoDexOptNeeded;
+
+      if (compilation_desired && HasPatchInfo()) {
+        // Relocate if we can.
+        return kPatchOatNeeded;
       }
     }
   }
 
-  // See if we can get an up-to-date file by running patchoat.
-  if (compilation_desired && okay && NeedsRelocation() && HasPatchInfo()) {
-    return kPatchOatNeeded;
-  }
-
   // We can only run dex2oat if there are original dex files.
   return oat_file_assistant_->HasOriginalDexFiles() ? kDex2OatNeeded : kNoDexOptNeeded;
 }
@@ -921,25 +886,25 @@
 }
 
 std::unique_ptr<OatFile> OatFileAssistant::OatFileInfo::ReleaseFileForUse() {
-  if (IsUpToDate()) {
+  if (Status() == kOatUpToDate) {
     return ReleaseFile();
   }
 
   VLOG(oat) << "Oat File Assistant: No relocated oat file found,"
     << " attempting to fall back to interpreting oat file instead.";
 
-  if (!IsOutOfDate() && !IsExecutable()) {
+  if (Status() == kOatNeedsRelocation && !IsExecutable()) {
     return ReleaseFile();
   }
 
-  if (!IsOutOfDate()) {
+  if (Status() == kOatNeedsRelocation) {
     // We are loading an oat file for runtime use that needs relocation.
     // Reload the file non-executable to ensure that we interpret out of the
     // dex code in the oat file rather than trying to execute the unrelocated
     // compiled code.
     oat_file_assistant_->load_executable_ = false;
     Reset();
-    if (!IsOutOfDate()) {
+    if (Status() != kOatOutOfDate) {
       CHECK(!IsExecutable());
       return ReleaseFile();
     }