Camera: default implementation of device 1.0
Also some updates to HIDL interface:
- Add releaseRecordingFrameHandle to ICameraDevice
for native handle metadata recording mode
- Add handleCallbackTimestamp to ICameraDevieCallback
for native handle metadata recording mode
- Add missing face detection metadata to
ICameraDeviceCallback::dataCallback
- Instead of passing native handle, pass buffer ID
in dequeueBuffer/enqueueBuffer/cancelBuffer in
ICameraDevicePreviewCallback
- Add CameraFrameMetadata in types.hal for face
metadata
Test: Camera CTS passing (except FlashLightTest) on Angler
Bug: 30985004
Change-Id: Idf72a4b5f4c934845ac698f0b13536608ffd0100
diff --git a/camera/common/1.0/default/include/CameraModule.h b/camera/common/1.0/default/include/CameraModule.h
index 68d4f90..9fbfbd5 100644
--- a/camera/common/1.0/default/include/CameraModule.h
+++ b/camera/common/1.0/default/include/CameraModule.h
@@ -20,6 +20,7 @@
#include <hardware/camera.h>
#include <utils/Mutex.h>
#include <utils/KeyedVector.h>
+#include <utils/RefBase.h>
#include "CameraMetadata.h"
diff --git a/camera/common/1.0/default/include/HandleImporter.h b/camera/common/1.0/default/include/HandleImporter.h
new file mode 100644
index 0000000..def8982
--- /dev/null
+++ b/camera/common/1.0/default/include/HandleImporter.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+#ifndef CAMERA_COMMON_1_0_HANDLEIMPORTED_H
+#define CAMERA_COMMON_1_0_HANDLEIMPORTED_H
+
+#include <hardware/gralloc.h>
+#include <hardware/gralloc1.h>
+#include <system/window.h>
+
+namespace android {
+namespace hardware {
+namespace camera {
+namespace common {
+namespace V1_0 {
+namespace helper {
+
+// Borrowed from graphics HAL. Use this until gralloc mapper HAL is working
+class HandleImporter {
+public:
+ static HandleImporter& getInstance();
+
+ // In IComposer, any buffer_handle_t is owned by the caller and we need to
+ // make a clone for hwcomposer2. We also need to translate empty handle
+ // to nullptr. This function does that, in-place.
+ bool importBuffer(buffer_handle_t& handle);
+ void freeBuffer(buffer_handle_t handle);
+ bool importFence(const native_handle_t* handle, int& fd);
+ void closeFence(int fd);
+
+private:
+
+ HandleImporter() : mInitialized(false) {}
+ bool initialize();
+ void cleanup();
+ bool openGralloc();
+ void closeGralloc();
+ buffer_handle_t cloneBuffer(buffer_handle_t handle);
+ void releaseBuffer(buffer_handle_t handle);
+
+ static HandleImporter sHandleImporter;
+ bool mInitialized;
+
+ // gralloc1
+ gralloc1_device_t* mDevice;
+ GRALLOC1_PFN_RETAIN mRetain;
+ GRALLOC1_PFN_RELEASE mRelease;
+
+ // gralloc0
+ const gralloc_module_t* mModule;
+};
+
+} // namespace helper
+} // namespace V1_0
+} // namespace common
+} // namespace camera
+} // namespace hardware
+} // namespace android
+
+#endif // CAMERA_COMMON_1_0_HANDLEIMPORTED_H
\ No newline at end of file