using ::aidl::com::android::server::art::ArtConstants; using ::aidl::com::android::server::art::ArtifactsPath; using ::aidl::com::android::server::art::DexMetadataPath; using ::aidl::com::android::server::art::OutputArtifacts; using ::aidl::com::android::server::art::OutputProfile; using ::aidl::com::android::server::art::ProfilePath; using ::aidl::com::android::server::art::RuntimeArtifactsPath; using ::aidl::com::android::server::art::SecureDexMetadataWithCompanionPaths; using ::aidl::com::android::server::art::VdexPath; using ::android::base::Error; using ::android::base::Result; using ::art::service::ValidateDexPath; using ::art::service::ValidatePathElement; using ::art::service::ValidatePathElementSubstring;
using PrebuiltProfilePath = ProfilePath::PrebuiltProfilePath; using PrimaryCurProfilePath = ProfilePath::PrimaryCurProfilePath; using PrimaryRefProfilePath = ProfilePath::PrimaryRefProfilePath; using SecondaryCurProfilePath = ProfilePath::SecondaryCurProfilePath; using SecondaryRefProfilePath = ProfilePath::SecondaryRefProfilePath; using TmpProfilePath = ProfilePath::TmpProfilePath; using WritableProfilePath = ProfilePath::WritableProfilePath;
// An old version doesn't know about the staged metadata file but only the Pre-reboot suffix. If the // file didn't end with the suffix, `Artd::cleanup` would consider it an unknown file and delete it.
static_assert(std::string_view(kPreRebootStagedMetadataFile).ends_with(kPreRebootSuffix), "");
// Only to be changed for testing.
std::string_view gListRootDir = "/";
} // namespace
Result<std::string> GetAndroidDataOrError() {
std::string error_msg;
std::string result = GetAndroidDataSafe(&error_msg); if (!error_msg.empty()) { return Error() << error_msg;
} return result;
}
Result<std::string> GetAndroidExpandOrError() {
std::string error_msg;
std::string result = GetAndroidExpandSafe(&error_msg); if (!error_msg.empty()) { return Error() << error_msg;
} return result;
}
Result<std::string> GetArtRootOrError() {
std::string error_msg;
std::string result = GetArtRootSafe(&error_msg); if (!error_msg.empty()) { return Error() << error_msg;
} return result;
}
std::vector<std::string> ListManagedFiles(const std::string& android_data, const std::string& android_expand) { // See `art::tools::Glob` for the syntax.
std::vector<std::string> patterns = { // Profiles for primary dex files.
android_data + "/misc/profiles/**", // Artifacts for primary dex files.
android_data + "/dalvik-cache/**",
};
std::string oat_path;
std::string error_msg; if (is_in_dalvik_cache) { // Apps' OAT files are never in ART APEX data. if (!OatFileAssistant::DexLocationToOatFilename(dex_path,
isa, /*deny_art_apex_data_files=*/true,
&oat_path,
&error_msg)) { return Errorf("{}", error_msg);
}
} else { if (!OatFileAssistant::DexLocationToOdexFilename(dex_path, isa, &oat_path, &error_msg)) { return Errorf("{}", error_msg);
}
}
Result<std::string> BuildWritableProfilePath(const WritableProfilePath& profile_path) { switch (profile_path.getTag()) { case WritableProfilePath::forPrimary: return BuildPrimaryRefProfilePath(profile_path.get<WritableProfilePath::forPrimary>()); case WritableProfilePath::forSecondary: return BuildSecondaryRefProfilePath(profile_path.get<WritableProfilePath::forSecondary>()); // No default. All cases should be explicitly handled, or the compilation will fail.
} // This should never happen. Just in case we get a non-enumerator value.
LOG(FATAL) << ART_FORMAT("Unexpected writable profile path type {}",
fmt::underlying(profile_path.getTag()));
}
Result<std::string> BuildProfileOrDmPath(const ProfilePath& profile_path) { switch (profile_path.getTag()) { case ProfilePath::primaryRefProfilePath: return BuildPrimaryRefProfilePath(profile_path.get<ProfilePath::primaryRefProfilePath>()); case ProfilePath::prebuiltProfilePath: return BuildPrebuiltProfilePath(profile_path.get<ProfilePath::prebuiltProfilePath>()); case ProfilePath::primaryCurProfilePath: return BuildPrimaryCurProfilePath(profile_path.get<ProfilePath::primaryCurProfilePath>()); case ProfilePath::secondaryRefProfilePath: return BuildSecondaryRefProfilePath(profile_path.get<ProfilePath::secondaryRefProfilePath>()); case ProfilePath::secondaryCurProfilePath: return BuildSecondaryCurProfilePath(profile_path.get<ProfilePath::secondaryCurProfilePath>()); case ProfilePath::tmpProfilePath: return BuildTmpProfilePath(profile_path.get<ProfilePath::tmpProfilePath>()); case ProfilePath::dexMetadataPath: return BuildDexMetadataPath(profile_path.get<ProfilePath::dexMetadataPath>()); // No default. All cases should be explicitly handled, or the compilation will fail.
} // This should never happen. Just in case we get a non-enumerator value.
LOG(FATAL) << ART_FORMAT("Unexpected profile path type {}",
fmt::underlying(profile_path.getTag()));
}
bool PreRebootFlag(const ProfilePath& profile_path) { switch (profile_path.getTag()) { case ProfilePath::primaryRefProfilePath: return profile_path.get<ProfilePath::primaryRefProfilePath>().isPreReboot; case ProfilePath::secondaryRefProfilePath: return profile_path.get<ProfilePath::secondaryRefProfilePath>().isPreReboot; case ProfilePath::tmpProfilePath: return PreRebootFlag(profile_path.get<ProfilePath::tmpProfilePath>()); case ProfilePath::prebuiltProfilePath: case ProfilePath::primaryCurProfilePath: case ProfilePath::secondaryCurProfilePath: case ProfilePath::dexMetadataPath: returnfalse; // No default. All cases should be explicitly handled, or the compilation will fail.
} // This should never happen. Just in case we get a non-enumerator value.
LOG(FATAL) << ART_FORMAT("Unexpected profile path type {}",
fmt::underlying(profile_path.getTag()));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.