summaryrefslogtreecommitdiff
path: root/health/2.1/types.hal
blob: 6d7b6613df7a349911b8513a230063c8a629cf99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.health@2.1;

import @1.0::HealthConfig;
import @2.0::HealthInfo;

enum Constants : int64_t {
    BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = -1,
};

/**
 * Battery capacity level. This enum provides additional information along side
 * with the battery capacity.
 * Clients of this HAL must use this value before inferring it from the
 * battery capacity.
 */
enum BatteryCapacityLevel : int32_t {
    /**
     * Battery capacity level is unsupported.
     * Battery capacity level must be set to this value if and only if the
     * implementation is unsupported.
     */
    UNSUPPORTED = -1,
    /**
     * Battery capacity level is unknown.
     * Battery capacity level must be set to this value if and only if battery
     * is not present or the battery capacity level is unknown/uninitialized.
     */
    UNKNOWN,
    /**
     * Battery is at critical level. The Android framework must schedule a
     * shutdown when it sees this value from the HAL.
     */
    CRITICAL,
    /**
     * Battery is low. The Android framework may limit the performance of
     * the device when it sees this value from the HAL.
     */
    LOW,
    /**
     * Battery level is normal.
     */
    NORMAL,
    /**
     * Battery level is high.
     */
    HIGH,
    /**
     * Battery is full. It must be set to FULL if and only if battery level is
     * 100.
     */
    FULL,
};

/**
 * Combined Health Information.
 */
struct HealthInfo {
    /**
     * V2.0 HealthInfo.
     * If a member is unsupported, it is filled with:
     * - 0 (for integers);
     * - false (for booleans);
     * - empty string (for strings);
     * - UNKNOWN (for BatteryStatus and BatteryHealth).
     */
    @2.0::HealthInfo legacy;

    /**
     * Battery capacity level. See BatteryCapacityLevel for more details.
     */
    BatteryCapacityLevel batteryCapacityLevel;

    /**
     * Estimated time to fully charge the device (in seconds).
     * Value must be BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED if and
     * only if the implementation is unsupported.
     * Value must be 0 if and only if batteryCapacityLevel is FULL or UNKNOWN.
     * Otherwise, value must be positive.
     */
    int64_t batteryChargeTimeToFullNowSeconds;

    /**
     * Estimated battery full charge design capacity (in microamp hours, uAh).
     * Value must be 0 if unknown.
     * Value must be greater than 100 000 uAh if known.
     * Value must be less than 100 000 000 uAh if known.
     */
    int32_t batteryFullChargeDesignCapacityUah;
};

/**
 * Combined configuration of a health HAL implementation.
 */
struct HealthConfig {
    /**
     * 1.0 version of health config.
     */
    @1.0::HealthConfig battery;

    /**
     * Minimum battery level for charger to reboot into Android (in percent).
     * Value should be in range [0, 100].
     */
    int32_t bootMinCap;
};