summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jiakai Zhang <jiakaiz@google.com> 2023-03-14 17:23:54 +0000
committer Jiakai Zhang <jiakaiz@google.com> 2023-03-15 21:48:43 +0000
commite151e0f40ffdba04b7378c12f4f436d0eac9ef43 (patch)
treea1007028ef206889ba28de5fa07272f79993d197
parent747a28662af34a26c3084eff7d0f40b9f12d0506 (diff)
Allow all types of files to be passed as dex files.
In fact, dex2oat doesn't have a limit on the file extension. It only checks the magic number at the beginning of the file. Potentially, apps can use any extension for their secondary dex files. Bug: 272053358 Test: Presubmit (v2/android-app-compat-engprod/csuite/top_100_app_launch_presubmit_partition_1) Ignore-AOSP-First: ART Services Change-Id: I933344f3b3b6d3dca23ca97f2846aff7f0aa2ba1
-rw-r--r--artd/path_utils.cc4
-rw-r--r--artd/path_utils_test.cc6
2 files changed, 0 insertions, 10 deletions
diff --git a/artd/path_utils.cc b/artd/path_utils.cc
index cac9444b97..6ef0eafb53 100644
--- a/artd/path_utils.cc
+++ b/artd/path_utils.cc
@@ -40,7 +40,6 @@ using ::aidl::com::android::server::art::ArtifactsPath;
using ::aidl::com::android::server::art::DexMetadataPath;
using ::aidl::com::android::server::art::ProfilePath;
using ::aidl::com::android::server::art::VdexPath;
-using ::android::base::EndsWith;
using ::android::base::Error;
using ::android::base::Result;
@@ -155,9 +154,6 @@ Result<std::vector<std::string>> ListManagedFiles() {
Result<void> ValidateDexPath(const std::string& dex_path) {
OR_RETURN(ValidateAbsoluteNormalPath(dex_path));
- if (!EndsWith(dex_path, ".apk") && !EndsWith(dex_path, ".jar")) {
- return Errorf("Dex path '{}' has an invalid extension", dex_path);
- }
return {};
}
diff --git a/artd/path_utils_test.cc b/artd/path_utils_test.cc
index b0e1a257a0..b0cc827f62 100644
--- a/artd/path_utils_test.cc
+++ b/artd/path_utils_test.cc
@@ -86,12 +86,6 @@ TEST_F(PathUtilsTest, BuildOatPathNul) {
HasError(WithMessage("Path '/a/\0/b.apk' has invalid character '\\0'"s)));
}
-TEST_F(PathUtilsTest, BuildOatPathInvalidDexExtension) {
- EXPECT_THAT(BuildOatPath(ArtifactsPath{
- .dexPath = "/a/b.invalid", .isa = "arm64", .isInDalvikCache = false}),
- HasError(WithMessage("Dex path '/a/b.invalid' has an invalid extension")));
-}
-
TEST_F(PathUtilsTest, BuildOatPathInvalidIsa) {
EXPECT_THAT(BuildOatPath(
ArtifactsPath{.dexPath = "/a/b.apk", .isa = "invalid", .isInDalvikCache = false}),