1/*
2 * Copyright 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
17package android.hardware.boot@1.1;
18
19import @1.0::IBootControl;
20
21interface IBootControl extends @1.0::IBootControl {
22    /**
23     * Sets whether a snapshot-merge of any dynamic partition is in progress.
24     *
25     * After the merge status is set to a given value, subsequent calls to
26     * getSnapshotMergeStatus must return the set value.
27     *
28     * The merge status must be persistent across reboots. That is, getSnapshotMergeStatus
29     * must return the same value after a reboot if the merge status is not altered in any way
30     * (e.g. set by setSnapshotMergeStatus or set to CANCELLED by bootloader).
31     *
32     * Read/write access to the merge status must be atomic. When the HAL is processing a
33     * setSnapshotMergeStatus call, all subsequent calls to getSnapshotMergeStatus must block until
34     * setSnapshotMergeStatus has returned.
35     *
36     * A MERGING state indicates that dynamic partitions are partially comprised by blocks in the
37     * userdata partition.
38     *
39     * When the merge status is set to MERGING, the following operations must be prohibited from the
40     * bootloader:
41     *  - Flashing or erasing "userdata" or "metadata".
42     *
43     * The following operations may be prohibited when the status is set to MERGING. If not
44     * prohibited, it is recommended that the user receive a warning.
45     *  - Changing the active slot (e.g. via "fastboot set_active")
46     *
47     * @param status Merge status.
48     *
49     * @return success True on success, false otherwise.
50     */
51    setSnapshotMergeStatus(MergeStatus status) generates (bool success);
52
53    /**
54     * Returns whether a snapshot-merge of any dynamic partition is in progress.
55     *
56     * This function must return the merge status set by the last setSnapshotMergeStatus call and
57     * recorded by the bootloader with one exception. If the partitions are being flashed from the
58     * bootloader such that the pending merge must be canceled (for example, if the super partition
59     * is being flashed), this function must return CANCELLED.
60     *
61     * @return success True if the merge status is read successfully, false otherwise.
62     * @return status Merge status.
63     */
64    getSnapshotMergeStatus() generates (MergeStatus status);
65};
66
67