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.hardware.devicestate;
18 
19 import android.hardware.devicestate.DeviceStateInfo;
20 
21 /** @hide */
22 interface IDeviceStateManagerCallback {
23     /**
24      * Called in response to a change in {@link DeviceStateInfo}. Guaranteed to be called once
25      * after successful registration of the callback with the initial value.
26      *
27      * @param info the new device state info.
28      *
29      * @see DeviceStateInfo
30      */
onDeviceStateInfoChanged(in DeviceStateInfo info)31     oneway void onDeviceStateInfoChanged(in DeviceStateInfo info);
32 
33     /**
34      * Called to notify the callback that a request has become active. Guaranteed to be called
35      * after a subsequent call to {@link #onDeviceStateInfoChanged(DeviceStateInfo)} if the request
36      * becoming active resulted in a change of device state info.
37      *
38      * @param token the request token previously registered with
39      *        {@link IDeviceStateManager#requestState(IBinder, int, int)}
40      */
onRequestActive(IBinder token)41     oneway void onRequestActive(IBinder token);
42 
43     /**
44      * Called to notify the callback that a request has become canceled. No further callbacks will
45      * be triggered for this request. Guaranteed to be called before a subsequent call to
46      * {@link #onDeviceStateInfoChanged(DeviceStateInfo)} if the request becoming canceled resulted
47      * in a change of device state info.
48      *
49      * @param token the request token previously registered with
50      *        {@link IDeviceStateManager#requestState(IBinder, int, int)}
51      */
onRequestCanceled(IBinder token)52     oneway void onRequestCanceled(IBinder token);
53 }
54