Camera2: Add notification handling skeleton.
Wire up skeleton methods for handling all currently defined
notifications.
Bug: 6243944
Change-Id: I84b3f60111416ba6fbcdb086f1310225142e2b70
diff --git a/services/camera/libcameraservice/Camera2Device.h b/services/camera/libcameraservice/Camera2Device.h
index 4ac63df..91a3fbd 100644
--- a/services/camera/libcameraservice/Camera2Device.h
+++ b/services/camera/libcameraservice/Camera2Device.h
@@ -102,6 +102,27 @@
*/
status_t waitUntilDrained();
+ /**
+ * Abstract class for HAL notification listeners
+ */
+ class NotificationListener {
+ public:
+ // Refer to the Camera2 HAL definition for notification definitions
+ virtual void notifyError(int errorCode, int arg1, int arg2) = 0;
+ virtual void notifyShutter(int frameNumber, nsecs_t timestamp) = 0;
+ virtual void notifyAutoFocus(uint8_t newState, int triggerId) = 0;
+ virtual void notifyAutoExposure(uint8_t newState, int triggerId) = 0;
+ virtual void notifyAutoWhitebalance(uint8_t newState, int triggerId) = 0;
+ protected:
+ virtual ~NotificationListener();
+ };
+
+ /**
+ * Connect HAL notifications to a listener. Overwrites previous
+ * listener. Set to NULL to stop receiving notifications.
+ */
+ status_t setNotifyCallback(NotificationListener *listener);
+
private:
const int mId;
@@ -282,6 +303,13 @@
typedef List<sp<StreamAdapter> > StreamList;
StreamList mStreams;
+ // Receives HAL notifications and routes them to the NotificationListener
+ static void notificationCallback(int32_t msg_type,
+ int32_t ext1,
+ int32_t ext2,
+ int32_t ext3,
+ void *user);
+
}; // class Camera2Device
}; // namespace android