// A helper class for OatFileAssistant that fetches and caches information including boot image // checksums, bootclasspath checksums, and APEX versions. The same instance can be reused across // OatFileAssistant calls on different dex files for different instruction sets. // This class is not thread-safe until `FetchAll` is called. class OatFileAssistantContext { public: // Options that a runtime would take. // Note that the struct only keeps references, so the caller must keep the objects alive during // the lifetime of OatFileAssistant. struct RuntimeOptions { // Required. See `-Ximage`. const std::vector<std::string>& image_locations; // Required. See `-Xbootclasspath`. const std::vector<std::string>& boot_class_path; // Required. See `-Xbootclasspath-locations`. const std::vector<std::string>& boot_class_path_locations; // Optional. See `-Xbootclasspathfds`.
std::optional<ArrayRef<File>> boot_class_path_files = {}; // Optional. See `-Xdeny-art-apex-data-files`. constbool deny_art_apex_data_files = false; // Optional. Determined from the context's `ro.build.version.sdk` sysprop. const uint32_t sdk_version = static_cast<uint32_t>(SdkVersion::kUnset);
};
// Information about a boot image. struct BootImageInfo { // Number of BCP jars covered by the boot image.
size_t component_count; // Checksum of the boot image. The format is "i;<component_count>/<checksum_in_8_digit_hex>"
std::string checksum;
};
// Constructs OatFileAssistantContext from runtime options. Does not fetch information on // construction. Information will be fetched from disk when needed.
EXPORT explicit OatFileAssistantContext(std::unique_ptr<RuntimeOptions> runtime_options); // Constructs OatFileAssistantContext from a runtime instance. Fetches as much information as // possible from the runtime. The rest information will be fetched from disk when needed. explicit OatFileAssistantContext(Runtime* runtime); // Returns runtime options. const RuntimeOptions& GetRuntimeOptions() const; // Fetches all information that hasn't been fetched from disk and caches it. All operations will // be read-only after a successful call to this function.
EXPORT bool FetchAll(std::string* error_msg); // Returns information about the boot image of the given instruction set.
EXPORT const std::vector<BootImageInfo>& GetBootImageInfoList(InstructionSet isa); // Returns the checksums of the dex files in the BCP jar at the given index, or nullptr on error. // The format of each checksum is "/<checksum_in_8_digit_hex>". const std::vector<std::string>* GetBcpChecksums(size_t bcp_index, std::string* error_msg); // Returns a string that represents the apex versions of boot classpath jars. See // `Runtime::apex_versions_` for the encoding format.
EXPORT const std::string& GetApexVersions();
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.