summaryrefslogtreecommitdiff
path: root/fastboot/device/variables.cpp
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2019-10-31 18:02:41 -0700
committerDavid Anderson <dvander@google.com>2019-11-10 23:07:13 -0800
commit220ddb1f0fb9d0e47f7c812c93da174ea3a8c037 (patch)
tree9c863903a93eac39f0d1f800e9f5a86cd16e9d0d /fastboot/device/variables.cpp
parentb58df7dac3b7d2f9aef8e2f3798ab2bd3b9969ed (diff)
fastbootd: Disallow certain operations during snapshot updates.
When a snapshot is applied or is merging, requests to erase or flash userdata, metadata, or misc must be protected. In addition, the set_active command must be restricted when a merge is in progress. In addition, introduce a "snapshot-update merge" command for assisting with erase requests when a merge is in progress. As in recovery, this will force a merge to complete. Bug: 139154945 Test: apply update fastboot erase userdata fastboot erase metadata fastboot erase misc fastboot set_active Change-Id: I152446464335c62c39ffb4cc6366be9de19eac30
Diffstat (limited to 'fastboot/device/variables.cpp')
-rw-r--r--fastboot/device/variables.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/fastboot/device/variables.cpp b/fastboot/device/variables.cpp
index 6e613d647..91fc84c47 100644
--- a/fastboot/device/variables.cpp
+++ b/fastboot/device/variables.cpp
@@ -432,19 +432,13 @@ bool GetSnapshotUpdateStatus(FastbootDevice* device, const std::vector<std::stri
std::string* message) {
// Note that we use the HAL rather than mounting /metadata, since we want
// our results to match the bootloader.
- auto hal = device->boot_control_hal();
+ auto hal = device->boot1_1();
if (!hal) {
*message = "not supported";
return false;
}
- android::sp<IBootControl1_1> hal11 = IBootControl1_1::castFrom(hal);
- if (!hal11) {
- *message = "not supported";
- return false;
- }
-
- MergeStatus status = hal11->getSnapshotMergeStatus();
+ MergeStatus status = hal->getSnapshotMergeStatus();
switch (status) {
case MergeStatus::SNAPSHOTTED:
*message = "snapshotted";