1e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland/*
2e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland * Copyright (C) 2017 The Android Open Source Project
3e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland *
4e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland * Licensed under the Apache License, Version 2.0 (the "License");
5e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland * you may not use this file except in compliance with the License.
6e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland * You may obtain a copy of the License at
7e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland *
8e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland *      http://www.apache.org/licenses/LICENSE-2.0
9e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland *
10e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland * Unless required by applicable law or agreed to in writing, software
11e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland * distributed under the License is distributed on an "AS IS" BASIS,
12e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland * See the License for the specific language governing permissions and
14e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland * limitations under the License.
15e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland */
16e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Morelandpackage android.frameworks.displayservice@1.0;
17e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland
18e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Morelandimport IEventCallback;
19e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland
20e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Morelandinterface IDisplayEventReceiver {
21e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland    /**
22e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * Attach callback to start receiving events. Hotplug events are enabled
23e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * by default. Vsync events must be enabled with setVsyncRate.
24e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *
25e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * @return status Must be:
26e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     SUCCESS if callback is initialized correctly.
27e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     BAD_VALUE if callback is nullptr or if this has already been called.
28e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     UNKNOWN if callback cannot be initialized.
29e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     */
30e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland    init(IEventCallback callback) generates (Status status);
31e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland
32e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland    /**
33e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * Must start (or stop) sending callbacks immediately as requested.
34e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *
35e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * @param count Request to be sent a callback for every <count>th event.
36e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *              If zero, then only send callbacks when requestNextVsync is
37e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *              called. By default, this will be zero. Must be >= 0.
38e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * @return status Must be:
39e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     SUCCESS if rate is set successfully.
40e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     BAD_VALUE if count < 0 or no init.
41e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     UNKNOWN for all other errors.
42e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     */
43e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland    setVsyncRate(int32_t count) generates (Status status);
44e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland
45e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland    /**
46e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * Must have no effect if vsync rate (set with setVsyncRate) is 0.
47e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *
48e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * @return status Must be:
49e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     SUCCESS if request successfully processed.
50e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     BAD_VALUE if no init.
51e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     UNKNOWN for all other errors.
52e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     */
53e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland    requestNextVsync() generates (Status status);
54e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland
55e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland    /**
56e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * Server must drop all references to callback and stop sending events.
57e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * Client must call this method if init was called.
58e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *
59e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     * @return status Must be:
60e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     SUCCESS if request successfully processed.
61e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     BAD_VALUE if init has not been called.
62e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     *     UNKNOWN for all other errors.
63e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland     */
64e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland    close() generates (Status status);
65e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland};
66e7fc8b65b0efa7015afb9c1e59069a081f192fcfSteven Moreland
67