graphics: add HIDL definition for HW composer
This is a direct translation of hwcomposer2.h to HIDL.
Test: make
Change-Id: Id007af271b06f0d86afc8bc7c57300c588dc4081
diff --git a/graphics/composer/2.1/IComposerCallback.hal b/graphics/composer/2.1/IComposerCallback.hal
new file mode 100644
index 0000000..a8ca168
--- /dev/null
+++ b/graphics/composer/2.1/IComposerCallback.hal
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.graphics.composer@2.1;
+
+interface IComposerCallback {
+ enum Connection : int32_t {
+ INVALID = 0,
+
+ /* The display has been connected */
+ CONNECTED = 1,
+ /* The display has been disconnected */
+ DISCONNECTED = 2,
+ };
+
+ /*
+ * Notifies the client that the given display has either been connected or
+ * disconnected. Every active display (even a built-in physical display)
+ * must trigger at least one hotplug notification, even if it only occurs
+ * immediately after callback registration.
+ *
+ * Displays which have been connected are assumed to be in PowerMode::OFF,
+ * and the onVsync callback should not be called for a display until vsync
+ * has been enabled with setVsyncEnabled.
+ *
+ * The client may call back into the device while the callback is in
+ * progress. The device must serialize calls to this callback such that
+ * only one thread is calling it at a time.
+ *
+ * @param display is the display that triggers the hotplug event.
+ * @param connected indicates whether the display is connected or
+ * disconnected.
+ */
+ onHotplug(Display display, Connection connected);
+
+ /*
+ * Notifies the client to trigger a screen refresh. This forces all layer
+ * state for this display to be resent, and the display to be validated
+ * and presented, even if there have been no changes.
+
+ * This refresh will occur some time after the callback is initiated, but
+ * not necessarily before it returns. It is safe to trigger this callback
+ * from other functions which call into the device.
+ *
+ * @param display is the display to refresh.
+ */
+ oneway onRefresh(Display display);
+
+ /*
+ * Notifies the client that a vsync event has occurred. This callback must
+ * only be triggered when vsync is enabled for this display (through
+ * setVsyncEnabled).
+ *
+ * @param display is the display which has received a vsync event
+ * @param timestamp is the CLOCK_MONOTONIC time at which the vsync event
+ * occurred, in nanoseconds.
+ */
+ oneway onVsync(Display display, int64_t timestamp);
+};