1*4d7e907cSAndroid Build Coastguard Worker/* 2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2019 The Android Open Source Project 3*4d7e907cSAndroid Build Coastguard Worker * 4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*4d7e907cSAndroid Build Coastguard Worker * 8*4d7e907cSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*4d7e907cSAndroid Build Coastguard Worker * 10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License. 15*4d7e907cSAndroid Build Coastguard Worker */ 16*4d7e907cSAndroid Build Coastguard Worker 17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected]; 18*4d7e907cSAndroid Build Coastguard Worker 19*4d7e907cSAndroid Build Coastguard Workerimport @2.0::IHealth; 20*4d7e907cSAndroid Build Coastguard Workerimport @2.0::Result; 21*4d7e907cSAndroid Build Coastguard Workerimport HealthConfig; 22*4d7e907cSAndroid Build Coastguard Workerimport HealthInfo; 23*4d7e907cSAndroid Build Coastguard Workerimport IHealthInfoCallback; 24*4d7e907cSAndroid Build Coastguard Worker 25*4d7e907cSAndroid Build Coastguard Worker/** 26*4d7e907cSAndroid Build Coastguard Worker * IHealth manages health info and posts events on registered callbacks. 27*4d7e907cSAndroid Build Coastguard Worker * 28*4d7e907cSAndroid Build Coastguard Worker * An implementation of @2.1::IHealth must be able to handle both 29*4d7e907cSAndroid Build Coastguard Worker * @2.0::IHealthInfoCallback and @2.1::IHealthInfoCallback. 30*4d7e907cSAndroid Build Coastguard Worker * - When registerCallback() is called, an implementation must cast the callback 31*4d7e907cSAndroid Build Coastguard Worker * to @2.1::IHealthInfoCallback. 32*4d7e907cSAndroid Build Coastguard Worker * - If the cast is successful, when a health info broadcast is sent, the 33*4d7e907cSAndroid Build Coastguard Worker * implementation must call 34*4d7e907cSAndroid Build Coastguard Worker * @2.1::IHealthInfoCallback.healthInfoChanged_2_1(). All fields introduced 35*4d7e907cSAndroid Build Coastguard Worker * in 2.1 must be set appropriately. The implementation must not call 36*4d7e907cSAndroid Build Coastguard Worker * @2.0::IHealthInfoCallback.healthInfoChanged(). 37*4d7e907cSAndroid Build Coastguard Worker * - If the cast is unsuccessful, the implementation must call 38*4d7e907cSAndroid Build Coastguard Worker * @2.0::IHealthInfoCallback.healthInfoChanged(). 39*4d7e907cSAndroid Build Coastguard Worker * - When unregisterCallback() is called, from then on, updates must not be sent 40*4d7e907cSAndroid Build Coastguard Worker * through either healthInfoChanged_2_1() or healthInfoChanged(). 41*4d7e907cSAndroid Build Coastguard Worker * 42*4d7e907cSAndroid Build Coastguard Worker * Passthrough implementations are not required to send health info to all 43*4d7e907cSAndroid Build Coastguard Worker * callbacks periodically, but they must do so when update() is called. 44*4d7e907cSAndroid Build Coastguard Worker * Binderized implementations must send health info to all callbacks 45*4d7e907cSAndroid Build Coastguard Worker * periodically. The intervals between two notifications must be retrieved from 46*4d7e907cSAndroid Build Coastguard Worker * the passthrough implementation through the getHealthConfig() function. 47*4d7e907cSAndroid Build Coastguard Worker */ 48*4d7e907cSAndroid Build Coastguard Workerinterface IHealth extends @2.0::IHealth { 49*4d7e907cSAndroid Build Coastguard Worker /** 50*4d7e907cSAndroid Build Coastguard Worker * Get configuration of this HAL. 51*4d7e907cSAndroid Build Coastguard Worker * 52*4d7e907cSAndroid Build Coastguard Worker * @return result SUCCESS if successful, 53*4d7e907cSAndroid Build Coastguard Worker * NOT_SUPPORTED if this API is not supported, 54*4d7e907cSAndroid Build Coastguard Worker * UNKNOWN for other errors. 55*4d7e907cSAndroid Build Coastguard Worker * @return config HAL configuration, to be ignored if result is not 56*4d7e907cSAndroid Build Coastguard Worker * SUCCESS. 57*4d7e907cSAndroid Build Coastguard Worker */ 58*4d7e907cSAndroid Build Coastguard Worker getHealthConfig() generates (Result result, HealthConfig config); 59*4d7e907cSAndroid Build Coastguard Worker 60*4d7e907cSAndroid Build Coastguard Worker /** 61*4d7e907cSAndroid Build Coastguard Worker * Get Health Information. 62*4d7e907cSAndroid Build Coastguard Worker * 63*4d7e907cSAndroid Build Coastguard Worker * @return result SUCCESS if successful, 64*4d7e907cSAndroid Build Coastguard Worker * NOT_SUPPORTED if this API is not supported, 65*4d7e907cSAndroid Build Coastguard Worker * UNKNOWN for other errors. 66*4d7e907cSAndroid Build Coastguard Worker * @return value Health information, to be ignored if result is not 67*4d7e907cSAndroid Build Coastguard Worker * SUCCESS. 68*4d7e907cSAndroid Build Coastguard Worker */ 69*4d7e907cSAndroid Build Coastguard Worker getHealthInfo_2_1() generates (Result result, @2.1::HealthInfo value); 70*4d7e907cSAndroid Build Coastguard Worker 71*4d7e907cSAndroid Build Coastguard Worker /** 72*4d7e907cSAndroid Build Coastguard Worker * Return whether the screen should be kept on in charger mode. 73*4d7e907cSAndroid Build Coastguard Worker * 74*4d7e907cSAndroid Build Coastguard Worker * @return result SUCCESS if successful, 75*4d7e907cSAndroid Build Coastguard Worker * NOT_SUPPORTED if this API is not supported, 76*4d7e907cSAndroid Build Coastguard Worker * UNKNOWN for other errors. 77*4d7e907cSAndroid Build Coastguard Worker * @return value whether screen should be kept on. 78*4d7e907cSAndroid Build Coastguard Worker */ 79*4d7e907cSAndroid Build Coastguard Worker shouldKeepScreenOn() generates (Result result, bool value); 80*4d7e907cSAndroid Build Coastguard Worker}; 81