blob: 8a5152a6ff88d7eab0085a7a2a2ec958706d9d34 [file] [log] [blame]
Yifan Honged0fead2019-10-02 18:22:12 -07001/*
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
17package android.hardware.health@2.1;
18
19import @2.0::IHealth;
20import @2.0::Result;
21import HealthConfig;
22import HealthInfo;
23import IHealthInfoCallback;
24
25/**
26 * IHealth manages health info and posts events on registered callbacks.
27 *
28 * An implementation of @2.1::IHealth must be able to handle both
29 * @2.0::IHealthInfoCallback and @2.1::IHealthInfoCallback.
30 * - When registerCallback() is called, an implementation must cast the callback
31 * to @2.1::IHealthInfoCallback.
32 * - If the cast is successful, when a health info broadcast is sent, the
33 * implementation must call
34 * @2.1::IHealthInfoCallback.healthInfoChanged_2_1(). All fields introduced
35 * in 2.1 must be set appropriately. The implementation must not call
36 * @2.0::IHealthInfoCallback.healthInfoChanged().
37 * - If the cast is unsuccessful, the implementation must call
38 * @2.0::IHealthInfoCallback.healthInfoChanged().
39 * - When unregisterCallback() is called, from then on, updates must not be sent
40 * through either healthInfoChanged_2_1() or healthInfoChanged().
41 *
42 * Passthrough implementations are not required to send health info to all
43 * callbacks periodically, but they must do so when update() is called.
44 * Binderized implementations must send health info to all callbacks
45 * periodically. The intervals between two notifications must be retrieved from
46 * the passthrough implementation through the getHealthConfig() function.
47 */
48interface IHealth extends @2.0::IHealth {
49 /**
50 * Get configuration of this HAL.
51 *
52 * @return result SUCCESS if successful,
53 * NOT_SUPPORTED if this API is not supported,
54 * UNKNOWN for other errors.
55 * @return config HAL configuration, to be ignored if result is not
56 * SUCCESS.
57 */
58 getHealthConfig() generates (Result result, HealthConfig config);
59
60 /**
61 * Get Health Information.
62 *
63 * @return result SUCCESS if successful,
64 * NOT_SUPPORTED if this API is not supported,
65 * UNKNOWN for other errors.
66 * @return value Health information, to be ignored if result is not
67 * SUCCESS.
68 */
69 getHealthInfo_2_1() generates (Result result, @2.1::HealthInfo value);
70
71 /**
72 * Return whether the screen should be kept on in charger mode.
73 *
74 * @return result SUCCESS if successful,
75 * NOT_SUPPORTED if this API is not supported,
76 * UNKNOWN for other errors.
77 * @return value whether screen should be kept on.
78 */
79 shouldKeepScreenOn() generates (Result result, bool value);
80};