summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2025-02-03 12:12:07 +0000
committer Jiakai Zhang <jiakaiz@google.com> 2025-02-10 10:19:37 -0800
commitd6d5643407ceb14bf275c14a78f94048b1992af5 (patch)
tree843238a5662246aa6bdee742129d2589835f89a1
parent7dc95b4990baea7c3ae4a3459385cea1a4b1851e (diff)
Delete DexFile.getDexFileStatus.
This method was added for dumpsys (ag/991000), but dumpsys stopped depending on it long ago (https://r.android.com/652681). Now nobody is using it. As we are refactoring OatFileAssistant, we don't want to support it anymore. Bug: 377474232 Test: Presbumit Change-Id: I5353ab8752efb062f96826b8c2efd6e984346504
-rw-r--r--runtime/native/dalvik_system_DexFile.cc34
-rw-r--r--runtime/oat/oat_file_assistant.cc50
-rw-r--r--runtime/oat/oat_file_assistant.h4
-rw-r--r--runtime/oat/oat_file_assistant_test.cc4
4 files changed, 1 insertions, 91 deletions
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
index 860ded28c7..f7354dbf36 100644
--- a/runtime/native/dalvik_system_DexFile.cc
+++ b/runtime/native/dalvik_system_DexFile.cc
@@ -628,38 +628,6 @@ static jint GetDexOptNeeded(JNIEnv* env,
downgrade);
}
-static jstring DexFile_getDexFileStatus(JNIEnv* env,
- jclass,
- jstring javaFilename,
- jstring javaInstructionSet) {
- ScopedUtfChars filename(env, javaFilename);
- if (env->ExceptionCheck()) {
- return nullptr;
- }
-
- ScopedUtfChars instruction_set(env, javaInstructionSet);
- if (env->ExceptionCheck()) {
- return nullptr;
- }
-
- const InstructionSet target_instruction_set = GetInstructionSetFromString(
- instruction_set.c_str());
- if (target_instruction_set == InstructionSet::kNone) {
- ScopedLocalRef<jclass> iae(env, env->FindClass("java/lang/IllegalArgumentException"));
- std::string message(StringPrintf("Instruction set %s is invalid.", instruction_set.c_str()));
- env->ThrowNew(iae.get(), message.c_str());
- return nullptr;
- }
-
- // The API doesn't support passing a class loader context, so skip the class loader context check
- // and assume that it's OK.
- OatFileAssistant oat_file_assistant(filename.c_str(),
- target_instruction_set,
- /* context= */ nullptr,
- /* load_executable= */ false);
- return env->NewStringUTF(oat_file_assistant.GetStatusDump().c_str());
-}
-
// Return an array specifying the optimization status of the given file.
// The array specification is [compiler_filter, compiler_reason].
static jobjectArray DexFile_getDexFileOptimizationStatus(JNIEnv* env,
@@ -1039,8 +1007,6 @@ static JNINativeMethod gMethods[] = {
DexFile, getNonProfileGuidedCompilerFilter, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(DexFile, getSafeModeCompilerFilter, "(Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(DexFile, isBackedByOatFile, "(Ljava/lang/Object;)Z"),
- NATIVE_METHOD(
- DexFile, getDexFileStatus, "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;"),
NATIVE_METHOD(DexFile,
getDexFileOutputPaths,
"(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;"),
diff --git a/runtime/oat/oat_file_assistant.cc b/runtime/oat/oat_file_assistant.cc
index 151c3a6ca9..be145d8ce1 100644
--- a/runtime/oat/oat_file_assistant.cc
+++ b/runtime/oat/oat_file_assistant.cc
@@ -208,8 +208,7 @@ OatFileAssistant::OatFileAssistant(const char* dex_location,
// Check if the dex directory is writable.
// This will be needed in most uses of OatFileAssistant and so it's OK to
- // compute it eagerly. (the only use which will not make use of it is
- // OatFileAssistant::GetStatusDump())
+ // compute it eagerly.
size_t pos = dex_location_.rfind('/');
if (pos == std::string::npos) {
LOG(WARNING) << "Failed to determine dex file parent directory: " << dex_location_;
@@ -347,53 +346,6 @@ std::unique_ptr<OatFile> OatFileAssistant::GetBestOatFile() {
return GetBestInfo().ReleaseFileForUse();
}
-std::string OatFileAssistant::GetStatusDump() {
- std::ostringstream status;
- bool oat_file_exists = false;
- bool odex_file_exists = false;
- if (oat_.Status() != kOatCannotOpen) {
- // If we can open the file, Filename should not return null.
- CHECK(oat_.Filename() != nullptr);
-
- oat_file_exists = true;
- status << *oat_.Filename() << "[status=" << oat_.Status() << ", ";
- const OatFile* file = oat_.GetFile();
- if (file == nullptr) {
- // If the file is null even though the status is not kOatCannotOpen, it
- // means we must have a vdex file with no corresponding oat file. In
- // this case we cannot determine the compilation filter. Indicate that
- // we have only the vdex file instead.
- status << "vdex-only";
- } else {
- status << "compilation_filter=" << CompilerFilter::NameOfFilter(file->GetCompilerFilter());
- }
- }
-
- if (odex_.Status() != kOatCannotOpen) {
- // If we can open the file, Filename should not return null.
- CHECK(odex_.Filename() != nullptr);
-
- odex_file_exists = true;
- if (oat_file_exists) {
- status << "] ";
- }
- status << *odex_.Filename() << "[status=" << odex_.Status() << ", ";
- const OatFile* file = odex_.GetFile();
- if (file == nullptr) {
- status << "vdex-only";
- } else {
- status << "compilation_filter=" << CompilerFilter::NameOfFilter(file->GetCompilerFilter());
- }
- }
-
- if (!oat_file_exists && !odex_file_exists) {
- status << "invalid[";
- }
-
- status << "]";
- return status.str();
-}
-
std::vector<std::unique_ptr<const DexFile>> OatFileAssistant::LoadDexFiles(
const OatFile& oat_file, const char* dex_location) {
std::vector<std::unique_ptr<const DexFile>> dex_files;
diff --git a/runtime/oat/oat_file_assistant.h b/runtime/oat/oat_file_assistant.h
index 2c9b8ab204..2bfc53a444 100644
--- a/runtime/oat/oat_file_assistant.h
+++ b/runtime/oat/oat_file_assistant.h
@@ -238,10 +238,6 @@ class OatFileAssistant {
// the OatFileAssistant object.
std::unique_ptr<OatFile> GetBestOatFile();
- // Returns a human readable description of the status of the code for the
- // dex file. The returned description is for debugging purposes only.
- std::string GetStatusDump();
-
// Computes the optimization status of the given dex file. The result is
// returned via the two output parameters.
// - out_odex_location: the location of the (best) odex that will be used
diff --git a/runtime/oat/oat_file_assistant_test.cc b/runtime/oat/oat_file_assistant_test.cc
index a3b370470f..64c648ac8e 100644
--- a/runtime/oat/oat_file_assistant_test.cc
+++ b/runtime/oat/oat_file_assistant_test.cc
@@ -828,10 +828,6 @@ TEST_P(OatFileAssistantTest, VdexUpToDateNoOdex) {
/*expected_location=*/OatFileAssistant::kLocationOdex,
/*expected_legacy_result=*/-OatFileAssistant::kDex2OatForFilter);
- // Make sure we don't crash in this case when we dump the status. We don't
- // care what the actual dumped value is.
- oat_file_assistant.GetStatusDump();
-
VerifyOptimizationStatus(dex_location,
default_context_.get(),
"verify",