From f8e46f50224ab79fa52f54976c4967dd0f0bec1f Mon Sep 17 00:00:00 2001 From: kazerine Date: Wed, 12 Aug 2020 00:18:36 +0530 Subject: [PATCH] sm6250-common: Get rid of megvii dependencies in camera.qcom.so Change-Id: I97058c320d06819a468ebe38e2704360e9aa91db Signed-off-by: Arian --- camera/Android.bp | 21 +++++++++++++++++++++ camera/megvii_shim.cpp | 19 +++++++++++++++++++ common.mk | 3 +++ extract-files.sh | 10 ++++++++++ 4 files changed, 53 insertions(+) create mode 100644 camera/Android.bp create mode 100644 camera/megvii_shim.cpp diff --git a/camera/Android.bp b/camera/Android.bp new file mode 100644 index 0000000..61d5bbe --- /dev/null +++ b/camera/Android.bp @@ -0,0 +1,21 @@ +// +// Copyright (C) 2020 The LineageOS 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. + +cc_library_shared { + name: "libshim_megvii", + + proprietary: true, + srcs: ["megvii_shim.cpp"], +} diff --git a/camera/megvii_shim.cpp b/camera/megvii_shim.cpp new file mode 100644 index 0000000..02e05dc --- /dev/null +++ b/camera/megvii_shim.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2020 The LineageOS 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. + */ + +namespace android { + extern "C" void mg_facepp() {} +} diff --git a/common.mk b/common.mk index 0628d51..fb17c6c 100644 --- a/common.mk +++ b/common.mk @@ -53,6 +53,9 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ Snap +PRODUCT_PACKAGES += \ + libshim_megvii + PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.camera.flash-autofocus.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.flash-autofocus.xml \ frameworks/native/data/etc/android.hardware.camera.front.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.front.xml \ diff --git a/extract-files.sh b/extract-files.sh index 7b787d5..8705efe 100755 --- a/extract-files.sh +++ b/extract-files.sh @@ -49,6 +49,16 @@ if [ -z "${SRC}" ]; then SRC="adb" fi +function blob_fixup() { + case "${1}" in + vendor/lib64/hw/camera.qcom.so) + patchelf --remove-needed "libMegviiFacepp-0.5.2.so" "${2}" + patchelf --remove-needed "libmegface.so" "${2}" + patchelf --add-needed "libshim_megvii.so" "${2}" + ;; + esac +} + # Initialize the helper for common device setup_vendor "${DEVICE_COMMON}" "${VENDOR}" "${LINEAGE_ROOT}" true "${CLEAN_VENDOR}"