Cleanup code and comments about /data/dalvik-cache.

ImageSpace no longer generate or use boot images in /data/dalvik-cache.

Bug: 203492478
Test: Presubmits
Change-Id: I2c422ec07363169654071db1692bbf1eaf61a479
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index fe387e2..2659e72 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -137,7 +137,6 @@
                                    const InstructionSet image_isa,
                                    std::string* system_filename,
                                    bool* has_system) {
-  std::string dalvik_cache_unused;
   return FindImageFilenameImpl(image_location,
                                image_isa,
                                has_system,
diff --git a/runtime/gc/space/image_space.h b/runtime/gc/space/image_space.h
index 28cc795..1dfafe8 100644
--- a/runtime/gc/space/image_space.h
+++ b/runtime/gc/space/image_space.h
@@ -85,7 +85,7 @@
   // should be used to search for that component's boot image extension.
   //
   // The actual filename shall be derived from the specified locations using
-  // `GetSystemImageFilename()` or `GetDalvikCacheFilename()`.
+  // `GetSystemImageFilename()`.
   //
   // Example image locations:
   //     /system/framework/boot.art
@@ -167,7 +167,7 @@
   }
 
   // Actual filename where image was loaded from.
-  // For example: /data/dalvik-cache/arm/system@framework@boot.art
+  // For example: /system/framework/arm64/boot.art
   const std::string GetImageFilename() const {
     return GetName();
   }
@@ -210,7 +210,7 @@
   // Returns the filename of the image corresponding to
   // requested image_location, or the filename where a new image
   // should be written if one doesn't exist. Looks for a generated
-  // image in the specified location and then in the dalvik-cache.
+  // image in the specified location.
   //
   // Returns true if an image was found, false otherwise.
   static bool FindImageFilename(const char* image_location,
@@ -287,9 +287,8 @@
   // Tries to initialize an ImageSpace from the given image path, returning null on error.
   //
   // If validate_oat_file is false (for /system), do not verify that image's OatFile is up-to-date
-  // relative to its DexFile inputs. Otherwise (for /data), validate the inputs and generate the
-  // OatFile in /data/dalvik-cache if necessary. If the oat_file is null, it uses the oat file from
-  // the image.
+  // relative to its DexFile inputs. Otherwise, validate `oat_file` and abandon it if the validation
+  // fails. If the oat_file is null, it uses the oat file from the image.
   static std::unique_ptr<ImageSpace> Init(const char* image_filename,
                                           const char* image_location,
                                           bool validate_oat_file,
diff --git a/runtime/gc/space/image_space_test.cc b/runtime/gc/space/image_space_test.cc
index 973bf5e..22550f6 100644
--- a/runtime/gc/space/image_space_test.cc
+++ b/runtime/gc/space/image_space_test.cc
@@ -423,51 +423,6 @@
   EXPECT_FALSE(Runtime::Current()->GetHeap()->GetBootImageSpaces().empty());
 }
 
-class NoAccessAndroidDataTest : public ImageSpaceLoadingTest<false, true> {
- protected:
-  NoAccessAndroidDataTest() : quiet_(LogSeverity::FATAL) {}
-
-  void SetUpRuntimeOptions(RuntimeOptions* options) override {
-    const char* android_data = getenv("ANDROID_DATA");
-    CHECK(android_data != nullptr);
-    old_android_data_ = android_data;
-    bad_android_data_ = old_android_data_ + "/no-android-data";
-    int result = setenv("ANDROID_DATA", bad_android_data_.c_str(), /* replace */ 1);
-    CHECK_EQ(result, 0) << strerror(errno);
-    result = mkdir(bad_android_data_.c_str(), /* mode */ 0700);
-    CHECK_EQ(result, 0) << strerror(errno);
-    // Create a regular file "dalvik_cache". GetDalvikCache() shall get EEXIST
-    // when trying to create a directory with the same name and creating a
-    // subdirectory for a particular architecture shall fail.
-    bad_dalvik_cache_ = bad_android_data_ + "/dalvik-cache";
-    int fd = creat(bad_dalvik_cache_.c_str(), /* mode */ 0);
-    CHECK_NE(fd, -1) << strerror(errno);
-    result = close(fd);
-    CHECK_EQ(result, 0) << strerror(errno);
-    ImageSpaceLoadingTest<false, true>::SetUpRuntimeOptions(options);
-  }
-
-  void TearDown() override {
-    ImageSpaceLoadingTest<false, true>::TearDown();
-    int result = unlink(bad_dalvik_cache_.c_str());
-    CHECK_EQ(result, 0) << strerror(errno);
-    result = rmdir(bad_android_data_.c_str());
-    CHECK_EQ(result, 0) << strerror(errno);
-    result = setenv("ANDROID_DATA", old_android_data_.c_str(), /* replace */ 1);
-    CHECK_EQ(result, 0) << strerror(errno);
-  }
-
- private:
-  ScopedLogSeverity quiet_;
-  std::string old_android_data_;
-  std::string bad_android_data_;
-  std::string bad_dalvik_cache_;
-};
-
-TEST_F(NoAccessAndroidDataTest, Test) {
-  EXPECT_TRUE(Runtime::Current()->GetHeap()->GetBootImageSpaces().empty());
-}
-
 }  // namespace space
 }  // namespace gc
 }  // namespace art