diff --git a/camera/Android.bp b/camera/Android.bp new file mode 100644 index 0000000000000000000000000000000000000000..61d5bbe6a389d5d02c5027453f2a54d31b7e4fbb --- /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 0000000000000000000000000000000000000000..02e05dc22f7de5af7fca349052fdf72b37454556 --- /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 0628d51d602ce9994c6e3278fdb002ad1d6c1342..fb17c6c7176740344a75d74cfa07fe945b46d014 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 7b787d5369474f934bee2b55252ed993aac84854..8705efe42664b530593f7c079abcf5e65bb5d74b 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}"