Add original Samsung hardware projects

Change-Id: I5c9e37ea18d85e747425492f070d7e67a732d3a9
Signed-off-by: Sam Protsenko <joe.skb7@gmail.com>
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..c1ef7f2
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,4 @@
+hidl_package_root {
+    name: "vendor.samsung_slsi.hardware.epic",
+    path: "hardware/samsung_slsi/interfaces/epic",
+}
diff --git a/Android.mk b/Android.mk
new file mode 100644
index 0000000..28dda55
--- /dev/null
+++ b/Android.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 2012 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.
+#
+
+ifeq ($(TARGET_SOC_BASE), exynos9830)
+interfaces_dirs := \
+	libGeoTrans/1.0
+
+include $(call all-named-subdir-makefiles,$(interfaces_dirs))
+endif
diff --git a/epic/1.0/Android.bp b/epic/1.0/Android.bp
new file mode 100644
index 0000000..9144293
--- /dev/null
+++ b/epic/1.0/Android.bp
@@ -0,0 +1,15 @@
+// This file is autogenerated by hidl-gen -Landroidbp.
+
+hidl_interface {
+    name: "vendor.samsung_slsi.hardware.epic@1.0",
+    root: "vendor.samsung_slsi.hardware.epic",
+    srcs: [
+	"IEpicHandle.hal",
+        "IEpicRequest.hal",
+    ],
+    interfaces: [
+        "android.hidl.base@1.0",
+    ],
+    gen_java: true,
+}
+
diff --git a/epic/1.0/IEpicHandle.hal b/epic/1.0/IEpicHandle.hal
new file mode 100644
index 0000000..abec6f7
--- /dev/null
+++ b/epic/1.0/IEpicHandle.hal
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2018 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 vendor.samsung_slsi.hardware.epic@1.0;
+
+interface IEpicHandle {
+    init(int64_t request_handle);
+    get_handle() generates
+	(int64_t ret);
+    diagonostic();
+};
diff --git a/epic/1.0/IEpicRequest.hal b/epic/1.0/IEpicRequest.hal
new file mode 100644
index 0000000..d79f7a1
--- /dev/null
+++ b/epic/1.0/IEpicRequest.hal
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2018 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 vendor.samsung_slsi.hardware.epic@1.0;
+
+import IEpicHandle;
+
+interface IEpicRequest {
+    init(int32_t scenario_id) generates
+	(IEpicHandle ret);
+    init_multi(vec<int32_t> scenario_id_list) generates
+        (IEpicHandle ret);
+    update_handle_id(IEpicHandle req, string handle_id) generates
+	(uint32_t ret);
+    acquire_lock(IEpicHandle req) generates
+	(uint32_t ret);
+    release_lock(IEpicHandle req) generates
+	(uint32_t ret);
+    acquire_lock_option(IEpicHandle req, uint32_t value, uint32_t usec) generates
+	(uint32_t ret);
+    acquire_lock_multi_option(IEpicHandle req, vec<uint32_t> value_list, vec<uint32_t> usec_list) generates
+	(uint32_t ret);
+    acquire_lock_conditional(IEpicHandle req, string condition_name) generates
+	(uint32_t ret);
+    release_lock_conditional(IEpicHandle req, string condition_name) generates
+	(uint32_t ret);
+    perf_hint(IEpicHandle req, string name) generates
+        (uint32_t ret);
+    hint_release(IEpicHandle req, string name) generates
+        (uint32_t ret);
+};
diff --git a/epic/1.0/default/Android.bp b/epic/1.0/default/Android.bp
new file mode 100644
index 0000000..569db13
--- /dev/null
+++ b/epic/1.0/default/Android.bp
@@ -0,0 +1,46 @@
+cc_library_shared {
+    // FIXME: this should only be -impl for a passthrough hal.
+    // In most cases, to convert this to a binderized implementation, you should:
+    // - change '-impl' to '-service' here and make it a cc_binary instead of a
+    //   cc_library_shared.
+    // - add a *.rc file for this module.
+    // - delete HIDL_FETCH_I* functions.
+    // - call configureRpcThreadpool and registerAsService on the instance.
+    // You may also want to append '-impl/-service' with a specific identifier like
+    // '-vendor' or '-<hardware identifier>' etc to distinguish it.
+    name: "vendor.samsung_slsi.hardware.epic@1.0-impl",
+    relative_install_path: "hw",
+    // FIXME: this should be 'vendor: true' for modules that will eventually be
+    // on AOSP.
+    proprietary: true,
+    srcs: [
+        "EpicRequest.cpp",
+	"EpicHandle.cpp"
+    ],
+    shared_libs: [
+        "libhidlbase",
+        "libutils",
+	"liblog",
+        "vendor.samsung_slsi.hardware.epic@1.0",
+    ],
+}
+
+cc_binary {
+    name: "vendor.samsung_slsi.hardware.epic@1.0-service",
+    init_rc: ["vendor.samsung_slsi.hardware.epic@1.0-service.rc"],
+    relative_install_path: "hw",
+    proprietary: true,
+    srcs: ["EpicService.cpp"],
+    shared_libs: [
+        "libutils",
+        "libcutils",
+        "libhidlbase",
+        "liblog",
+        "libbinder",
+        "libsync",
+        "libhardware",
+        "libhidlmemory",
+        "android.hidl.memory@1.0",
+        "vendor.samsung_slsi.hardware.epic@1.0",
+    ],
+}
diff --git a/epic/1.0/default/EpicHandle.cpp b/epic/1.0/default/EpicHandle.cpp
new file mode 100644
index 0000000..ba3aad2
--- /dev/null
+++ b/epic/1.0/default/EpicHandle.cpp
@@ -0,0 +1,49 @@
+#include "EpicHandle.h"
+
+namespace vendor {
+	namespace samsung_slsi {
+		namespace hardware {
+			namespace epic {
+				namespace V1_0 {
+					namespace implementation {
+						EpicHandle::EpicHandle() :
+							mReqHandle(0),
+							pfn_free_request(nullptr)
+						{
+						}
+
+						EpicHandle::~EpicHandle()
+						{
+							if (mReqHandle == 0)
+								return;
+
+							if (pfn_free_request != nullptr)
+								pfn_free_request(mReqHandle);
+						}
+
+						// Methods from ::vendor::samsung_slsi::hardware::epic::V1_0::IEpicHandle follow.
+						Return<void> EpicHandle::init(int64_t request_handle) {
+							mReqHandle = static_cast<long>(request_handle);
+
+							return Void();
+						}
+
+						Return<int64_t> EpicHandle::get_handle() {
+							return static_cast<int64_t>(mReqHandle);
+						}
+
+						Return<void> EpicHandle::diagonostic() {
+							return Void();
+						}
+
+						Return<void> EpicHandle::set_pfn_finalize(free_request_t pfn)
+						{
+							pfn_free_request = pfn;
+							return Void();
+						}
+					}  // namespace implementation
+				}  // namespace V1_0
+			}  // namespace epic
+		}  // namespace interfaces
+	}  // namespace samsung_slsi
+}  // namespace hardware
diff --git a/epic/1.0/default/EpicHandle.h b/epic/1.0/default/EpicHandle.h
new file mode 100644
index 0000000..a616ec9
--- /dev/null
+++ b/epic/1.0/default/EpicHandle.h
@@ -0,0 +1,48 @@
+#ifndef VENDOR_SAMSUNG_SLSI_HARDWARE_EPIC_V1_0_EPICHANDLE_H
+#define VENDOR_SAMSUNG_SLSI_HARDWARE_EPIC_V1_0_EPICHANDLE_H
+
+#include <vendor/samsung_slsi/hardware/epic/1.0/IEpicHandle.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+#include <hidl/HidlSupport.h>
+
+#include "EpicType.h"
+
+namespace vendor {
+	namespace samsung_slsi {
+		namespace hardware {
+			namespace epic {
+				namespace V1_0 {
+					namespace implementation {
+
+						using ::android::hardware::hidl_array;
+						using ::android::hardware::hidl_memory;
+						using ::android::hardware::hidl_string;
+						using ::android::hardware::hidl_vec;
+						using ::android::hardware::Return;
+						using ::android::hardware::Void;
+						using ::android::sp;
+
+						struct EpicHandle : public IEpicHandle {
+							EpicHandle();
+							virtual ~EpicHandle();
+
+							// Methods from ::vendor::samsung_slsi::hardware::epic::V1_0::IEpicHandle follow.
+							Return<void> init(int64_t request_handle) override;
+							Return<int64_t> get_handle() override;
+
+							Return<void> diagonostic() override;
+
+							Return<void> set_pfn_finalize(free_request_t pfn);
+
+							long mReqHandle;
+							free_request_t pfn_free_request;
+						};
+					}  // namespace implementation
+				}  // namespace V1_0
+			}  // namespace epic
+		}  // namespace hardware
+	}  // namespace samsung_slsi
+}  // namespace vendor
+
+#endif  // VENDOR_SAMSUNG_SLSI_HARDWARE_EPIC_V1_0_EPICHANDLE_H
diff --git a/epic/1.0/default/EpicRequest.cpp b/epic/1.0/default/EpicRequest.cpp
new file mode 100644
index 0000000..f6aac74
--- /dev/null
+++ b/epic/1.0/default/EpicRequest.cpp
@@ -0,0 +1,297 @@
+#include "EpicRequest.h"
+#include "EpicHandle.h"
+
+#include <chrono>
+#include <thread>
+#include <sstream>
+
+#include <dlfcn.h>
+#include <unistd.h>
+#include <sys/file.h>
+#include <sys/stat.h>
+#include <sys/sendfile.h>
+#include <android/log.h>
+
+namespace vendor {
+namespace samsung_slsi {
+namespace hardware {
+namespace epic {
+namespace V1_0 {
+namespace implementation {
+EpicRequest::EpicRequest() :
+	so_handle(nullptr)
+{
+	if (sizeof(long) == sizeof(int))
+		so_handle = dlopen("/vendor/lib/libepic_helper.so", RTLD_NOW);
+	else
+		so_handle = dlopen("/vendor/lib64/libepic_helper.so", RTLD_NOW);
+
+	if (so_handle == nullptr) {
+		pfn_init = nullptr;
+		pfn_term = nullptr;
+		pfn_alloc_request = nullptr;
+		pfn_alloc_multi_request = nullptr;
+		pfn_update_handle = nullptr;
+		pfn_free_request = nullptr;
+		pfn_acquire = nullptr;
+		pfn_acquire_option = nullptr;
+		pfn_acquire_multi_option = nullptr;
+		pfn_release = nullptr;
+		pfn_acquire_conditional = nullptr;
+		pfn_release_conditional = nullptr;
+		pfn_hint = nullptr;
+		pfn_hint_release = nullptr;
+		pfn_dump = nullptr;
+		return;
+	}
+
+	pfn_init = (init_t)dlsym(so_handle, "epic_init");
+	pfn_term = (term_t)dlsym(so_handle, "epic_term");
+	pfn_alloc_request = (alloc_request_t)dlsym(so_handle, "epic_alloc_request_internal");
+	pfn_alloc_multi_request = (alloc_multi_request_t)dlsym(so_handle, "epic_alloc_multi_request_internal");
+	pfn_update_handle = (update_handle_t)dlsym(so_handle, "epic_update_handle_id_internal");
+	pfn_free_request = (free_request_t)dlsym(so_handle, "epic_free_request_internal");
+	pfn_acquire = (acquire_t)dlsym(so_handle, "epic_acquire_internal");
+	pfn_acquire_option = (acquire_option_t)dlsym(so_handle, "epic_acquire_option_internal");
+	pfn_acquire_multi_option = (acquire_multi_option_t)dlsym(so_handle, "epic_acquire_multi_option_internal");
+	pfn_acquire_conditional = (acquire_conditional_t)dlsym(so_handle, "epic_acquire_conditional_internal");
+	pfn_release_conditional = (release_conditional_t)dlsym(so_handle, "epic_release_conditional_internal");
+	pfn_hint = (hint_t)dlsym(so_handle, "epic_perf_hint_internal");
+	pfn_hint_release = (hint_t)dlsym(so_handle, "epic_hint_release_internal");
+	pfn_release = (release_t)dlsym(so_handle, "epic_release_internal");
+	pfn_dump = (dump_t)dlsym(so_handle, "epic_request_dumpstate_internal");
+
+	if (pfn_init != nullptr)
+		pfn_init();
+}
+
+EpicRequest::~EpicRequest()
+{
+	if (pfn_term != nullptr)
+		pfn_term();
+
+	dlclose(so_handle);
+}
+
+// Methods from ::hardware::samsung_slsi::hardware::epic::V1_0::IEpicRequest follow.
+Return<sp<IEpicHandle>> EpicRequest::init(int32_t scenario_id) {
+	if (pfn_alloc_request == nullptr)
+		return nullptr;
+
+	handleType req_handle = pfn_alloc_request(scenario_id);
+
+	EpicHandle *ret_instance = new EpicHandle();
+	ret_instance->set_pfn_finalize(pfn_free_request);
+
+	sp<IEpicHandle> ret = ret_instance;
+	ret->init(req_handle);
+
+	return ret;
+}
+
+Return<sp<IEpicHandle>> EpicRequest::init_multi(const hidl_vec<int32_t>& scenario_id_list) {
+	if (pfn_alloc_multi_request == nullptr)
+		return nullptr;
+
+	handleType req_handle = pfn_alloc_multi_request(scenario_id_list.data(), scenario_id_list.size());
+
+	EpicHandle *ret_instance = new EpicHandle();
+	ret_instance->set_pfn_finalize(pfn_free_request);
+
+	sp<IEpicHandle> ret = ret_instance;
+	ret->init(req_handle);
+
+	return ret;
+}
+
+Return<uint32_t> EpicRequest::update_handle_id(const sp<IEpicHandle> &handle, const hidl_string &handle_id) {
+	if (handle == nullptr)
+		return 0;
+
+	handleType req_handle = (handleType)handle->get_handle();
+
+	if (req_handle == 0 ||
+		pfn_update_handle == nullptr)
+		return false;
+
+	pfn_update_handle(req_handle, handle_id.c_str());
+	return true;
+}
+
+Return<uint32_t> EpicRequest::acquire_lock(const sp<IEpicHandle> &handle) {
+	if (handle == nullptr)
+		return 0;
+
+	handleType req_handle = (handleType)handle->get_handle();
+
+	if (req_handle == 0 ||
+		pfn_acquire == nullptr)
+		return 0;
+
+	return (uint32_t)pfn_acquire(req_handle);
+}
+
+Return<uint32_t> EpicRequest::release_lock(const sp<IEpicHandle> &handle) {
+	if (handle == nullptr)
+		return 0;
+
+	handleType req_handle = (handleType)handle->get_handle();
+
+	if (req_handle == 0 ||
+		pfn_release == nullptr)
+		return 0;
+
+	return (uint32_t)pfn_release(req_handle);
+}
+
+Return<uint32_t> EpicRequest::acquire_lock_option(const sp<IEpicHandle> &handle, uint32_t value, uint32_t usec) {
+	if (handle == nullptr)
+		return 0;
+
+	handleType req_handle = (handleType)handle->get_handle();
+
+	if (req_handle == 0 ||
+		pfn_acquire_option == nullptr)
+		return 0;
+
+	return (uint32_t)pfn_acquire_option(req_handle, value, usec);
+}
+
+Return<uint32_t> EpicRequest::acquire_lock_multi_option(const sp<IEpicHandle> &handle, const hidl_vec<uint32_t>& value_list, const hidl_vec<uint32_t>& usec_list) {
+	if (handle == nullptr)
+		return 0;
+
+	handleType req_handle = (handleType)handle->get_handle();
+
+	if (req_handle == 0 ||
+		pfn_acquire_multi_option == nullptr)
+		return 0;
+
+	return (uint32_t)pfn_acquire_multi_option(req_handle, value_list.data(), usec_list.data(), value_list.size());
+}
+
+Return<uint32_t> EpicRequest::acquire_lock_conditional(const sp<IEpicHandle> &handle, const hidl_string &condition_name) {
+	if (handle == nullptr)
+		return 0;
+
+	handleType req_handle = (handleType)handle->get_handle();
+
+	if (req_handle == 0 ||
+		pfn_acquire_conditional == nullptr)
+		return 0;
+
+	return (uint32_t)pfn_acquire_conditional(req_handle, condition_name.c_str(), condition_name.size());
+}
+
+Return<uint32_t> EpicRequest::release_lock_conditional(const sp<IEpicHandle> &handle, const hidl_string &condition_name) {
+	if (handle == nullptr)
+		return 0;
+
+	handleType req_handle = (handleType)handle->get_handle();
+
+	if (req_handle == 0 ||
+		pfn_release_conditional == nullptr)
+		return 0;
+
+	return (uint32_t)pfn_release_conditional(req_handle, condition_name.c_str(), condition_name.size());
+}
+
+Return<uint32_t> EpicRequest::perf_hint(const sp<IEpicHandle> &handle, const hidl_string& name) {
+	if (handle == nullptr)
+		return 0;
+
+	handleType req_handle = (handleType)handle->get_handle();
+
+	if (req_handle == 0 ||
+		pfn_hint == nullptr)
+		return 0;
+
+	return (uint32_t)pfn_hint(req_handle, name.c_str(), name.size());
+}
+
+Return<uint32_t> EpicRequest::hint_release(const sp<IEpicHandle> &handle, const hidl_string& name) {
+	if (handle == nullptr)
+		return 0;
+
+	handleType req_handle = (handleType)handle->get_handle();
+
+	if (req_handle == 0 ||
+		pfn_hint_release == nullptr)
+		return 0;
+
+	return (uint32_t)pfn_hint_release(req_handle, name.c_str(), name.size());
+}
+
+Return<void> EpicRequest::debug(const hidl_handle& fd, const hidl_vec<hidl_string>& __unused options) {
+	if (pfn_dump == nullptr)
+		return Void();
+
+	const native_handle_t* native_handle = fd.getNativeHandle();
+	if (native_handle == nullptr || native_handle->numFds < 1)
+		return Void();
+
+	int dumpFd = native_handle->data[0];
+
+	sp<IEpicHandle> handle = init(0);
+	handleType req_handle = (handleType)handle->get_handle();
+
+	std::ostringstream fmt;
+	fmt << PATH_DIR_DUMP << PATH_FILE_DUMP;
+	std::string &&path_dump = fmt.str();
+
+	pfn_dump(req_handle, path_dump.c_str(), path_dump.length());
+	std::this_thread::sleep_for(std::chrono::milliseconds(100));
+
+	int requestDumpFd = -1, count_try = 0;
+	for (count_try = 0; count_try < MAX_TRIES_DUMP; ++count_try) {
+		requestDumpFd = open(path_dump.c_str(), O_RDONLY);
+		if (requestDumpFd >= 0)
+			break;
+
+		std::this_thread::sleep_for(std::chrono::milliseconds(1));
+	}
+
+	if (count_try == MAX_TRIES_DUMP &&
+		requestDumpFd == -1)
+		return Void();
+
+	bool lockHeld = false;
+	for (count_try = 0; count_try < MAX_TRIES_DUMP; ++count_try) {
+		if (flock(requestDumpFd, LOCK_EX) == 0) {
+			lockHeld = true;
+			break;
+		}
+
+		std::this_thread::sleep_for(std::chrono::milliseconds(1));
+	}
+
+	if (count_try == MAX_TRIES_DUMP &&
+		!lockHeld) {
+		close(requestDumpFd);
+		return Void();
+	}
+
+	off_t file_size;
+	file_size = lseek(requestDumpFd, 0, SEEK_END);
+	lseek(requestDumpFd, 0, SEEK_SET);
+	if (sendfile(dumpFd, requestDumpFd, 0, file_size) < 0)
+		__android_log_print(ANDROID_LOG_INFO, "EpicHAL", "Couldn't send file content successfully!");
+	if (flock(requestDumpFd, LOCK_UN) == -1)
+		__android_log_print(ANDROID_LOG_INFO, "EpicHAL", "Couldn't release file lock!");
+	close(requestDumpFd);
+	unlink(path_dump.c_str());
+
+	return Void();
+}
+
+// Methods from ::android::hidl::base::V1_0::IBase follow.
+IEpicRequest* HIDL_FETCH_IEpicRequest(const char* /* name */) {
+	return new EpicRequest();
+}
+//
+}  // namespace implementation
+}  // namespace V1_0
+}  // namespace epic
+}  // namespace hardware
+}  // namespace samsung_slsi
+}  // namespace vendor
diff --git a/epic/1.0/default/EpicRequest.h b/epic/1.0/default/EpicRequest.h
new file mode 100644
index 0000000..c9b53bd
--- /dev/null
+++ b/epic/1.0/default/EpicRequest.h
@@ -0,0 +1,81 @@
+#ifndef VENDOR_SAMSUNG_SLSI_HARDWARE_EPIC_V1_0_EPICREQUEST_H
+#define VENDOR_SAMSUNG_SLSI_HARDWARE_EPIC_V1_0_EPICREQUEST_H
+
+#include <vendor/samsung_slsi/hardware/epic/1.0/IEpicRequest.h>
+#include <vendor/samsung_slsi/hardware/epic/1.0/IEpicHandle.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+#include <hidl/HidlSupport.h>
+
+#include "EpicType.h"
+
+namespace vendor {
+	namespace samsung_slsi {
+		namespace hardware {
+			namespace epic {
+				namespace V1_0 {
+					namespace implementation {
+
+						using ::android::hardware::hidl_array;
+						using ::android::hardware::hidl_memory;
+						using ::android::hardware::hidl_string;
+						using ::android::hardware::hidl_vec;
+						using ::android::hardware::hidl_handle;
+						using ::android::hardware::Return;
+						using ::android::hardware::Void;
+						using ::android::sp;
+
+						struct EpicRequest : public IEpicRequest {
+							EpicRequest();
+							virtual ~EpicRequest();
+
+							// Methods from ::vendor::samsung_slsi::hardware::epic::V1_0::IEpicRequest follow.
+
+							Return<sp<IEpicHandle>> init(int32_t scenario_id) override;
+							Return<sp<IEpicHandle>> init_multi(const hidl_vec<int32_t>& scenario_id_list) override;
+							Return<uint32_t> update_handle_id(const sp<IEpicHandle> &handle, const hidl_string &handle_id) override;
+							Return<uint32_t> acquire_lock(const sp<IEpicHandle> &handle) override;
+							Return<uint32_t> release_lock(const sp<IEpicHandle> &handle) override;
+							Return<uint32_t> acquire_lock_option(const sp<IEpicHandle> &handle, uint32_t value, uint32_t usec) override;
+							Return<uint32_t> acquire_lock_multi_option(const sp<IEpicHandle> &handle, const hidl_vec<uint32_t>& value_list, const hidl_vec<uint32_t>& usec_list) override;
+							Return<uint32_t> acquire_lock_conditional(const sp<IEpicHandle> &handle, const hidl_string &condition_name);
+							Return<uint32_t> release_lock_conditional(const sp<IEpicHandle> &handle, const hidl_string &condition_name);
+							Return<uint32_t> perf_hint(const sp<IEpicHandle> &handle, const hidl_string& name) override;
+							Return<uint32_t> hint_release(const sp<IEpicHandle> &handle, const hidl_string& name) override;
+
+							Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
+
+							void *so_handle;
+
+							init_t pfn_init;
+							term_t pfn_term;
+							alloc_request_t pfn_alloc_request;
+							alloc_multi_request_t pfn_alloc_multi_request;
+							update_handle_t pfn_update_handle;
+							free_request_t pfn_free_request;
+							acquire_t pfn_acquire;
+							acquire_option_t pfn_acquire_option;
+							acquire_multi_option_t pfn_acquire_multi_option;
+							acquire_conditional_t pfn_acquire_conditional;
+							release_conditional_t pfn_release_conditional;
+							hint_t pfn_hint;
+							hint_release_t pfn_hint_release;
+							release_t pfn_release;
+							dump_t pfn_dump;
+
+							constexpr static const char *PATH_DIR_DUMP = "/data/vendor/epic/";
+							constexpr static const char *PATH_FILE_DUMP = "epic.dump";
+							constexpr static const int MAX_TRIES_DUMP = 1000;
+						};
+
+						// FIXME: most likely delete, this is only for passthrough implementations
+						extern "C" IEpicRequest* HIDL_FETCH_IEpicRequest(const char* name);
+
+					}  // namespace implementation
+				}  // namespace V1_0
+			}  // namespace epic
+		}  // namespace hardware
+	}  // namespace samsung_slsi
+}  // namespace vendor
+
+#endif  // VENDOR_SAMSUNG_SLSI_HARDWARE_EPIC_V1_0_EPICREQUEST_H
diff --git a/epic/1.0/default/EpicService.cpp b/epic/1.0/default/EpicService.cpp
new file mode 100644
index 0000000..65c63c0
--- /dev/null
+++ b/epic/1.0/default/EpicService.cpp
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "vendor.samsung_slsi.hardware.epic@1.0-service"
+
+#include <android/log.h>
+#include <hidl/HidlTransportSupport.h>
+#include <binder/ProcessState.h>
+
+#include <hidl/LegacySupport.h>
+#include "EpicRequest.h"
+
+using android::hardware::configureRpcThreadpool;
+using android::hardware::joinRpcThreadpool;
+using android::hardware::defaultPassthroughServiceImplementation;
+using android::sp;
+
+using vendor::samsung_slsi::hardware::epic::V1_0::IEpicRequest;
+using vendor::samsung_slsi::hardware::epic::V1_0::implementation::EpicRequest;
+
+int main()
+{
+	android::ProcessState::initWithDriver("/dev/vndbinder");
+
+	ALOGI("Epic Service started!");
+	return defaultPassthroughServiceImplementation<IEpicRequest>();
+}
diff --git a/epic/1.0/default/EpicType.h b/epic/1.0/default/EpicType.h
new file mode 100644
index 0000000..29d30d4
--- /dev/null
+++ b/epic/1.0/default/EpicType.h
@@ -0,0 +1,21 @@
+#ifndef VENDOR_SAMSUNG_SLSI_HARDWARE_EPIC_V1_0_EPICTYPE_H
+#define VENDOR_SAMSUNG_SLSI_HARDWARE_EPIC_V1_0_EPICTYPE_H
+
+typedef long handleType;
+typedef void (*init_t)();
+typedef void (*term_t)();
+typedef handleType (*alloc_request_t)(int);
+typedef handleType (*alloc_multi_request_t)(const int[], int);
+typedef void (*update_handle_t)(handleType, const char *);
+typedef void (*free_request_t)(handleType);
+typedef bool (*acquire_t)(handleType);
+typedef bool (*release_t)(handleType);
+typedef bool (*acquire_option_t)(handleType, unsigned int, unsigned int);
+typedef bool (*acquire_multi_option_t)(handleType, const unsigned int [], const unsigned int [], int len);
+typedef bool (*acquire_conditional_t)(handleType, const char *, ssize_t);
+typedef bool (*release_conditional_t)(handleType, const char *, ssize_t);
+typedef bool (*hint_t)(handleType, const char *, ssize_t);
+typedef bool (*hint_release_t)(handleType, const char *, ssize_t);
+typedef bool (*dump_t)(handleType, const char *, ssize_t);
+
+#endif
diff --git a/epic/1.0/default/vendor.samsung_slsi.hardware.epic@1.0-service.rc b/epic/1.0/default/vendor.samsung_slsi.hardware.epic@1.0-service.rc
new file mode 100644
index 0000000..5246452
--- /dev/null
+++ b/epic/1.0/default/vendor.samsung_slsi.hardware.epic@1.0-service.rc
@@ -0,0 +1,4 @@
+service epic_service /vendor/bin/hw/vendor.samsung_slsi.hardware.epic@1.0-service
+    class hal
+    user system
+    group system
diff --git a/epic/current.txt b/epic/current.txt
new file mode 100644
index 0000000..5a1bfa1
--- /dev/null
+++ b/epic/current.txt
@@ -0,0 +1,2 @@
+05c5e1c716570963df5aece67b0a2ba9edece543777b76d1d0ea0a4ed2a8c5af vendor.samsung_slsi.hardware.epic@1.0::IEpicHandle
+3f3942355fe2f7a17e3019e2ad8089d83dedf70c9a629ef5d54b6af5aaf98162 vendor.samsung_slsi.hardware.epic@1.0::IEpicRequest
diff --git a/epic/epicoperator/Android.bp b/epic/epicoperator/Android.bp
new file mode 100644
index 0000000..0b29261
--- /dev/null
+++ b/epic/epicoperator/Android.bp
@@ -0,0 +1,23 @@
+cc_library {
+    name: "libepicoperator",
+    proprietary: true,
+    srcs: [
+	"EpicConnector.cpp",
+        "EpicBaseOperator.cpp",
+	"EpicCommonOperator.cpp",
+	"EpicCommonMultiOperator.cpp",
+	"EpicVideoDecodingOperator.cpp",
+	"EpicVideoEncodingOperator.cpp",
+	"OperatorFactory.cpp",
+	"EpicExportAPI.cpp"
+    ],
+    shared_libs: [
+	"libbinder",
+	"libutils",
+	"libcutils",
+	"libhidlbase",
+	"liblog",
+        "vendor.samsung_slsi.hardware.epic@1.0"
+    ],
+    export_include_dirs: ["./"]
+}
diff --git a/epic/epicoperator/EpicBaseOperator.cpp b/epic/epicoperator/EpicBaseOperator.cpp
new file mode 100644
index 0000000..010abe2
--- /dev/null
+++ b/epic/epicoperator/EpicBaseOperator.cpp
@@ -0,0 +1,35 @@
+#include "EpicBaseOperator.h"
+
+namespace epic {
+	EpicBaseOperator::EpicBaseOperator(int scenario_id)
+	{
+		if (!prepareConnector())
+			return;
+
+		mConnector->alloc_request(scenario_id);
+	}
+
+	EpicBaseOperator::EpicBaseOperator(int *scenario_id_list, int len)
+	{
+		if (!prepareConnector())
+			return;
+
+		mConnector->alloc_request(scenario_id_list, len);
+	}
+
+	EpicBaseOperator::~EpicBaseOperator()
+	{
+	}
+
+	bool EpicBaseOperator::doAction(int __unused cmd, void __unused *arg)
+	{
+		return true;
+	}
+
+	bool EpicBaseOperator::prepareConnector()
+	{
+		mConnector = std::make_shared<EpicConnector>();
+
+		return (mConnector != nullptr);
+	}
+}
diff --git a/epic/epicoperator/EpicBaseOperator.h b/epic/epicoperator/EpicBaseOperator.h
new file mode 100644
index 0000000..514fdbb
--- /dev/null
+++ b/epic/epicoperator/EpicBaseOperator.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <memory>
+
+#include "IEpicOperator.h"
+#include "EpicConnector.h"
+
+namespace epic {
+	class EpicBaseOperator : public IEpicOperator {
+	public:
+		virtual ~EpicBaseOperator();
+
+		virtual bool doAction(int cmd, void *arg) override;
+
+	protected:
+		EpicBaseOperator(int scenario_id);
+		EpicBaseOperator(int *scenario_id, int len);
+
+		std::shared_ptr<EpicConnector> mConnector;
+
+	private:
+		bool prepareConnector();
+	};
+}
diff --git a/epic/epicoperator/EpicCommonMultiOperator.cpp b/epic/epicoperator/EpicCommonMultiOperator.cpp
new file mode 100644
index 0000000..86564eb
--- /dev/null
+++ b/epic/epicoperator/EpicCommonMultiOperator.cpp
@@ -0,0 +1,48 @@
+#include "EpicCommonMultiOperator.h"
+
+#include "EpicEnum.h"
+
+namespace epic {
+	EpicCommonMultiOperator::EpicCommonMultiOperator() :
+		EpicBaseOperator(0)
+	{
+	}
+
+	EpicCommonMultiOperator::EpicCommonMultiOperator(int *scenario_id_list, int len) :
+		EpicBaseOperator(scenario_id_list, len)
+	{
+	}
+
+	EpicCommonMultiOperator::~EpicCommonMultiOperator()
+	{
+	}
+
+	bool EpicCommonMultiOperator::doAction(int __unused cmd, void *arg)
+	{
+		switch (cmd) {
+		case eAcquire:
+			return mConnector->acquire();
+		case eRelease:
+			return mConnector->release();
+		case eAcquireOption:
+			return doAcquireOption(arg);
+		default:
+			return false;
+		}
+
+		return false;
+	}
+
+	bool EpicCommonMultiOperator::doAcquireOption(void *arg)
+	{
+		if (arg == nullptr)
+			return false;
+
+		unsigned int *arg_array = reinterpret_cast<unsigned int *>(arg);
+		unsigned int len_array = *arg_array;
+
+		arg_array++;
+
+		return mConnector->acquire(arg_array, arg_array + len_array, len_array);
+	}
+}
diff --git a/epic/epicoperator/EpicCommonMultiOperator.h b/epic/epicoperator/EpicCommonMultiOperator.h
new file mode 100644
index 0000000..703a372
--- /dev/null
+++ b/epic/epicoperator/EpicCommonMultiOperator.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "IEpicOperator.h"
+#include "EpicBaseOperator.h"
+
+namespace epic {
+class EpicCommonMultiOperator : public EpicBaseOperator {
+	public:
+		EpicCommonMultiOperator();
+		EpicCommonMultiOperator(int *scenario_id_list, int len);
+		virtual ~EpicCommonMultiOperator() override;
+
+		virtual bool doAction(int cmd, void *arg) override;
+
+	private:
+		bool doAcquireOption(void *arg);
+	};
+}
diff --git a/epic/epicoperator/EpicCommonOperator.cpp b/epic/epicoperator/EpicCommonOperator.cpp
new file mode 100644
index 0000000..c8f8b54
--- /dev/null
+++ b/epic/epicoperator/EpicCommonOperator.cpp
@@ -0,0 +1,58 @@
+#include "EpicCommonOperator.h"
+
+#include "EpicEnum.h"
+
+namespace epic {
+	EpicCommonOperator::EpicCommonOperator() :
+		EpicBaseOperator(0)
+	{
+	}
+
+	EpicCommonOperator::EpicCommonOperator(int scenario_id) :
+		EpicBaseOperator(scenario_id)
+	{
+	}
+
+	EpicCommonOperator::~EpicCommonOperator()
+	{
+	}
+
+	bool EpicCommonOperator::doAction(int __unused cmd, void *arg)
+	{
+		switch (cmd) {
+		case eAcquire:
+			return mConnector->acquire();
+		case eRelease:
+			return mConnector->release();
+		case eAcquireOption:
+			return doAcquireOption(arg);
+		case eAcquireConditional:
+			return doConditional(&EpicConnector::acquire_conditional, arg);
+		case eReleaseConditional:
+			return doConditional(&EpicConnector::release_conditional, arg);
+		default:
+			return false;
+		}
+
+		return false;
+	}
+
+	bool EpicCommonOperator::doAcquireOption(void *arg)
+	{
+		if (arg == nullptr)
+			return false;
+
+		unsigned int *arg_array = reinterpret_cast<unsigned int *>(arg);
+
+		return mConnector->acquire(arg_array[0], arg_array[1]);
+	}
+
+	bool EpicCommonOperator::doConditional(bool (EpicConnector::*func_conditional)(std::string &), void *arg)
+	{
+		if (arg == nullptr)
+			return false;
+
+		std::string arg_string(reinterpret_cast<char *>(arg));
+		return ((*mConnector).*func_conditional)(arg_string);
+	}
+}
diff --git a/epic/epicoperator/EpicCommonOperator.h b/epic/epicoperator/EpicCommonOperator.h
new file mode 100644
index 0000000..60dc1f6
--- /dev/null
+++ b/epic/epicoperator/EpicCommonOperator.h
@@ -0,0 +1,19 @@
+#pragma once
+
+#include "IEpicOperator.h"
+#include "EpicBaseOperator.h"
+
+namespace epic {
+	class EpicCommonOperator : public EpicBaseOperator {
+	public:
+		EpicCommonOperator();
+		EpicCommonOperator(int scenario_id);
+		virtual ~EpicCommonOperator() override;
+
+		virtual bool doAction(int cmd, void *arg) override;
+
+	private:
+		bool doAcquireOption(void *arg);
+		bool doConditional(bool (EpicConnector::*)(std::string &), void *arg);
+	};
+}
diff --git a/epic/epicoperator/EpicConnector.cpp b/epic/epicoperator/EpicConnector.cpp
new file mode 100644
index 0000000..cbc5af0
--- /dev/null
+++ b/epic/epicoperator/EpicConnector.cpp
@@ -0,0 +1,103 @@
+#include "EpicConnector.h"
+
+#include <vector>
+
+#include <android/log.h>
+
+#include <dlfcn.h>
+#include <unistd.h>
+
+using ::android::hardware::hidl_vec;
+
+namespace epic {
+	EpicConnector::EpicConnector()
+	{
+	}
+
+	EpicConnector::~EpicConnector()
+	{
+	}
+
+	void EpicConnector::alloc_request(int scenario_id)
+	{
+		getService();
+		if (mRequest == nullptr)
+			return;
+
+		mHandle = mRequest->init(scenario_id);
+	}
+
+	void EpicConnector::alloc_request(int *scenario_id_list, int len)
+	{
+		getService();
+		if (mRequest == nullptr)
+			return;
+
+		std::vector<int32_t> id_vec(scenario_id_list, scenario_id_list + len);
+		mHandle = mRequest->init_multi(id_vec);
+	}
+
+	bool EpicConnector::acquire()
+	{
+		if (mRequest == nullptr ||
+			mHandle == nullptr)
+			return false;
+
+		return mRequest->acquire_lock(mHandle);
+	}
+
+	bool EpicConnector::acquire(unsigned int value, unsigned int usec)
+	{
+		if (mRequest == nullptr ||
+			mHandle == nullptr)
+			return false;
+
+		return mRequest->acquire_lock_option(mHandle, value, usec);
+	}
+
+	bool EpicConnector::acquire(unsigned int *value, unsigned int *usec, int len)
+	{
+		if (mRequest == nullptr ||
+			mHandle == nullptr)
+			return false;
+
+		std::vector<unsigned int> value_vec(value, value + len);
+		std::vector<unsigned int> usec_vec(usec, usec + len);
+
+		return mRequest->acquire_lock_multi_option(mHandle, value_vec, usec_vec);
+	}
+
+	bool EpicConnector::acquire_conditional(std::string &condition_name)
+	{
+		if (mRequest == nullptr ||
+			mHandle == nullptr)
+			return false;
+
+		return mRequest->acquire_lock_conditional(mHandle, condition_name.c_str());
+	}
+
+	bool EpicConnector::release()
+	{
+		if (mRequest == nullptr ||
+			mHandle == nullptr)
+			return false;
+
+		return mRequest->release_lock(mHandle);
+	}
+
+	bool EpicConnector::release_conditional(std::string &condition_name)
+	{
+		if (mRequest == nullptr ||
+			mHandle == nullptr)
+			return false;
+
+		return mRequest->release_lock_conditional(mHandle, condition_name.c_str());
+	}
+
+	void EpicConnector::getService()
+	{
+		mRequest = IEpicRequest::getService();
+		if (mRequest == nullptr)
+			__android_log_print(ANDROID_LOG_INFO, "EPICOPERATOR", "Couldn't get service EPIC HIDL!");
+	}
+}
diff --git a/epic/epicoperator/EpicConnector.h b/epic/epicoperator/EpicConnector.h
new file mode 100644
index 0000000..ce2ead3
--- /dev/null
+++ b/epic/epicoperator/EpicConnector.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <vendor/samsung_slsi/hardware/epic/1.0/IEpicRequest.h>
+using ::vendor::samsung_slsi::hardware::epic::V1_0::IEpicRequest;
+using ::vendor::samsung_slsi::hardware::epic::V1_0::IEpicHandle;
+using ::android::sp;
+
+#include <string>
+
+namespace epic {
+	class EpicConnector {
+	public:
+		EpicConnector();
+		~EpicConnector();
+
+		void alloc_request(int scenario_id);
+		void alloc_request(int *scenario_id_list, int len);
+		void free_request();
+		bool acquire();
+		bool acquire(unsigned int value, unsigned int usec);
+		bool acquire(unsigned int *value, unsigned int *usec, int len);
+		bool acquire_conditional(std::string &condition_name);
+		bool release();
+		bool release_conditional(std::string &condition_name);
+
+	private:
+		void getService();
+
+		sp<IEpicRequest> mRequest;
+		sp<IEpicHandle> mHandle;
+	};
+}
diff --git a/epic/epicoperator/EpicEnum.h b/epic/epicoperator/EpicEnum.h
new file mode 100644
index 0000000..d18bcbd
--- /dev/null
+++ b/epic/epicoperator/EpicEnum.h
@@ -0,0 +1,16 @@
+#pragma once
+
+enum eOperator {
+	eCommon,
+        eVideoEncoding,
+        eVideoDecoding,
+};
+
+enum eCommand {
+	eNone,
+	eAcquire,
+	eRelease,
+	eAcquireOption,
+	eAcquireConditional,
+	eReleaseConditional,
+};
diff --git a/epic/epicoperator/EpicExportAPI.cpp b/epic/epicoperator/EpicExportAPI.cpp
new file mode 100644
index 0000000..a0fbaff
--- /dev/null
+++ b/epic/epicoperator/EpicExportAPI.cpp
@@ -0,0 +1,79 @@
+#include <memory>
+#include <cstring>
+
+#include <unistd.h>
+
+#include <OperatorFactory.h>
+
+using namespace epic;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+long epic_alloc_request_internal(int id)
+{
+	return reinterpret_cast<long>(createScenarioOperator(eCommon, id));
+}
+
+void epic_free_request_internal(long handle)
+{
+	IEpicOperator *handle_operator = reinterpret_cast<IEpicOperator *>(handle);
+
+	if (handle_operator == nullptr)
+		return;
+
+	delete handle_operator;
+}
+
+bool epic_acquire_internal(long handle)
+{
+	IEpicOperator *handle_operator = reinterpret_cast<IEpicOperator *>(handle);
+
+	if (handle_operator == nullptr)
+		return false;
+
+	return handle_operator->doAction(eAcquire, nullptr);
+}
+
+bool epic_acquire_option_internal(long handle, unsigned int value, unsigned int usec)
+{
+	IEpicOperator *handle_operator = reinterpret_cast<IEpicOperator *>(handle);
+
+	if (handle_operator == nullptr)
+		return false;
+
+	int32_t arg_array[2] = { static_cast<int32_t>(value), static_cast<int32_t>(usec) };
+	return handle_operator->doAction(eAcquireOption, arg_array);
+}
+
+bool epic_acquire_option_multi_internal(long handle, unsigned int *value, unsigned int *usec, int len)
+{
+	IEpicOperator *handle_operator = reinterpret_cast<IEpicOperator *>(handle);
+
+	if (handle_operator == nullptr ||
+		len == 0)
+		return false;
+
+	std::unique_ptr<int32_t[]> arg_ptr = std::make_unique<int32_t[]>(2 * len + 1);
+
+	arg_ptr[0] = len;
+	memcpy(arg_ptr.get() + 1, value, len * sizeof(int32_t));
+	memcpy(arg_ptr.get() + len + 1, usec, len * sizeof(int32_t));
+
+	return handle_operator->doAction(eAcquireOption, arg_ptr.get());
+}
+
+bool epic_release_internal(long handle)
+{
+	IEpicOperator *handle_operator = reinterpret_cast<IEpicOperator *>(handle);
+
+	if (handle_operator == nullptr)
+		return false;
+
+	return handle_operator->doAction(eRelease, nullptr);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/epic/epicoperator/EpicVideoDecodingOperator.cpp b/epic/epicoperator/EpicVideoDecodingOperator.cpp
new file mode 100644
index 0000000..3ae0c85
--- /dev/null
+++ b/epic/epicoperator/EpicVideoDecodingOperator.cpp
@@ -0,0 +1,29 @@
+#include "EpicVideoDecodingOperator.h"
+
+#include "EpicEnum.h"
+
+namespace epic {
+	EpicVideoDecodingOperator::EpicVideoDecodingOperator() :
+		EpicBaseOperator(30000),
+		mConditionName("video_decoder")
+	{
+	}
+
+	EpicVideoDecodingOperator::~EpicVideoDecodingOperator()
+	{
+	}
+
+	bool EpicVideoDecodingOperator::doAction(int __unused cmd, void __unused *arg)
+	{
+		switch (cmd) {
+		case eAcquire:
+			return mConnector->acquire_conditional(mConditionName);
+		case eRelease:
+			return mConnector->release_conditional(mConditionName);
+		default:
+			return false;
+		}
+
+		return false;
+	}
+}
diff --git a/epic/epicoperator/EpicVideoDecodingOperator.h b/epic/epicoperator/EpicVideoDecodingOperator.h
new file mode 100644
index 0000000..0886e24
--- /dev/null
+++ b/epic/epicoperator/EpicVideoDecodingOperator.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "IEpicOperator.h"
+#include "EpicBaseOperator.h"
+
+namespace epic {
+	class EpicVideoDecodingOperator : public EpicBaseOperator {
+	public:
+		EpicVideoDecodingOperator();
+		virtual ~EpicVideoDecodingOperator() override;
+
+		virtual bool doAction(int cmd, void *arg) override;
+
+	private:
+		std::string mConditionName;
+	};
+}
diff --git a/epic/epicoperator/EpicVideoEncodingOperator.cpp b/epic/epicoperator/EpicVideoEncodingOperator.cpp
new file mode 100644
index 0000000..caf1f87
--- /dev/null
+++ b/epic/epicoperator/EpicVideoEncodingOperator.cpp
@@ -0,0 +1,23 @@
+#include "EpicVideoEncodingOperator.h"
+
+#include "EpicEnum.h"
+
+namespace epic {
+	EpicVideoEncodingOperator::EpicVideoEncodingOperator() :
+		EpicBaseOperator(3),
+		mConditionName("video_encoder")
+	{
+	}
+
+	EpicVideoEncodingOperator::~EpicVideoEncodingOperator()
+	{
+	}
+
+	bool EpicVideoEncodingOperator::doAction(int __unused cmd, void __unused *arg)
+	{
+		if (cmd == eAcquire)
+			return mConnector->acquire_conditional(mConditionName);
+
+		return false;
+	}
+}
diff --git a/epic/epicoperator/EpicVideoEncodingOperator.h b/epic/epicoperator/EpicVideoEncodingOperator.h
new file mode 100644
index 0000000..85ef076
--- /dev/null
+++ b/epic/epicoperator/EpicVideoEncodingOperator.h
@@ -0,0 +1,17 @@
+#pragma once
+
+#include "IEpicOperator.h"
+#include "EpicBaseOperator.h"
+
+namespace epic {
+	class EpicVideoEncodingOperator : public EpicBaseOperator {
+	public:
+		EpicVideoEncodingOperator();
+		virtual ~EpicVideoEncodingOperator() override;
+
+		virtual bool doAction(int cmd, void *arg) override;
+
+	private:
+		std::string mConditionName;
+	};
+}
diff --git a/epic/epicoperator/IEpicOperator.h b/epic/epicoperator/IEpicOperator.h
new file mode 100644
index 0000000..e0f168c
--- /dev/null
+++ b/epic/epicoperator/IEpicOperator.h
@@ -0,0 +1,11 @@
+#pragma once
+
+namespace epic {
+	class IEpicOperator {
+	public:
+		IEpicOperator() = default;
+		virtual ~IEpicOperator() {};
+
+		virtual bool doAction(int cmd, void *arg) = 0;
+	};
+}
diff --git a/epic/epicoperator/OperatorFactory.cpp b/epic/epicoperator/OperatorFactory.cpp
new file mode 100644
index 0000000..a97b285
--- /dev/null
+++ b/epic/epicoperator/OperatorFactory.cpp
@@ -0,0 +1,56 @@
+#include "IEpicOperator.h"
+
+#include "EpicEnum.h"
+#include "EpicCommonOperator.h"
+#include "EpicCommonMultiOperator.h"
+#include "EpicVideoEncodingOperator.h"
+#include "EpicVideoDecodingOperator.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void * createOperator(int operator_id)
+{
+	switch (operator_id) {
+	case eVideoEncoding:
+		return new epic::EpicVideoEncodingOperator();
+	case eVideoDecoding:
+		return new epic::EpicVideoDecodingOperator();
+	default:
+		return nullptr;
+	}
+
+	return nullptr;
+}
+
+void * createScenarioOperator(int operator_id, int scenario_id)
+{
+	switch (operator_id) {
+	case eCommon:
+		return new epic::EpicCommonOperator(scenario_id);
+	default:
+		return nullptr;
+	}
+
+	return nullptr;
+}
+
+void * createScenarioMultiOperator(int operator_id, int *scenario_id_list, int len)
+{
+	if (len == 1)
+		return createScenarioOperator(operator_id, *scenario_id_list);
+
+	switch (operator_id) {
+	case eCommon:
+		return new epic::EpicCommonMultiOperator(scenario_id_list, len);
+	default:
+		return nullptr;
+	}
+
+	return nullptr;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/epic/epicoperator/OperatorFactory.h b/epic/epicoperator/OperatorFactory.h
new file mode 100644
index 0000000..83189b5
--- /dev/null
+++ b/epic/epicoperator/OperatorFactory.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "EpicEnum.h"
+#include "IEpicOperator.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void * createOperator(int operator_id);
+void * createScenarioOperator(int operator_id, int scenario_id);
+void * createScenarioMultiOperator(int operator_id, int scenario_id_list[], int len);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/epic/update-makefiles.sh b/epic/update-makefiles.sh
new file mode 100755
index 0000000..9fb2c04
--- /dev/null
+++ b/epic/update-makefiles.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+options="-r vendor.samsung_slsi.hardware:vendor/samsung_slsi/hardware \
+         -r android.hidl:system/libhidl/transport \
+         -r android.hardware:hardware/interfaces"
+
+outputs="vendor/samsung_slsi/hardware/epic/1.0/default"
+
+# Generate Android.bp for .hal files
+#hidl-gen -Landroidbp $options vendor.samsung_slsi.hardware.epic@1.0;
+
+# Generate Header files for .hal files
+#hidl-gen -L c++-headers -o $outputs $options vendor.samsung_slsi.hardware.epic@1.0;
+
+# Generate CPP files for .hal files
+#hidl-gen -L c++-impl -o $outputs $options vendor.samsung_slsi.hardware.epic@1.0;
+
+# Generate Android.bp for Default IMPL
+#hidl-gen -L androidbp-impl -o $outputs $options vendor.samsung_slsi.hardware.epic@1.0;
+
+hidl-gen -Lhash $options vendor.samsung_slsi.hardware.epic@1.0
diff --git a/libGeoTrans/1.0/Android.mk b/libGeoTrans/1.0/Android.mk
new file mode 100644
index 0000000..5ab0553
--- /dev/null
+++ b/libGeoTrans/1.0/Android.mk
@@ -0,0 +1,15 @@
+LOCAL_PATH := $(call my-dir)
+
+$(warning #############################################)
+$(warning ########       GeoTrans10       #############)
+$(warning #############################################)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := libGeoTrans10
+LOCAL_MODULE_SUFFIX := .so
+LOCAL_MODULE_CLASS := SHARED_LIBRARIES
+LOCAL_SRC_FILES_64 := lib64/libGeoTrans10.so
+LOCAL_SRC_FILES_32 := lib/libGeoTrans10.so
+LOCAL_MULTILIB := both
+LOCAL_SHARED_LIBRARIES := android.hidl.memory@1.0 libc++ libc libcutils libdl libhidlbase libhidlmemory libhidltransport libion liblog libm libutils vendor.samsung_slsi.hardware.geoTransService@1.0
+include $(BUILD_PREBUILT)
diff --git a/libGeoTrans/1.0/geotrans.mk b/libGeoTrans/1.0/geotrans.mk
new file mode 100644
index 0000000..836b02b
--- /dev/null
+++ b/libGeoTrans/1.0/geotrans.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2013 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.
+#
+
+# OFI
+PRODUCT_PACKAGES += \
+	libGeoTrans10
diff --git a/libGeoTrans/1.0/include/geo_trans_interface.h b/libGeoTrans/1.0/include/geo_trans_interface.h
new file mode 100755
index 0000000..6cd491c
--- /dev/null
+++ b/libGeoTrans/1.0/include/geo_trans_interface.h
@@ -0,0 +1,151 @@
+#ifndef GEO_TRANS_INTERFACE_H
+#define GEO_TRANS_INTERFACE_H
+/**
+ * 32 data is allocated for fd of native handle
+ * The maximum possible value of native_handle_create is 1024
+ */
+#define MAX_HANDLE_FD   (32)
+
+/**
+ * @file geo_trans_interface.hpp
+ * @brief geoTrans common API and data structure definition.
+ */
+
+namespace hardware {
+namespace geoTransClient {
+
+/**
+ * @brief struct describes ROI information.
+ */
+struct Rect {
+    int32_t l;
+    int32_t t;
+    int32_t r;
+    int32_t b;
+};
+
+/**
+ * @brief struct holds buffer information.
+ */
+struct BufferData {
+    BufferData() : y(NULL), uv(NULL), fdY(-1), fdUV(-1), width(0), height(0) {
+        fov.l = 0;
+        fov.t = 0;
+        fov.r = 0;
+        fov.b = 0;
+    }
+    unsigned char* y;
+    unsigned char* uv;
+    int fdY;
+    int fdUV;
+    int32_t width;
+    int32_t height;
+    Rect fov;
+};
+
+/**
+ * @brief struct describes grid information for GDC.
+ */
+typedef struct _GDCGrid {
+    int32_t gridX[33][33];
+    int32_t gridY[33][33];
+} GDCGrid;
+
+/**
+ * @brief pixel format.
+ */
+enum {
+    PIXEL_FORMAT_Y_GRAY = 0x0,      // Y only with 8b samples
+    PIXEL_FORMAT_YUV_420_SP = 0x1  // YUV 4:2:0 planar, with 8b Y samples, followed by interleaved V/U plane with 8b 2x2 subsampled chroma samples
+};
+
+/**
+ * @brief target model for GDC.
+ */
+enum {
+    TARGET_GDC_HW = 0x0,
+    TARGET_GDC_C_MODEL = 0x1
+};
+
+  /**
+   * @brief
+   * Initialize geoTrans10 client.
+   * This call attempts to get geoTransService and open Ion client for memory allocation
+   * @return[output] status
+   */
+int init();
+
+  /**
+   * @brief
+   * Deinitialize geoTrans10 client.
+   * This call attempts to close Ion client for memory allocation
+   * @return[output] status
+   */
+int deinit();
+
+  /**
+   * @brief
+   * Run CSC Scaler.
+   * ----------------------------------------------------
+   * CSC Specification
+   * ----------------------------------------------------
+   * Image resolution ragne : Input [16x16] ~ [8192x8192]
+   *                          Output [4x4] ~ [8192x8192]
+   * Input/output format    : 8b YCbCr 420
+   * Scale                  : x1/4 to x8
+   * Alignment              : multiple of 2
+   * ----------------------------------------------------
+   * @param[dst] destination buffer data
+   * @param[src] source buffer data
+   * @param[format] pixel format (0x0 or 0x1)
+   * @return[output] status
+   */
+int runCSC(BufferData& dst, BufferData& src, int format = PIXEL_FORMAT_YUV_420_SP);
+
+  /**
+   * @brief
+   * Run GDC Warper with a GDC grid.
+   * ----------------------------------------------------
+   * GDC Specification
+   * ----------------------------------------------------
+   * Image resolution ragne : [96x64] ~ [8192x6144]
+   * Input/output format    : 8b YCbCr 420
+   * Scale                  : x1 only
+   * Alignment              : multiple of 16
+   * ----------------------------------------------------
+   * @param[dst] destination buffer data
+   * @param[src] source buffer data
+   * @param[grid] 33x33 grid data for (x,y) axis
+   * @param[format] pixel format (0x0 or 0x1)
+   * @param[target] target model (0x0 or 0x1)
+   * @return[output] status
+   */
+int runGDCGrid(BufferData& dst, BufferData& src, GDCGrid& grid, int format = PIXEL_FORMAT_YUV_420_SP, int target = TARGET_GDC_HW);
+
+  /**
+   * @brief
+   * Run GDC Warper with an affine matrix.
+   * It internally call geoTransRunGDCGrid(), so it has the same specification.
+   * @param[dst] destination buffer data
+   * @param[src] source buffer data
+   * @param[affine] 3x2 affine matrix
+   * @param[format] pixel format (0x0 or 0x1)
+   * @param[target] target model (0x0 or 0x1)
+   * @return[output] status
+   */
+int runGDCMatrix(BufferData& dst, BufferData& src, short* affine, int format = PIXEL_FORMAT_YUV_420_SP, int target = TARGET_GDC_HW);
+
+  /**
+   * @brief
+   * Run bicubic SW scaler.
+   * Please note that this call is for a backup processing in case when a HW error occurs
+   * @param[dst] destination buffer data
+   * @param[src] source buffer data
+   * @param[format] pixel format (0x0 or 0x1)
+   * @return[output] status
+   */
+int runInterpBicubic(BufferData& dst, BufferData& src, int format = PIXEL_FORMAT_YUV_420_SP);
+
+} // namespace geoTransClient
+} // namespace hardware
+#endif
diff --git a/libGeoTrans/1.0/lib/libGeoTrans10.so b/libGeoTrans/1.0/lib/libGeoTrans10.so
new file mode 100755
index 0000000..629cc92
--- /dev/null
+++ b/libGeoTrans/1.0/lib/libGeoTrans10.so
Binary files differ
diff --git a/libGeoTrans/1.0/lib64/libGeoTrans10.so b/libGeoTrans/1.0/lib64/libGeoTrans10.so
new file mode 100755
index 0000000..f63e069
--- /dev/null
+++ b/libGeoTrans/1.0/lib64/libGeoTrans10.so
Binary files differ