blob: 5791699658755adf12fc922033e5498d6e2a06de [file] [log] [blame]
Tianjie01d460b2020-11-30 14:40:55 -08001/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <android/hardware/boot/1.2/IBootControl.h>
20#include <hidl/MQDescriptor.h>
21#include <hidl/Status.h>
22#include <libboot_control/libboot_control.h>
23
24namespace android {
25namespace hardware {
26namespace boot {
27namespace V1_2 {
28namespace implementation {
29using ::android::hardware::Return;
30using ::android::hardware::Void;
31using ::android::hardware::boot::V1_0::BoolResult;
32using ::android::hardware::boot::V1_1::MergeStatus;
33using ::android::hardware::boot::V1_2::IBootControl;
34
35class BootControl : public IBootControl {
36 public:
37 bool Init();
38
39 // Methods from ::android::hardware::boot::V1_0::IBootControl.
40 Return<uint32_t> getNumberSlots() override;
41 Return<uint32_t> getCurrentSlot() override;
42 Return<void> markBootSuccessful(markBootSuccessful_cb _hidl_cb) override;
43 Return<void> setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) override;
44 Return<void> setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) override;
45 Return<BoolResult> isSlotBootable(uint32_t slot) override;
46 Return<BoolResult> isSlotMarkedSuccessful(uint32_t slot) override;
47 Return<void> getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) override;
48
49 // Methods from ::android::hardware::boot::V1_1::IBootControl.
50 Return<bool> setSnapshotMergeStatus(MergeStatus status) override;
51 Return<MergeStatus> getSnapshotMergeStatus() override;
52
53 // Methods from ::android::hardware::boot::V1_2::IBootControl.
54 Return<uint32_t> getActiveBootSlot() override;
55
56 private:
57 android::bootable::BootControl impl_;
58};
59
60extern "C" IBootControl* HIDL_FETCH_IBootControl(const char* name);
61
62} // namespace implementation
63} // namespace V1_2
64} // namespace boot
65} // namespace hardware
66} // namespace android