diff options
author | Tianjie <xunchang@google.com> | 2020-11-30 14:38:35 -0800 |
---|---|---|
committer | Tianjie <xunchang@google.com> | 2020-12-03 23:00:08 -0800 |
commit | 253b46db055de909aae18cbfc1dcf943b26c607e (patch) | |
tree | 4dd9feadfba8cce51e1da84a08ebb62aa167cef1 | |
parent | af4135035abb5b2f1d16639bfb718dd75b1ca048 (diff) |
Update to bootcontrol 1.2 for Pixel
bootcontrol 1.2 adds a new function to get the active boot slot
on the next boot. This is useful for resume on reboot to verify
the device state to boot into; and set the corresponding vbmeta
digest accordingly.
Bug: 173808057
Test: Vts tests for bootcontrol
Change-Id: Ie2c933e4a80b9722b4c4865f33d3996c1601cdf6
-rw-r--r-- | bootctrl/Android.bp | 5 | ||||
-rw-r--r-- | bootctrl/BootControlShared.cpp | 4 | ||||
-rw-r--r-- | bootctrl/BootControlShared.h | 7 | ||||
-rw-r--r-- | bootctrl/LegacyBootControl.cpp | 15 | ||||
-rw-r--r-- | bootctrl/LegacyBootControl.h | 7 |
5 files changed, 27 insertions, 11 deletions
diff --git a/bootctrl/Android.bp b/bootctrl/Android.bp index 852800e..9aa1f26 100644 --- a/bootctrl/Android.bp +++ b/bootctrl/Android.bp @@ -1,6 +1,6 @@ cc_library { - name: "android.hardware.boot@1.1-impl-pixel-legacy", - stem: "android.hardware.boot@1.0-impl-1.1-pixel-legacy", + name: "android.hardware.boot@1.2-impl-pixel-legacy", + stem: "android.hardware.boot@1.0-impl-1.2-pixel-legacy", vendor: true, recovery_available: true, srcs: [ @@ -20,6 +20,7 @@ cc_library { "libutils", "android.hardware.boot@1.0", "android.hardware.boot@1.1", + "android.hardware.boot@1.2", ], static_libs: [ "libboot_control", diff --git a/bootctrl/BootControlShared.cpp b/bootctrl/BootControlShared.cpp index 125bec4..e5b9797 100644 --- a/bootctrl/BootControlShared.cpp +++ b/bootctrl/BootControlShared.cpp @@ -27,7 +27,7 @@ namespace android { namespace hardware { namespace boot { -namespace V1_1 { +namespace V1_2 { namespace implementation { using android::bootable::GetMiscVirtualAbMergeStatus; @@ -54,7 +54,7 @@ Return<MergeStatus> BootControlShared::getSnapshotMergeStatus() { } } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace boot } // namespace hardware } // namespace android diff --git a/bootctrl/BootControlShared.h b/bootctrl/BootControlShared.h index ff49e3e..43aedba 100644 --- a/bootctrl/BootControlShared.h +++ b/bootctrl/BootControlShared.h @@ -16,17 +16,18 @@ #pragma once -#include <android/hardware/boot/1.1/IBootControl.h> +#include <android/hardware/boot/1.2/IBootControl.h> #include <hidl/MQDescriptor.h> #include <hidl/Status.h> namespace android { namespace hardware { namespace boot { -namespace V1_1 { +namespace V1_2 { namespace implementation { using ::android::hardware::Return; +using ::android::hardware::boot::V1_1::MergeStatus; struct BootControlShared : public IBootControl { BootControlShared(); @@ -40,7 +41,7 @@ struct BootControlShared : public IBootControl { extern "C" IBootControl *HIDL_FETCH_IBootControl(const char *name); } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace boot } // namespace hardware } // namespace android diff --git a/bootctrl/LegacyBootControl.cpp b/bootctrl/LegacyBootControl.cpp index 83254e9..1287c8e 100644 --- a/bootctrl/LegacyBootControl.cpp +++ b/bootctrl/LegacyBootControl.cpp @@ -28,7 +28,7 @@ extern const hw_module_t HAL_MODULE_INFO_SYM; namespace android { namespace hardware { namespace boot { -namespace V1_1 { +namespace V1_2 { namespace implementation { using ::android::hardware::boot::V1_0::CommandResult; @@ -97,6 +97,17 @@ Return<void> BootControl::getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) { return Void(); } +// Methods from ::android::hardware::boot::V1_2::IBootControl follow. +Return<uint32_t> BootControl::getActiveBootSlot() { + auto get_active_slot = mModule->getActiveBootSlot; + if (!get_active_slot) { + ALOGE("Failed to find the implementation of getActiveBootSlot in boot" + " control HAL."); + return 0; + } + return get_active_slot(mModule); +} + IBootControl *HIDL_FETCH_IBootControl(const char * /* hal */) { int ret = 0; boot_control_module_t *module = NULL; @@ -116,7 +127,7 @@ IBootControl *HIDL_FETCH_IBootControl(const char * /* hal */) { } } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace boot } // namespace hardware } // namespace android diff --git a/bootctrl/LegacyBootControl.h b/bootctrl/LegacyBootControl.h index 0653cbd..75548b0 100644 --- a/bootctrl/LegacyBootControl.h +++ b/bootctrl/LegacyBootControl.h @@ -24,7 +24,7 @@ namespace android { namespace hardware { namespace boot { -namespace V1_1 { +namespace V1_2 { namespace implementation { using ::android::hardware::Return; @@ -43,6 +43,9 @@ struct BootControl : public BootControlShared { Return<BoolResult> isSlotMarkedSuccessful(uint32_t slot) override; Return<void> getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) override; + // Methods from ::android::hardware::boot::V1_2::IBootControl follow. + Return<uint32_t> getActiveBootSlot() override; + private: boot_control_module_t *mModule; }; @@ -50,7 +53,7 @@ struct BootControl : public BootControlShared { extern "C" IBootControl *HIDL_FETCH_IBootControl(const char *name); } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace boot } // namespace hardware } // namespace android |