diff options
author | Tao Bao <tbao@google.com> | 2019-04-30 23:49:03 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-04-30 23:49:03 +0200 |
commit | b5fe2dd00c2f04e02d3598e7956eb1374430088f (patch) | |
tree | 13932498e10ef237aee01eeaed417d377f1a9816 /install/include | |
parent | Merge "tests: Merge recovery_component_test into recovery_unit_test." (diff) | |
parent | install: Install functions return InstallResult. (diff) | |
download | android_bootable_recovery-b5fe2dd00c2f04e02d3598e7956eb1374430088f.tar android_bootable_recovery-b5fe2dd00c2f04e02d3598e7956eb1374430088f.tar.gz android_bootable_recovery-b5fe2dd00c2f04e02d3598e7956eb1374430088f.tar.bz2 android_bootable_recovery-b5fe2dd00c2f04e02d3598e7956eb1374430088f.tar.lz android_bootable_recovery-b5fe2dd00c2f04e02d3598e7956eb1374430088f.tar.xz android_bootable_recovery-b5fe2dd00c2f04e02d3598e7956eb1374430088f.tar.zst android_bootable_recovery-b5fe2dd00c2f04e02d3598e7956eb1374430088f.zip |
Diffstat (limited to 'install/include')
-rw-r--r-- | install/include/install/adb_install.h | 11 | ||||
-rw-r--r-- | install/include/install/fuse_sdcard_install.h | 3 | ||||
-rw-r--r-- | install/include/install/install.h | 12 | ||||
-rw-r--r-- | install/include/private/setup_commands.h | 8 |
4 files changed, 18 insertions, 16 deletions
diff --git a/install/include/install/adb_install.h b/install/include/install/adb_install.h index 3a0a81747..880022361 100644 --- a/install/include/install/adb_install.h +++ b/install/include/install/adb_install.h @@ -16,9 +16,10 @@ #pragma once -#include <recovery_ui/device.h> +#include "install/install.h" +#include "recovery_ui/device.h" -// Applies a package via `adb sideload` or `adb rescue`. Returns the install result (in `enum -// InstallResult`). When a reboot has been requested, INSTALL_REBOOT will be the return value, with -// the reboot target set in reboot_action. -int ApplyFromAdb(Device* device, bool rescue_mode, Device::BuiltinAction* reboot_action); +// Applies a package via `adb sideload` or `adb rescue`. Returns the install result. When a reboot +// has been requested, INSTALL_REBOOT will be the return value, with the reboot target set in +// reboot_action. +InstallResult ApplyFromAdb(Device* device, bool rescue_mode, Device::BuiltinAction* reboot_action); diff --git a/install/include/install/fuse_sdcard_install.h b/install/include/install/fuse_sdcard_install.h index d9214ca3b..e5bb01f09 100644 --- a/install/include/install/fuse_sdcard_install.h +++ b/install/include/install/fuse_sdcard_install.h @@ -16,7 +16,8 @@ #pragma once +#include "install/install.h" #include "recovery_ui/device.h" #include "recovery_ui/ui.h" -int ApplyFromSdcard(Device* device, RecoveryUI* ui); +InstallResult ApplyFromSdcard(Device* device, RecoveryUI* ui); diff --git a/install/include/install/install.h b/install/include/install/install.h index d90c20f3a..44a5cde91 100644 --- a/install/include/install/install.h +++ b/install/include/install/install.h @@ -47,8 +47,8 @@ enum class OtaType { // Installs the given update package. This function should also wipe the cache partition after a // successful installation if |should_wipe_cache| is true or an updater command asks to wipe the // cache. -int install_package(const std::string& package, bool should_wipe_cache, bool needs_mount, - int retry_count, RecoveryUI* ui); +InstallResult InstallPackage(const std::string& package, bool should_wipe_cache, bool needs_mount, + int retry_count, RecoveryUI* ui); // Verifies the package by ota keys. Returns true if the package is verified successfully, // otherwise returns false. @@ -62,7 +62,7 @@ bool ReadMetadataFromPackage(ZipArchiveHandle zip, std::map<std::string, std::st // entry doesn't exist. bool verify_package_compatibility(ZipArchiveHandle package_zip); -// Checks if the the metadata in the OTA package has expected values. Returns 0 on success. -// Mandatory checks: ota-type, pre-device and serial number(if presents) -// AB OTA specific checks: pre-build version, fingerprint, timestamp. -int CheckPackageMetadata(const std::map<std::string, std::string>& metadata, OtaType ota_type); +// Checks if the metadata in the OTA package has expected values. Mandatory checks: ota-type, +// pre-device and serial number (if presents). A/B OTA specific checks: pre-build version, +// fingerprint, timestamp. +bool CheckPackageMetadata(const std::map<std::string, std::string>& metadata, OtaType ota_type); diff --git a/install/include/private/setup_commands.h b/install/include/private/setup_commands.h index 7fdc741d6..dcff76112 100644 --- a/install/include/private/setup_commands.h +++ b/install/include/private/setup_commands.h @@ -27,13 +27,13 @@ // |zip| located at |package|. Stores the command line that should be called into |cmd|. The // |status_fd| is the file descriptor the child process should use to report back the progress of // the update. -int SetUpNonAbUpdateCommands(const std::string& package, ZipArchiveHandle zip, int retry_count, - int status_fd, std::vector<std::string>* cmd); +bool SetUpNonAbUpdateCommands(const std::string& package, ZipArchiveHandle zip, int retry_count, + int status_fd, std::vector<std::string>* cmd); // Sets up the commands for an A/B update. Extracts the needed entries from the open zip archive // |zip| located at |package|. Stores the command line that should be called into |cmd|. The // |status_fd| is the file descriptor the child process should use to report back the progress of // the update. Note that since this applies to the sideloading flow only, it takes one less // parameter |retry_count| than the non-A/B version. -int SetUpAbUpdateCommands(const std::string& package, ZipArchiveHandle zip, int status_fd, - std::vector<std::string>* cmd); +bool SetUpAbUpdateCommands(const std::string& package, ZipArchiveHandle zip, int status_fd, + std::vector<std::string>* cmd); |