• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2017 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.health@2.1;
18
19import @1.0::HealthConfig;
20import @2.0::HealthInfo;
21
22enum Constants : int64_t {
23    BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = -1,
24};
25
26/**
27 * Battery capacity level. This enum provides additional information along side
28 * with the battery capacity.
29 * Clients of this HAL must use this value before inferring it from the
30 * battery capacity.
31 */
32enum BatteryCapacityLevel : int32_t {
33    /**
34     * Battery capacity level is unsupported.
35     * Battery capacity level must be set to this value if and only if the
36     * implementation is unsupported.
37     */
38    UNSUPPORTED = -1,
39    /**
40     * Battery capacity level is unknown.
41     * Battery capacity level must be set to this value if and only if battery
42     * is not present or the battery capacity level is unknown/uninitialized.
43     */
44    UNKNOWN,
45    /**
46     * Battery is at critical level. The Android framework must schedule a
47     * shutdown when it sees this value from the HAL.
48     */
49    CRITICAL,
50    /**
51     * Battery is low. The Android framework may limit the performance of
52     * the device when it sees this value from the HAL.
53     */
54    LOW,
55    /**
56     * Battery level is normal.
57     */
58    NORMAL,
59    /**
60     * Battery level is high.
61     */
62    HIGH,
63    /**
64     * Battery is full. It must be set to FULL if and only if battery level is
65     * 100.
66     */
67    FULL,
68};
69
70/**
71 * Combined Health Information.
72 */
73struct HealthInfo {
74    /**
75     * V2.0 HealthInfo.
76     * If a member is unsupported, it is filled with:
77     * - 0 (for integers);
78     * - false (for booleans);
79     * - empty string (for strings);
80     * - UNKNOWN (for BatteryStatus and BatteryHealth).
81     */
82    @2.0::HealthInfo legacy;
83
84    /**
85     * Battery capacity level. See BatteryCapacityLevel for more details.
86     */
87    BatteryCapacityLevel batteryCapacityLevel;
88
89    /**
90     * Estimated time to fully charge the device (in seconds).
91     * Value must be BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED if and
92     * only if the implementation is unsupported.
93     * Value must be 0 if and only if batteryCapacityLevel is FULL or UNKNOWN.
94     * Otherwise, value must be positive.
95     */
96    int64_t batteryChargeTimeToFullNowSeconds;
97
98    /**
99     * Estimated battery full charge design capacity (in microamp hours, uAh).
100     * Value must be 0 if unknown.
101     * Value must be greater than 100 000 uAh if known.
102     * Value must be less than 100 000 000 uAh if known.
103     */
104    int32_t batteryFullChargeDesignCapacityUah;
105};
106
107/**
108 * Combined configuration of a health HAL implementation.
109 */
110struct HealthConfig {
111    /**
112     * 1.0 version of health config.
113     */
114    @1.0::HealthConfig battery;
115
116    /**
117     * Minimum battery level for charger to reboot into Android (in percent).
118     * Value should be in range [0, 100].
119     */
120    int32_t bootMinCap;
121};
122