1 /* 2 * Copyright (C) 2020 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 17 package android.frameworks.automotive.powerpolicy.internal; 18 19 import android.frameworks.automotive.powerpolicy.internal.PolicyState; 20 21 /** 22 * ICarPowerPolicyServer is an interface implemented by the power policy daemon. 23 * VHAL changes the power policy and the power policy daemon notifies the change to registered 24 * subscribers. When subscribing to policy changes, a filter can be specified so that the registered 25 * callbacks can listen only to a specific power component's change. 26 */ 27 28 interface ICarPowerPolicySystemNotification { 29 /** 30 * CarService uses this method to tell that CarService is ready for taking over power policy 31 * management. 32 * Once this method is called, car power policy daemon stops serving for the requests from vehicle 33 * HAL. CarService starts serving power policy management based on the current power policy ID and 34 * power policy group ID returned from the call. 35 * 36 * System private API for CarService. 37 * 38 * @return The current power policy ID and power policy group ID. 39 * @throws SecurityException if the caller doesn't have sufficient permissions. 40 */ notifyCarServiceReady()41 PolicyState notifyCarServiceReady(); 42 43 /** 44 * CarService uses this method to tell that the current power policy is changed. 45 * Then, car power policy daemon propagates the change to registered callbacks. 46 * 47 * System private API for CarService. 48 * 49 * @param policyId The current policy ID. 50 * @throws IllegalStateException if it fails to notify power policy change. 51 * @throws SecurityException if the caller doesn't have sufficient permissions. 52 */ notifyPowerPolicyChange(in @tf8InCpp String policyId)53 void notifyPowerPolicyChange(in @utf8InCpp String policyId); 54 55 /** 56 * CarService uses this method to tell that there is a newly defined power policy. 57 * When a new power policy is defined on the fly through "define-power-policy" in 58 * {@code CarShellCommand}, CarService makes sure that car power policy daemon maintains the same 59 * power policies. 60 * 61 * System private API for CarService. 62 * 63 * @param policyId The new policy ID. 64 * @param enabledComponents List of components to be enabled. 65 * @param disabledComponents List of components to be disabled. 66 * @throws IllegalStateException if it fails to notify power policy definition. 67 * @throws SecurityException if the caller doesn't have sufficient permissions. 68 */ notifyPowerPolicyDefinition(in @tf8InCpp String policyId, in @utf8InCpp String[] enabledComponents, in @utf8InCpp String[] disabledComponents)69 void notifyPowerPolicyDefinition(in @utf8InCpp String policyId, 70 in @utf8InCpp String[] enabledComponents, in @utf8InCpp String[] disabledComponents); 71 } 72