1 /* 2 * Copyright (C) 2019 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 #define LOG_TAG "bootcontrolhal" 18 19 #include <android-base/file.h> 20 #include <android-base/logging.h> 21 #include <android-base/unique_fd.h> 22 #include <bootloader_message/bootloader_message.h> 23 #include <libboot_control/libboot_control.h> 24 25 #include "BootControlShared.h" 26 27 namespace android { 28 namespace hardware { 29 namespace boot { 30 namespace V1_2 { 31 namespace implementation { 32 33 using android::bootable::GetMiscVirtualAbMergeStatus; 34 using android::bootable::InitMiscVirtualAbMessageIfNeeded; 35 using android::bootable::SetMiscVirtualAbMergeStatus; 36 using android::hardware::boot::V1_1::MergeStatus; 37 BootControlShared()38BootControlShared::BootControlShared() {} 39 Init()40bool BootControlShared::Init() { 41 return InitMiscVirtualAbMessageIfNeeded(); 42 } 43 setSnapshotMergeStatus(MergeStatus status)44Return<bool> BootControlShared::setSnapshotMergeStatus(MergeStatus status) { 45 return SetMiscVirtualAbMergeStatus(getCurrentSlot(), status); 46 } 47 getSnapshotMergeStatus()48Return<MergeStatus> BootControlShared::getSnapshotMergeStatus() { 49 MergeStatus status; 50 if (!GetMiscVirtualAbMergeStatus(getCurrentSlot(), &status)) { 51 return MergeStatus::UNKNOWN; 52 } 53 return status; 54 } 55 56 } // namespace implementation 57 } // namespace V1_2 58 } // namespace boot 59 } // namespace hardware 60 } // namespace android 61