Adding error for when overlayfs is enabled in OTA
when running adb remount, overlayfs is enabled on the device interfering
with OTA being able to run. Currently we don't have a good debug message
and users aren't able to realize why the OTA fails. Adding this log will
make it clear this behavior is intended, and we need verity-enabled for
OTA to work
Test: adb remount, update_device.py
Bug: 286889613
Change-Id: Ibcd27911afe6f02ddf0c38ad40904a7e17735b31
diff --git a/common/dynamic_partition_control_interface.h b/common/dynamic_partition_control_interface.h
index 490892e..5c0a03b 100644
--- a/common/dynamic_partition_control_interface.h
+++ b/common/dynamic_partition_control_interface.h
@@ -106,7 +106,8 @@
uint32_t target_slot,
const DeltaArchiveManifest& manifest,
bool update,
- uint64_t* required_size) = 0;
+ uint64_t* required_size,
+ ErrorCode* error = nullptr) = 0;
// After writing to new partitions, before rebooting into the new slot, call
// this function to indicate writes to new partitions are done.
diff --git a/common/dynamic_partition_control_stub.cc b/common/dynamic_partition_control_stub.cc
index fd9a3b4..7d681cf 100644
--- a/common/dynamic_partition_control_stub.cc
+++ b/common/dynamic_partition_control_stub.cc
@@ -62,7 +62,8 @@
uint32_t target_slot,
const DeltaArchiveManifest& manifest,
bool update,
- uint64_t* required_size) {
+ uint64_t* required_size,
+ ErrorCode* error) {
return true;
}
diff --git a/common/dynamic_partition_control_stub.h b/common/dynamic_partition_control_stub.h
index 1db6a78..610a82a 100644
--- a/common/dynamic_partition_control_stub.h
+++ b/common/dynamic_partition_control_stub.h
@@ -43,7 +43,8 @@
uint32_t target_slot,
const DeltaArchiveManifest& manifest,
bool update,
- uint64_t* required_size) override;
+ uint64_t* required_size,
+ ErrorCode* error = nullptr) override;
bool FinishUpdate(bool powerwash_required) override;
std::unique_ptr<AbstractAction> GetCleanupPreviousUpdateAction(
diff --git a/common/error_code.h b/common/error_code.h
index a889888..7924579 100644
--- a/common/error_code.h
+++ b/common/error_code.h
@@ -87,6 +87,7 @@
kDeviceCorrupted = 61,
kPackageExcludedFromUpdate = 62,
kPostInstallMountError = 63,
+ kOverlayfsenabledError = 64,
// VERY IMPORTANT! When adding new error codes:
//
diff --git a/common/error_code_utils.cc b/common/error_code_utils.cc
index 421544a..12a98bf 100644
--- a/common/error_code_utils.cc
+++ b/common/error_code_utils.cc
@@ -175,6 +175,8 @@
return "ErrorCode::kPackageExcludedFromUpdate";
case ErrorCode::kPostInstallMountError:
return "ErrorCode::kPostInstallMountError";
+ case ErrorCode::kOverlayfsenabledError:
+ return "ErrorCode::kOverlayfsenabledError";
// Don't add a default case to let the compiler warn about newly added
// error codes which should be added here.
}
diff --git a/common/mock_dynamic_partition_control.h b/common/mock_dynamic_partition_control.h
index 79909b4..968246a 100644
--- a/common/mock_dynamic_partition_control.h
+++ b/common/mock_dynamic_partition_control.h
@@ -66,11 +66,15 @@
std::optional<uint64_t> label),
(override));
- MOCK_METHOD(
- bool,
- PreparePartitionsForUpdate,
- (uint32_t, uint32_t, const DeltaArchiveManifest&, bool, uint64_t*),
- (override));
+ MOCK_METHOD(bool,
+ PreparePartitionsForUpdate,
+ (uint32_t,
+ uint32_t,
+ const DeltaArchiveManifest&,
+ bool,
+ uint64_t*,
+ ErrorCode*),
+ (override));
MOCK_METHOD(bool, ResetUpdate, (PrefsInterface*), (override));
MOCK_METHOD(std::unique_ptr<AbstractAction>,