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 */ 16package android.frameworks.displayservice@1.0; 17 18import IEventCallback; 19 20interface IDisplayEventReceiver { 21 /** 22 * Attach callback to start receiving events. Hotplug events are enabled 23 * by default. Vsync events must be enabled with setVsyncRate. 24 * 25 * @return status Must be: 26 * SUCCESS if callback is initialized correctly. 27 * BAD_VALUE if callback is nullptr or if this has already been called. 28 * UNKNOWN if callback cannot be initialized. 29 */ 30 init(IEventCallback callback) generates (Status status); 31 32 /** 33 * Must start (or stop) sending callbacks immediately as requested. 34 * 35 * @param count Request to be sent a callback for every <count>th event. 36 * If zero, then only send callbacks when requestNextVsync is 37 * called. By default, this will be zero. Must be >= 0. 38 * @return status Must be: 39 * SUCCESS if rate is set successfully. 40 * BAD_VALUE if count < 0 or no init. 41 * UNKNOWN for all other errors. 42 */ 43 setVsyncRate(int32_t count) generates (Status status); 44 45 /** 46 * Must have no effect if vsync rate (set with setVsyncRate) is 0. 47 * 48 * @return status Must be: 49 * SUCCESS if request successfully processed. 50 * BAD_VALUE if no init. 51 * UNKNOWN for all other errors. 52 */ 53 requestNextVsync() generates (Status status); 54 55 /** 56 * Server must drop all references to callback and stop sending events. 57 * Client must call this method if init was called. 58 * 59 * @return status Must be: 60 * SUCCESS if request successfully processed. 61 * BAD_VALUE if init has not been called. 62 * UNKNOWN for all other errors. 63 */ 64 close() generates (Status status); 65}; 66 67