Merge "Do not verify apks when processing profiles"
diff --git a/profman/profile_assistant_test.cc b/profman/profile_assistant_test.cc
index 17b7af1..bd44e49 100644
--- a/profman/profile_assistant_test.cc
+++ b/profman/profile_assistant_test.cc
@@ -243,8 +243,7 @@
bool CreateProfile(const std::string& profile_file_contents,
const std::string& filename,
- const std::string& dex_location,
- bool skip_verification) {
+ const std::string& dex_location) {
ScratchFile class_names_file;
File* file = class_names_file.GetFile();
EXPECT_TRUE(file->WriteFully(profile_file_contents.c_str(), profile_file_contents.length()));
@@ -257,9 +256,6 @@
argv_str.push_back("--reference-profile-file=" + filename);
argv_str.push_back("--apk=" + dex_location);
argv_str.push_back("--dex-location=" + dex_location);
- if (skip_verification) {
- argv_str.push_back("--skip-apk-verification");
- }
std::string error;
EXPECT_EQ(ExecAndReturnCode(argv_str, &error), 0);
return true;
@@ -276,7 +272,6 @@
argv_str.push_back("--profile-file=" + filename);
argv_str.push_back("--apk=" + GetLibCoreDexFileNames()[0]);
argv_str.push_back("--dex-location=" + GetLibCoreDexFileNames()[0]);
- argv_str.push_back("--skip-apk-verification");
argv_str.push_back("--dump-output-to-fd=" + std::to_string(GetFd(output_file)));
std::string error;
EXPECT_EQ(ExecAndReturnCode(argv_str, &error), 0);
@@ -307,8 +302,7 @@
ScratchFile profile_file;
EXPECT_TRUE(CreateProfile(input_file_contents,
profile_file.GetFilename(),
- GetLibCoreDexFileNames()[0],
- /* skip_verification */ true));
+ GetLibCoreDexFileNames()[0]));
profile_file.GetFile()->ResetOffset();
EXPECT_TRUE(DumpClassesAndMethods(profile_file.GetFilename(), output_file_contents));
return true;
@@ -715,8 +709,7 @@
ScratchFile profile_file;
EXPECT_TRUE(CreateProfile(input_file_contents,
profile_file.GetFilename(),
- GetLibCoreDexFileNames()[0],
- /* skip_verification */ true));
+ GetLibCoreDexFileNames()[0]));
ProfileCompilationInfo info;
profile_file.GetFile()->ResetOffset();
ASSERT_TRUE(info.Load(GetFd(profile_file)));
@@ -773,7 +766,7 @@
kUncommonDirtyClass;
profiles.emplace_back(ScratchFile());
EXPECT_TRUE(CreateProfile(
- dex1, profiles.back().GetFilename(), core_dex, /* skip_verification */ true));
+ dex1, profiles.back().GetFilename(), core_dex));
// Create a bunch of boot profiles.
std::string dex2 =
@@ -784,7 +777,7 @@
kUncommonDirtyClass;
profiles.emplace_back(ScratchFile());
EXPECT_TRUE(CreateProfile(
- dex2, profiles.back().GetFilename(), core_dex, /* skip_verification */ true));
+ dex2, profiles.back().GetFilename(), core_dex));
// Create a bunch of boot profiles.
std::string dex3 =
@@ -794,7 +787,7 @@
kDirtyClass + "\n";
profiles.emplace_back(ScratchFile());
EXPECT_TRUE(CreateProfile(
- dex3, profiles.back().GetFilename(), core_dex, /* skip_verification */ true));
+ dex3, profiles.back().GetFilename(), core_dex));
// Generate the boot profile.
ScratchFile out_profile;
@@ -807,7 +800,6 @@
args.push_back("--reference-profile-file=" + out_profile.GetFilename());
args.push_back("--apk=" + core_dex);
args.push_back("--dex-location=" + core_dex);
- args.push_back("--skip-apk-verification");
for (const ScratchFile& profile : profiles) {
args.push_back("--profile-file=" + profile.GetFilename());
}
@@ -903,8 +895,7 @@
ScratchFile profile_file;
ASSERT_TRUE(CreateProfile(input_file_contents,
profile_file.GetFilename(),
- GetTestDexFileName("ProfileTestMultiDex"),
- /* skip_verification */ false));
+ GetTestDexFileName("ProfileTestMultiDex")));
// Load the profile from disk.
ProfileCompilationInfo info;
@@ -1054,8 +1045,7 @@
std::string dex_filename = GetTestDexFileName("ProfileTestMultiDex");
ASSERT_TRUE(CreateProfile(input_file_contents,
profile_file.GetFilename(),
- dex_filename,
- /* skip_verification */ false));
+ dex_filename));
// Load the profile from disk.
ProfileCompilationInfo info;
diff --git a/profman/profman.cc b/profman/profman.cc
index 12bcdc6..cd88d03 100644
--- a/profman/profman.cc
+++ b/profman/profman.cc
@@ -186,7 +186,6 @@
dump_only_(false),
dump_classes_and_methods_(false),
generate_boot_image_profile_(false),
- skip_apk_verification_(false),
dump_output_to_fd_(kInvalidFd),
test_profile_num_dex_(kDefaultTestProfileNumDex),
test_profile_method_percerntage_(kDefaultTestProfileMethodPercentage),
@@ -230,8 +229,6 @@
ParseUintOption(option, "--dump-output-to-fd", &dump_output_to_fd_, Usage);
} else if (option == "--generate-boot-image-profile") {
generate_boot_image_profile_ = true;
- } else if (option == "--skip-apk-verification") {
- skip_apk_verification_ = true;
} else if (option.starts_with("--boot-image-class-threshold=")) {
ParseUintOption(option,
"--boot-image-class-threshold",
@@ -368,10 +365,6 @@
return result;
}
- bool ShouldSkipApkVerification() const {
- return skip_apk_verification_;
- }
-
bool GetProfileFilterKeyFromApks(std::set<ProfileFilterKey>* profile_filter_keys) {
auto process_fn = [profile_filter_keys](std::unique_ptr<const DexFile>&& dex_file) {
// Store the profile key of the location instead of the location itself.
@@ -423,10 +416,11 @@
std::string error_msg;
const ArtDexFileLoader dex_file_loader;
std::vector<std::unique_ptr<const DexFile>> dex_files_for_location;
+ // We do not need to verify the apk for processing profiles.
if (use_apk_fd_list) {
if (dex_file_loader.OpenZip(apks_fd_[i],
dex_locations_[i],
- /* verify */ !ShouldSkipApkVerification(),
+ /* verify */ false,
kVerifyChecksum,
&error_msg,
&dex_files_for_location)) {
@@ -437,7 +431,7 @@
} else {
if (dex_file_loader.Open(apk_files_[i].c_str(),
dex_locations_[i],
- /* verify */ !ShouldSkipApkVerification(),
+ /* verify */ false,
kVerifyChecksum,
&error_msg,
&dex_files_for_location)) {
@@ -1260,7 +1254,6 @@
bool dump_only_;
bool dump_classes_and_methods_;
bool generate_boot_image_profile_;
- bool skip_apk_verification_;
int dump_output_to_fd_;
BootImageOptions boot_image_options_;
std::string test_profile_;
diff --git a/tools/generate-boot-image-profile.sh b/tools/generate-boot-image-profile.sh
index ee53f43..44c64d2 100755
--- a/tools/generate-boot-image-profile.sh
+++ b/tools/generate-boot-image-profile.sh
@@ -48,7 +48,7 @@
# Boot jars have hidden API access flags which do not pass dex file
# verification. Skip it.
-jar_args=("--skip-apk-verification")
+jar_args=()
boot_jars=$("$ANDROID_BUILD_TOP"/art/tools/bootjars.sh --target)
jar_dir=$ANDROID_BUILD_TOP/$(get_build_var TARGET_OUT_JAVA_LIBRARIES)
for file in $boot_jars; do