Loading .clang-format +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ AllowShortIfStatementsOnASingleLine: true ColumnLimit: 100 CommentPragmas: NOLINT:.* DerivePointerAlignment: false IncludeBlocks: Preserve IndentWidth: 2 PointerAlignment: Left TabWidth: 2 Loading edify/include/edify/updater_runtime_interface.h +3 −0 Original line number Diff line number Diff line Loading @@ -71,4 +71,7 @@ class UpdaterRuntimeInterface { virtual bool MapPartitionOnDeviceMapper(const std::string& partition_name, std::string* path) = 0; virtual bool UnmapPartitionOnDeviceMapper(const std::string& partition_name) = 0; virtual bool UpdateDynamicPartitions(const std::string_view op_list_value) = 0; // On devices supports A/B, add current slot suffix to arg. Otherwise, return |arg| as is. virtual std::string AddSlotSuffix(const std::string_view arg) const = 0; }; install/install.cpp +19 −8 Original line number Diff line number Diff line Loading @@ -331,16 +331,26 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache, return INSTALL_CORRUPT; } bool is_ab = android::base::GetBoolProperty("ro.build.ab_update", false); if (is_ab) { bool package_is_ab = get_value(metadata, "ota-type") == OtaTypeToString(OtaType::AB); bool device_supports_ab = android::base::GetBoolProperty("ro.build.ab_update", false); bool ab_device_supports_nonab = android::base::GetBoolProperty("ro.virtual_ab.allow_non_ab", false); bool device_only_supports_ab = device_supports_ab && !ab_device_supports_nonab; if (package_is_ab) { CHECK(package->GetType() == PackageType::kFile); } // Verify against the metadata in the package first. if (is_ab && !CheckPackageMetadata(metadata, OtaType::AB)) { // Verify against the metadata in the package first. Expects A/B metadata if: // Package declares itself as an A/B package // Package does not declare itself as an A/B package, but device only supports A/B; // still calls CheckPackageMetadata to get a meaningful error message. if (package_is_ab || device_only_supports_ab) { if (!CheckPackageMetadata(metadata, OtaType::AB)) { log_buffer->push_back(android::base::StringPrintf("error: %d", kUpdateBinaryCommandFailure)); return INSTALL_ERROR; } } ReadSourceTargetBuild(metadata, log_buffer); Loading Loading @@ -389,7 +399,8 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache, std::vector<std::string> args; if (auto setup_result = is_ab ? SetUpAbUpdateCommands(package_path, zip, pipe_write.get(), &args) package_is_ab ? SetUpAbUpdateCommands(package_path, zip, pipe_write.get(), &args) : SetUpNonAbUpdateCommands(package_path, zip, retry_count, pipe_write.get(), &args); !setup_result) { log_buffer->push_back(android::base::StringPrintf("error: %d", kUpdateBinaryCommandFailure)); Loading updater/include/updater/simulator_runtime.h +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ class SimulatorRuntime : public UpdaterRuntimeInterface { bool MapPartitionOnDeviceMapper(const std::string& partition_name, std::string* path) override; bool UnmapPartitionOnDeviceMapper(const std::string& partition_name) override; bool UpdateDynamicPartitions(const std::string_view op_list_value) override; std::string AddSlotSuffix(const std::string_view arg) const override; private: std::string FindBlockDeviceName(const std::string_view name) const override; Loading updater/include/updater/updater_runtime.h +1 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ class UpdaterRuntime : public UpdaterRuntimeInterface { bool MapPartitionOnDeviceMapper(const std::string& partition_name, std::string* path) override; bool UnmapPartitionOnDeviceMapper(const std::string& partition_name) override; bool UpdateDynamicPartitions(const std::string_view op_list_value) override; std::string AddSlotSuffix(const std::string_view arg) const override; private: struct selabel_handle* sehandle_{ nullptr }; Loading Loading
.clang-format +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ AllowShortIfStatementsOnASingleLine: true ColumnLimit: 100 CommentPragmas: NOLINT:.* DerivePointerAlignment: false IncludeBlocks: Preserve IndentWidth: 2 PointerAlignment: Left TabWidth: 2 Loading
edify/include/edify/updater_runtime_interface.h +3 −0 Original line number Diff line number Diff line Loading @@ -71,4 +71,7 @@ class UpdaterRuntimeInterface { virtual bool MapPartitionOnDeviceMapper(const std::string& partition_name, std::string* path) = 0; virtual bool UnmapPartitionOnDeviceMapper(const std::string& partition_name) = 0; virtual bool UpdateDynamicPartitions(const std::string_view op_list_value) = 0; // On devices supports A/B, add current slot suffix to arg. Otherwise, return |arg| as is. virtual std::string AddSlotSuffix(const std::string_view arg) const = 0; };
install/install.cpp +19 −8 Original line number Diff line number Diff line Loading @@ -331,16 +331,26 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache, return INSTALL_CORRUPT; } bool is_ab = android::base::GetBoolProperty("ro.build.ab_update", false); if (is_ab) { bool package_is_ab = get_value(metadata, "ota-type") == OtaTypeToString(OtaType::AB); bool device_supports_ab = android::base::GetBoolProperty("ro.build.ab_update", false); bool ab_device_supports_nonab = android::base::GetBoolProperty("ro.virtual_ab.allow_non_ab", false); bool device_only_supports_ab = device_supports_ab && !ab_device_supports_nonab; if (package_is_ab) { CHECK(package->GetType() == PackageType::kFile); } // Verify against the metadata in the package first. if (is_ab && !CheckPackageMetadata(metadata, OtaType::AB)) { // Verify against the metadata in the package first. Expects A/B metadata if: // Package declares itself as an A/B package // Package does not declare itself as an A/B package, but device only supports A/B; // still calls CheckPackageMetadata to get a meaningful error message. if (package_is_ab || device_only_supports_ab) { if (!CheckPackageMetadata(metadata, OtaType::AB)) { log_buffer->push_back(android::base::StringPrintf("error: %d", kUpdateBinaryCommandFailure)); return INSTALL_ERROR; } } ReadSourceTargetBuild(metadata, log_buffer); Loading Loading @@ -389,7 +399,8 @@ static InstallResult TryUpdateBinary(Package* package, bool* wipe_cache, std::vector<std::string> args; if (auto setup_result = is_ab ? SetUpAbUpdateCommands(package_path, zip, pipe_write.get(), &args) package_is_ab ? SetUpAbUpdateCommands(package_path, zip, pipe_write.get(), &args) : SetUpNonAbUpdateCommands(package_path, zip, retry_count, pipe_write.get(), &args); !setup_result) { log_buffer->push_back(android::base::StringPrintf("error: %d", kUpdateBinaryCommandFailure)); Loading
updater/include/updater/simulator_runtime.h +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ class SimulatorRuntime : public UpdaterRuntimeInterface { bool MapPartitionOnDeviceMapper(const std::string& partition_name, std::string* path) override; bool UnmapPartitionOnDeviceMapper(const std::string& partition_name) override; bool UpdateDynamicPartitions(const std::string_view op_list_value) override; std::string AddSlotSuffix(const std::string_view arg) const override; private: std::string FindBlockDeviceName(const std::string_view name) const override; Loading
updater/include/updater/updater_runtime.h +1 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ class UpdaterRuntime : public UpdaterRuntimeInterface { bool MapPartitionOnDeviceMapper(const std::string& partition_name, std::string* path) override; bool UnmapPartitionOnDeviceMapper(const std::string& partition_name) override; bool UpdateDynamicPartitions(const std::string_view op_list_value) override; std::string AddSlotSuffix(const std::string_view arg) const override; private: struct selabel_handle* sehandle_{ nullptr }; Loading