struct CompilationOptions { // If not empty, generate the boot images for ISAs in the list.
std::vector<std::pair<InstructionSet, BootImages>> boot_images_to_generate_for_isas;
// If not empty, compile the system server jars in the list.
std::set<std::string> system_server_jars_to_compile;
// Only keep the first failure. if (status == OdrMetrics::Status::kOK) {
status = other.status;
error_msg = other.error_msg;
dex2oat_result = other.dex2oat_result;
}
}
};
// Indicates why the precondition is not okay, or `std::nullopt` if it's okay.
std::optional<OdrMetrics::Trigger> trigger_; bool primary_boot_image_ok_; bool boot_image_mainline_extension_ok_; bool system_server_ok_;
};
class OnDeviceRefresh final { public: explicit OnDeviceRefresh( const OdrConfig& config,
android::base::function_ref<int(constchar*, constchar*)> setfilecon,
android::base::function_ref<int(constchar*, unsignedint)> restorecon);
// Constructor with injections. For testing and internal use only.
OnDeviceRefresh( const OdrConfig& config,
android::base::function_ref<int(constchar*, constchar*)> setfilecon,
android::base::function_ref<int(constchar*, unsignedint)> restorecon, const std::string& cache_info_filename,
std::unique_ptr<ExecUtils> exec_utils,
android::base::function_ref<bool()> check_compilation_space);
// Returns the exit code and specifies what should be compiled in `compilation_options`.
WARN_UNUSED ExitCode
CheckArtifactsAreUpToDate(OdrMetrics& metrics, /*out*/ CompilationOptions* compilation_options) const;
// Returns a set of all system server jars.
std::set<std::string> AllSystemServerJars() const { return {all_systemserver_jars_.begin(), all_systemserver_jars_.end()};
}
// Gets the `ApexInfo` for active APEXes.
std::optional<std::vector<com::android::apex::ApexInfo>> GetApexInfoList() const;
// Reads the ART APEX cache information (if any) found in the output artifact directory.
android::base::Result<com::android::art::CacheInfo> ReadCacheInfo() const;
// Writes ART APEX cache information to `kOnDeviceRefreshOdrefreshArtifactDirectory`.
android::base::Result<void> WriteCacheInfo() const;
// Returns the list of BCP jars in the ART module.
std::vector<std::string> GetArtBcpJars() const;
// Returns the list of BCP jars for the boot image framework extension.
std::vector<std::string> GetFrameworkBcpJars() const;
// Returns the list of BCP jars for the boot image mainline extension.
std::vector<std::string> GetMainlineBcpJars() const;
// Returns the symbolic primary boot image location (without ISA). If `minimal` is true, returns // the symbolic location of the minimal boot image.
std::string GetPrimaryBootImage(bool on_system, bool minimal) const;
// Returns the real primary boot image location (with ISA). If `minimal` is true, returns the // real location of the minimal boot image.
std::string GetPrimaryBootImagePath(bool on_system, bool minimal, InstructionSet isa) const;
// Returns the symbolic boot image framework extension location (without ISA). Note that this only // applies to boot images on /system.
std::string GetSystemBootImageFrameworkExtension() const;
// Returns the real boot image framework extension location (with ISA). Note that this only // applies to boot images on /system.
std::string GetSystemBootImageFrameworkExtensionPath(InstructionSet isa) const;
// Returns the real boot image mainline extension location (with ISA).
std::string GetBootImageMainlineExtensionPath(bool on_system, InstructionSet isa) const;
// Returns the best combination of symbolic boot image locations (without ISA) based on file // existence.
std::vector<std::string> GetBestBootImages(InstructionSet isa, bool include_mainline_extension) const;
// Removes files that are not in the list.
android::base::Result<void> CleanupArtifactDirectory(
OdrMetrics& metrics, const std::vector<std::string>& artifacts_to_keep) const;
// Loads artifacts to memory and writes them back. This is a workaround for old versions of // odsign, which encounters "file exists" error when it adds existing artifacts to fs-verity. This // function essentially removes existing artifacts from fs-verity to avoid the error.
android::base::Result<void> RefreshExistingArtifacts() const;
// Returns whether the primary boot image is present. // If `on_system` is true, checks both the primary boot image and the framework extension on // /system. // If `minimal` is true, checks the minimal boot image. // If `checked_artifacts` is present, adds checked artifacts to `checked_artifacts`.
WARN_UNUSED bool PrimaryBootImageExist( bool on_system, bool minimal,
InstructionSet isa, /*out*/ std::string* error_msg, /*out*/ std::vector<std::string>* checked_artifacts = nullptr) const;
// Checks whether all system_server artifacts are present. The artifacts are checked in their // order of compilation. Returns true if all are present, false otherwise. // Adds the paths to the jars that are missing artifacts in `jars_with_missing_artifacts`. // If `checked_artifacts` is present, adds checked artifacts to `checked_artifacts`. bool SystemServerArtifactsExist( bool on_system, /*out*/ std::string* error_msg, /*out*/ std::set<std::string>* jars_missing_artifacts, /*out*/ std::vector<std::string>* checked_artifacts = nullptr) const;
// Returns true if all of the system properties listed in `kSystemProperties` are set to the // default values. This function is usually called when cache-info.xml does not exist (i.e., // compilation has not been done before).
WARN_UNUSED bool CheckSystemPropertiesAreDefault() const;
// Returns true if none of the system properties listed in `kSystemProperties` has changed since // the last compilation. This function is usually called when cache-info.xml exists.
WARN_UNUSED bool CheckSystemPropertiesHaveNotChanged( const com::android::art::CacheInfo& cache_info) const;
// Returns true if the system image is built with the right userfaultfd GC flag.
WARN_UNUSED bool CheckBuildUserfaultFdGc() const;
// Returns whether the precondition for using artifacts on /system is met. Note that this function // does not check the artifacts.
WARN_UNUSED PreconditionCheckResult
CheckPreconditionForSystem(const std::vector<com::android::apex::ApexInfo>& apex_info_list) const;
// Returns whether the precondition for using artifacts on /data is met. Note that this function // does not check the artifacts.
WARN_UNUSED PreconditionCheckResult
CheckPreconditionForData(const std::vector<com::android::apex::ApexInfo>& apex_info_list) const;
// Checks whether all boot classpath artifacts are up to date. Returns the boot images that need // to be (re-)generated. If `checked_artifacts` is present, adds checked artifacts to // `checked_artifacts`.
WARN_UNUSED BootImages
CheckBootClasspathArtifactsAreUpToDate(OdrMetrics& metrics,
InstructionSet isa, const PreconditionCheckResult& system_result, const PreconditionCheckResult& data_result, /*out*/ std::vector<std::string>* checked_artifacts) const;
// Checks whether all system_server artifacts are up to date. The artifacts are checked in their // order of compilation. Returns the paths to the jars that need to be compiled. // If `checked_artifacts` is present, adds checked artifacts to `checked_artifacts`.
WARN_UNUSED std::set<std::string> CheckSystemServerArtifactsAreUpToDate(
OdrMetrics& metrics, const PreconditionCheckResult& system_result, const PreconditionCheckResult& data_result, /*out*/ std::vector<std::string>* checked_artifacts) const;
// Configuration to use. const OdrConfig& config_;
// Path to cache information file that is used to speed up artifact checking. const std::string cache_info_filename_;
// The raw list from DEX2OATBOOTCLASSPATH. This is the list of jars that should be compiled into // the primary boot image.
std::vector<std::string> dex2oat_boot_classpath_jars_;
// The raw list from BOOTCLASSPATH. This is the list of all BCP jars.
std::vector<std::string> boot_classpath_jars_;
// Set of system_server components in SYSTEMSERVERCLASSPATH that should be compiled.
std::unordered_set<std::string> systemserver_classpath_jars_;
// List of all system_server components, including those in SYSTEMSERVERCLASSPATH and those in // STANDALONE_SYSTEMSERVER_JARS (jars that system_server loads dynamically using separate // classloaders).
std::vector<std::string> all_systemserver_jars_;
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.