diff --git a/BoardConfig.mk b/BoardConfig.mk
index 8f0d16031ef8eab8112d50f92f6518f77b0d5352..6d83f88927b251fa5440f5fba80a0be239daf3e3 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -190,6 +190,8 @@ VENDOR_SECURITY_PATCH := 2024-06-05
# SELinux
include device/qcom/sepolicy_vndr-legacy-um/SEPolicy.mk
BOARD_VENDOR_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/vendor
+SYSTEM_EXT_PUBLIC_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/public
+SYSTEM_EXT_PRIVATE_SEPOLICY_DIRS += $(DEVICE_PATH)/sepolicy/private
# Verified Boot
BOARD_AVB_ENABLE := true
diff --git a/configs/privapp-permissions-fpcam.xml b/configs/privapp-permissions-fpcam.xml
new file mode 100644
index 0000000000000000000000000000000000000000..049ef0e5c1179e0d04be3fb4b29216fb006d7eeb
--- /dev/null
+++ b/configs/privapp-permissions-fpcam.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/device.mk b/device.mk
index 17ad769a2a600a1641f0de245188d431b0da9828..aa9748aa3bedffb42d39efccc351fd9be2bcc6d0 100644
--- a/device.mk
+++ b/device.mk
@@ -128,6 +128,9 @@ PRODUCT_PACKAGES += \
vendor.qti.hardware.camera.device@1.0.vendor \
vendor.qti.hardware.camera.postproc@1.0.vendor
+PRODUCT_PACKAGES += \
+ FairphoneCameraService
+
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 \
@@ -149,10 +152,7 @@ PRODUCT_PACKAGES += \
android.hardware.renderscript@1.0-impl \
init.qti.display_boot.sh \
init.qti.display_boot.rc \
- libdisplayconfig.qti \
libqdMetaData \
- libsdmcore \
- libsdmutils \
libtinyxml \
libvulkan \
memtrack.default \
@@ -194,6 +194,10 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml
+# FPCamera
+PRODUCT_COPY_FILES += \
+ $(LOCAL_PATH)/configs/privapp-permissions-fpcam.xml:$(TARGET_COPY_OUT_SYSTEM)/etc/permissions/privapp-permissions-fpcam.xml
+
# Gatekeeper
PRODUCT_PACKAGES += \
android.hardware.gatekeeper@1.0.vendor
@@ -241,6 +245,7 @@ PRODUCT_PACKAGES += \
init.bt_mac.rc \
init.qcom.rc \
init.qcom.recovery.rc \
+ init.qti.media.rc \
init.qcom.usb.rc \
init.stnfc.rc \
init.target.rc \
@@ -264,17 +269,14 @@ PRODUCT_COPY_FILES += \
$(LOCAL_PATH)/media/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \
$(LOCAL_PATH)/media/media_codecs_performance.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance.xml \
$(LOCAL_PATH)/media/media_codecs_performance_yupik_iot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance_yupik_iot.xml \
- $(LOCAL_PATH)/media/media_codecs_performance_yupik_v0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance_yupik_v0.xml \
$(LOCAL_PATH)/media/media_codecs_performance_yupik_v1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_performance_yupik_v1.xml \
$(LOCAL_PATH)/media/media_codecs_vendor_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_vendor_audio.xml \
$(LOCAL_PATH)/media/media_codecs_yupik_iot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_yupik_iot.xml \
- $(LOCAL_PATH)/media/media_codecs_yupik_v0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_yupik_v0.xml \
$(LOCAL_PATH)/media/media_codecs_yupik_v1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_yupik_v1.xml \
$(LOCAL_PATH)/media/media_profiles.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles.xml \
$(LOCAL_PATH)/media/media_profiles_V1_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_V1_0.xml \
$(LOCAL_PATH)/media/media_profiles_vendor.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_vendor.xml \
$(LOCAL_PATH)/media/media_profiles_yupik_iot.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_yupik_iot.xml \
- $(LOCAL_PATH)/media/media_profiles_yupik_v0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_yupik_v0.xml \
$(LOCAL_PATH)/media/media_profiles_yupik_v1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_profiles_yupik_v1.xml
PRODUCT_COPY_FILES += \
diff --git a/extract-files.sh b/extract-files.sh
index 85b0f2d948c25cf569518c664758fa2438069512..44c6dc74cbc7c32aaf3099512c4c936472b672e2 100755
--- a/extract-files.sh
+++ b/extract-files.sh
@@ -58,9 +58,6 @@ function blob_fixup() {
vendor/etc/libnfc-hal-st.conf)
sed -i 's|STNFC_HAL_LOGLEVEL=.*|STNFC_HAL_LOGLEVEL=0x12|g' "${2}"
;;
- vendor/etc/camera/camxoverridesettings.txt)
- sed -i '$aexposeFullSizeForQCFA=TRUE' "${2}"
- ;;
esac
}
diff --git a/init/Android.bp b/init/Android.bp
index 54acc1361aee12883ba0e2c8d3190726b3617b9f..9bcdf5ff2cb649c72d6061ef8a2ec7455d1553be 100644
--- a/init/Android.bp
+++ b/init/Android.bp
@@ -38,6 +38,13 @@ prebuilt_etc {
recovery: true,
}
+prebuilt_etc {
+ name: "init.qti.media.rc",
+ src: "init.qti.media.rc",
+ sub_dir: "init",
+ vendor: true,
+}
+
prebuilt_etc {
name: "init.target.rc",
src: "init.target.rc",
diff --git a/init/init.qti.media.rc b/init/init.qti.media.rc
new file mode 100644
index 0000000000000000000000000000000000000000..6272b3caeba9b577b9b5749cb4f84ce7bfed927b
--- /dev/null
+++ b/init/init.qti.media.rc
@@ -0,0 +1,54 @@
+#==============================================================================
+# init.qti.media.rc
+#
+# Copyright (c) 2020 Qualcomm Technologies, Inc.
+# All Rights Reserved.
+# Confidential and Proprietary - Qualcomm Technologies, Inc.
+#
+# Copyright (c) 2020, The Linux Foundation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of The Linux Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#===============================================================================
+service qti-media /vendor/bin/init.qti.media.sh
+ class main
+ user media
+ group media
+ disabled
+ oneshot
+ seclabel u:r:vendor_qti_media:s0
+
+on early-init
+ setprop vendor.media.target.qssi ${vendor.sys.media.target.qssi}
+ setprop vendor.media.system.build_codename ${ro.build.version.release_or_codename}
+ start qti-media
+
+on post-fs-data
+ setprop ro.media.xml_variant.codecs ${vendor.media.target_variant}
+ setprop ro.media.xml_variant.codecs_performance ${vendor.media.target_variant}
+ setprop ro.media.xml_variant.profiles ${vendor.media.target_variant}
+
+on property:vendor.netflix.bsp_rev=*
+ setprop ro.netflix.bsp_rev ${vendor.netflix.bsp_rev}
diff --git a/media/media_codecs_performance_yupik_v0.xml b/media/media_codecs_performance_yupik_v0.xml
deleted file mode 100644
index 2c62ee6be7d79e600bdb2ce815380e721eb5095e..0000000000000000000000000000000000000000
--- a/media/media_codecs_performance_yupik_v0.xml
+++ /dev/null
@@ -1,151 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/media/media_codecs_yupik_v0.xml b/media/media_codecs_yupik_v0.xml
deleted file mode 100644
index 99ceba7cbf3d8875d1f3bfb30bd375097ea6fd97..0000000000000000000000000000000000000000
--- a/media/media_codecs_yupik_v0.xml
+++ /dev/null
@@ -1,294 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/media/media_profiles_yupik_v0.xml b/media/media_profiles_yupik_v0.xml
deleted file mode 100644
index 35dd969d73bbecbcc9283b59e0a41be95e2d3fd0..0000000000000000000000000000000000000000
--- a/media/media_profiles_yupik_v0.xml
+++ /dev/null
@@ -1,1814 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/parts/Android.bp b/parts/Android.bp
new file mode 100644
index 0000000000000000000000000000000000000000..7d131ca3780ccd012533856833b84cba82e8e0c8
--- /dev/null
+++ b/parts/Android.bp
@@ -0,0 +1,24 @@
+//
+// Copyright (C) 2023-2024 The LineageOS Project
+//
+// SPDX-License-Identifier: Apache-2.0
+//
+
+android_app {
+ name: "FairphoneCameraService",
+
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ certificate: "platform",
+ platform_apis: true,
+ system_ext_specific: true,
+ privileged: true,
+
+ static_libs: [
+ "org.lineageos.settings.resources",
+ ],
+
+ optimize: {
+ proguard_flags_files: ["proguard.flags"],
+ },
+}
diff --git a/parts/AndroidManifest.xml b/parts/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..0fdf13aa1df2236130f44c13c62b10dcb7ef2b84
--- /dev/null
+++ b/parts/AndroidManifest.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/parts/proguard.flags b/parts/proguard.flags
new file mode 100644
index 0000000000000000000000000000000000000000..2145628447c1c517cc772218a1f8f2a336bfcaff
--- /dev/null
+++ b/parts/proguard.flags
@@ -0,0 +1,3 @@
+-keep class org.lineageos.settings.fpcamera.* {
+ *;
+}
diff --git a/parts/res/values/strings-de.xml b/parts/res/values/strings-de.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f20fd598cbde5e862134c6dc75ebfb09c87e8ce6
--- /dev/null
+++ b/parts/res/values/strings-de.xml
@@ -0,0 +1,9 @@
+
+
+
+ Fairphone Kamera
+ Aktivieren Sie diese Option, um die Fairphone-Kamera-App zu verwenden. Ein Neustart ist erforderlich, damit die Änderungen wirksam werden.
+
\ No newline at end of file
diff --git a/parts/res/values/strings-es.xml b/parts/res/values/strings-es.xml
new file mode 100644
index 0000000000000000000000000000000000000000..69d9d623b1babddd6b9cddedb4014b520fbf3f02
--- /dev/null
+++ b/parts/res/values/strings-es.xml
@@ -0,0 +1,9 @@
+
+
+
+ Cámara Fairphone
+ Habilita esta opción para usar la aplicación de cámara de Fairphone. Es necesario reiniciar para que los cambios surtan efecto.
+
\ No newline at end of file
diff --git a/parts/res/values/strings-fr.xml b/parts/res/values/strings-fr.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f1c16c2ce9c86ca07fbdec54b17ba9a4279f7a07
--- /dev/null
+++ b/parts/res/values/strings-fr.xml
@@ -0,0 +1,9 @@
+
+
+
+ Appareil photo Fairphone
+ Activez cette option pour utiliser l\'application appareil photo de Fairphone. Un redémarrage est requis pour que les modifications prennent effet.
+
diff --git a/parts/res/values/strings-it.xml b/parts/res/values/strings-it.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f012929b9089cbd2116b6c8eef60c7b40217d1d8
--- /dev/null
+++ b/parts/res/values/strings-it.xml
@@ -0,0 +1,9 @@
+
+
+
+ Fotocamera Fairphone
+ Abilita questa opzione per utilizzare l\'app fotocamera di Fairphone. È necessario un riavvio affinché le modifiche abbiano effetto.
+
diff --git a/parts/res/values/strings.xml b/parts/res/values/strings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5bc5b10b53a9723f3263dcaaf5353a3daf5b964c
--- /dev/null
+++ b/parts/res/values/strings.xml
@@ -0,0 +1,9 @@
+
+
+
+ Fairphone Camera
+ Enable this option to use the Fairphone camera app. A reboot is required for changes to take effect.
+
\ No newline at end of file
diff --git a/parts/res/xml/fp_camera_settings.xml b/parts/res/xml/fp_camera_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..3ec65a7f4ed47453e4355bbff928aa062ce168cb
--- /dev/null
+++ b/parts/res/xml/fp_camera_settings.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
diff --git a/parts/src/org/lineageos/settings/BootCompletedReceiver.java b/parts/src/org/lineageos/settings/BootCompletedReceiver.java
new file mode 100644
index 0000000000000000000000000000000000000000..3668216899899e05699d5b8b26932cfa15a77790
--- /dev/null
+++ b/parts/src/org/lineageos/settings/BootCompletedReceiver.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2023-2024 The LineageOS Project
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package org.lineageos.settings;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import org.lineageos.settings.fpcamera.FPCameraUtils;
+
+public class BootCompletedReceiver extends BroadcastReceiver {
+
+ private static final String TAG = "FairphoneCamera";
+
+ @Override
+ public void onReceive(final Context context, Intent intent) {
+ Log.d(TAG, "Received boot completed intent");
+ FPCameraUtils.startService(context);
+ }
+}
diff --git a/parts/src/org/lineageos/settings/fpcamera/FPCameraActivity.java b/parts/src/org/lineageos/settings/fpcamera/FPCameraActivity.java
new file mode 100644
index 0000000000000000000000000000000000000000..51e3504edc454f3b31d0c10c4f0cef2cf8b56896
--- /dev/null
+++ b/parts/src/org/lineageos/settings/fpcamera/FPCameraActivity.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2023-2024 The LineageOS Project
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package org.lineageos.settings.fpcamera;
+
+import android.app.Activity;
+import android.app.Fragment;
+import android.os.Bundle;
+import android.view.MenuItem;
+
+import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
+
+import org.lineageos.settings.R;
+
+public class FPCameraActivity extends CollapsingToolbarBaseActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ getFragmentManager().beginTransaction().replace(R.id.content_frame,
+ new FPCameraFragment(), "fpCamera").commit();
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ if (item.getItemId() == android.R.id.home) {
+ finishAfterTransition();
+ return true;
+ }
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/parts/src/org/lineageos/settings/fpcamera/FPCameraFragment.java b/parts/src/org/lineageos/settings/fpcamera/FPCameraFragment.java
new file mode 100644
index 0000000000000000000000000000000000000000..e12f2d49dfe707402a2eba4ab6870726a286f15b
--- /dev/null
+++ b/parts/src/org/lineageos/settings/fpcamera/FPCameraFragment.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2023-2024 The LineageOS Project
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package org.lineageos.settings.fpcamera;
+
+import android.os.Bundle;
+
+import androidx.preference.Preference;
+import androidx.preference.PreferenceFragment;
+import androidx.preference.SwitchPreference;
+
+import org.lineageos.settings.R;
+
+import java.io.IOException;
+
+public class FPCameraFragment extends PreferenceFragment implements Preference.OnPreferenceChangeListener {
+
+ private static final String PREF_FP_CAMERA = "fp_camera_pref";
+
+ private SwitchPreference mFPCameraPref;
+
+ @Override
+ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
+ addPreferencesFromResource(R.xml.fp_camera_settings);
+
+ mFPCameraPref = findPreference(PREF_FP_CAMERA);
+ mFPCameraPref.setOnPreferenceChangeListener(this);
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ if (preference == mFPCameraPref) {
+ boolean value = (Boolean) newValue;
+ return FPCameraUtils.setApplicationEnabledSetting(getActivity(), value);
+ }
+ return false;
+ }
+
+ @Override
+ public void onStop() {
+ super.onStop();
+ }
+}
diff --git a/parts/src/org/lineageos/settings/fpcamera/FPCameraUtils.java b/parts/src/org/lineageos/settings/fpcamera/FPCameraUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..8cc8caa6374fe8576753dbeada99b8d380f58094
--- /dev/null
+++ b/parts/src/org/lineageos/settings/fpcamera/FPCameraUtils.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2023-2024 The LineageOS Project
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package org.lineageos.settings.fpcamera;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager;
+import android.os.UserHandle;
+import android.util.Log;
+
+import androidx.preference.PreferenceManager;
+
+public class FPCameraUtils {
+
+ private static final String TAG = "FPCameraUtils";
+ private static final String PREF_FIRST_BOOT = "first_boot";
+ private static final String FP_CAMERA_PACKAGE = "com.fp5.camera";
+
+ public static boolean setApplicationEnabledSetting(Context context, boolean enable) {
+ PackageManager pm = context.getPackageManager();
+ try {
+ pm.setApplicationEnabledSetting(FP_CAMERA_PACKAGE,
+ enable ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ PackageManager.DONT_KILL_APP);
+ return true;
+ } catch (Exception e) {
+ Log.e(TAG, "Failed to " + (enable ? "enable" : "disable") + " " + FP_CAMERA_PACKAGE, e);
+ return false;
+ }
+ }
+
+ public static void startService(Context context) {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+
+ if (isFirstBoot(prefs)) {
+ boolean isFPCamDisabled = setApplicationEnabledSetting(context, false);
+ if (isFPCamDisabled) {
+ prefs.edit().putBoolean(PREF_FIRST_BOOT, false).apply();
+ }
+ }
+ }
+
+ private static boolean isFirstBoot(SharedPreferences prefs) {
+ return prefs.getBoolean(PREF_FIRST_BOOT, true);
+ }
+}
diff --git a/proprietary-files.txt b/proprietary-files.txt
index 36ab8fe085d306c6e49c8652fe7ba06dd5c8d874..fa2702990a70dd18df3dc4996f202f3459e2dde3 100644
--- a/proprietary-files.txt
+++ b/proprietary-files.txt
@@ -121,6 +121,8 @@ vendor/lib64/vendor.qti.hardware.bluetooth_sar@1.1.so
vendor/lib64/vendor.qti.hardware.fm@1.0.so
# Camera
+vendor/etc/init/android.hardware.camera.provider@2.4-service_64.rc
+vendor/lib/libcamxexternalformatutils.so
vendor/lib64/hw/camera.qcom.so
vendor/lib64/hw/com.qti.chi.override.so
vendor/lib64/hw/sensors.vl53l1_fp5.so
@@ -243,6 +245,7 @@ vendor/lib64/com.qualcomm.qti.mcx.usecase.extension.so
vendor/lib64/libaidenoiser.so
vendor/lib64/libanc_hdr.so
vendor/lib64/libanc_hdr_adapter_AncSuperNightLite.so
+vendor/lib64/libanc_hdr_adapter_AncSuperNight.so
vendor/lib64/libanc_single_rt_bokeh.so
vendor/lib64/libanc_single_rt_bokeh_rear.so
vendor/lib64/libanc_supervq.so
@@ -263,6 +266,7 @@ vendor/lib64/libcamxswprocessalgo.so
vendor/lib64/libcamxtintlessalgo.so
vendor/lib64/libchilog.so
vendor/lib64/libcom.qti.chinodeutils.so
+vendor/lib64/libdmabufheap.so
vendor/lib64/libfacepose.so
vendor/lib64/libipebpsstriping.so
vendor/lib64/libjpege.so
@@ -422,6 +426,27 @@ vendor/etc/camera/tuningversion_fp5.txt
vendor/firmware/CAMERA_ICP.elf
vendor/firmware/CAMERA_ICP_170.elf
+# Camera (FPCamera)
+-priv-app/FPCamera/FPCamera.apk
+system_ext/etc/public.libraries-tct.txt
+system_ext/lib64/libtctcameraalgo_jni.tct.so
+vendor/lib64/libtctcameraalgo.so
+vendor/lib64/com.tct.cameraalgo.distortion.so
+vendor/lib64/com.tct.cameraalgo.gs.so
+vendor/lib64/com.tct.cameraalgo.hdr.so
+vendor/lib64/com.tct.cameraalgo.hwmfnr.so
+vendor/lib64/com.tct.cameraalgo.mirror.so
+vendor/lib64/com.tct.cameraalgo.morphozoom.so
+vendor/lib64/com.tct.cameraalgo.singlebokeh.so
+vendor/lib64/com.tct.cameraalgo.supernight.so
+vendor/lib64/com.tct.cameraalgo.tcldualbokeh.so
+vendor/lib64/com.tct.cameraalgo.watermark.so
+vendor/lib64/libmorpho_image_refiner.so
+vendor/lib64/libanc_single_bokeh.so
+vendor/lib64/libanc_single_bokeh_rear.so
+vendor/lib64/libtcl_dualcam_bokeh_cap.so
+vendor/lib64/libmorpho_super_resolution.so
+
# CDSP
vendor/bin/cdsprpcd
vendor/etc/init/vendor.qti.cdsprpc-service.rc
@@ -983,28 +1008,21 @@ system_ext/lib/libmmparser_lite.so
system_ext/lib64/libmmosal.so
vendor/bin/hw/vendor.qti.media.c2@1.0-service
vendor/bin/init.qti.media.sh
-vendor/etc/init/init.qti.media.rc
vendor/etc/init/vendor.qti.media.c2@1.0-service.rc
vendor/etc/media/video_system_specs.json
-vendor/etc/media_lahaina/video_system_specs.json
vendor/etc/media_yupik_v1/video_system_specs.json
vendor/etc/seccomp_policy/codec2.vendor.base-arm.policy
vendor/etc/seccomp_policy/codec2.vendor.ext-arm.policy
vendor/etc/vintf/manifest/c2_manifest_vendor.xml
vendor/etc/media_codecs.xml
-vendor/etc/media_codecs_lahaina.xml
-vendor/etc/media_codecs_lahaina_vendor.xml
vendor/etc/media_codecs_performance.xml
-vendor/etc/media_codecs_performance_lahaina.xml
-vendor/etc/media_codecs_performance_lahaina_vendor.xml
vendor/etc/media_codecs_performance_yupik_v1.xml
vendor/etc/media_codecs_vendor_audio.xml
vendor/etc/media_codecs_yupik_v1.xml
vendor/etc/media_profiles.xml
vendor/etc/media_profiles_V1_0.xml
-vendor/etc/media_profiles_lahaina.xml
-vendor/etc/media_profiles_lahaina_vendor.xml
vendor/etc/media_profiles_yupik_v1.xml
+vendor/etc/media_yupik_iot/video_system_specs.json
vendor/etc/video_system_specs.json
vendor/lib/libqc2vppfilter.so
vendor/lib/libqcodec2_base.so
@@ -1014,6 +1032,14 @@ vendor/lib/libqcodec2_hooks.so
vendor/lib/libqcodec2_platform.so
vendor/lib/libqcodec2_utils.so
vendor/lib/libqcodec2_v4l2codec.so
+vendor/lib64/libqc2vppfilter.so
+vendor/lib64/libqcodec2_base.so
+vendor/lib64/libqcodec2_basecodec.so
+vendor/lib64/libqcodec2_core.so
+vendor/lib64/libqcodec2_hooks.so
+vendor/lib64/libqcodec2_platform.so
+vendor/lib64/libqcodec2_utils.so
+vendor/lib64/libqcodec2_v4l2codec.so
vendor/lib64/libmmosal.so
# Native public libraries
diff --git a/sepolicy/private/property_contexts b/sepolicy/private/property_contexts
new file mode 100644
index 0000000000000000000000000000000000000000..8de2edf3abba4a141fff985a39aacd78fa50a8b9
--- /dev/null
+++ b/sepolicy/private/property_contexts
@@ -0,0 +1,4 @@
+# FPCamera
+persist.vendor.tct.camera. u:object_r:vendor_t2m_prop:s0
+vendor.tct.camera. u:object_r:vendor_t2m_prop:s0
+vendor.t2m. u:object_r:vendor_t2m_prop:s0
diff --git a/sepolicy/private/system_app.te b/sepolicy/private/system_app.te
new file mode 100644
index 0000000000000000000000000000000000000000..2624247febe1d61013bbe25c588e67c3dc025c3b
--- /dev/null
+++ b/sepolicy/private/system_app.te
@@ -0,0 +1 @@
+get_prop(system_app, vendor_t2m_prop)
diff --git a/sepolicy/public/property.te b/sepolicy/public/property.te
new file mode 100644
index 0000000000000000000000000000000000000000..168e87eb727043495dede3a16aef8a4ca5979527
--- /dev/null
+++ b/sepolicy/public/property.te
@@ -0,0 +1 @@
+vendor_public_prop(vendor_t2m_prop)
diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te
index e35df15f8ee06d718077ed1bcd9c6852939d74c7..6e2829c6fb7d78b0ea4fb800b899b724135a23d3 100644
--- a/sepolicy/vendor/file.te
+++ b/sepolicy/vendor/file.te
@@ -1,3 +1,4 @@
type fingerprint_data_file, file_type, data_file_type;
+type persist_camera_file, file_type, vendor_persist_type;
type persist_t2m_param_file, file_type, vendor_persist_type;
type vendor_sysfs_emkit, fs_type, sysfs_type;
diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts
index 996657ba48204abf021194108edb3e1bc505e4fa..5fd7e97b4b5c731f46784093c1cd209db0a598ab 100644
--- a/sepolicy/vendor/file_contexts
+++ b/sepolicy/vendor/file_contexts
@@ -3,6 +3,7 @@
# Camera
/dev/stmvl53l1_ranging u:object_r:vl53l1_device:s0
+/mnt/vendor/persist/camera(/.*)? u:object_r:persist_camera_file:s0
/sys/devices/virtual/deviceinfo/device_info/CamNameB u:object_r:vendor_sysfs_camera:s0
/sys/devices/virtual/deviceinfo/device_info/CamNameB2 u:object_r:vendor_sysfs_camera:s0
/sys/devices/virtual/deviceinfo/device_info/CamNameF u:object_r:vendor_sysfs_camera:s0
@@ -17,6 +18,18 @@
/data/vendor/focaltech(/.*)? u:object_r:fingerprint_data_file:s0
/dev/focaltech_fp u:object_r:fingerprint_device:s0
+# FPCamera
+/vendor/lib64/libtctcameraalgo\.so u:object_r:same_process_hal_file:s0
+/vendor/lib64/com\.tct\.cameraalgo\.(.*)\.so u:object_r:same_process_hal_file:s0
+/vendor/lib64/libundistort\.so u:object_r:same_process_hal_file:s0
+/vendor/lib64/libmorpho_image_refiner\.so u:object_r:same_process_hal_file:s0
+/vendor/lib64/libtcl_dualcam_bokeh_cap\.so u:object_r:same_process_hal_file:s0
+/vendor/lib64/libanc_single_bokeh\.so u:object_r:same_process_hal_file:s0
+/vendor/lib64/libanc_single_bokeh_rear\.so u:object_r:same_process_hal_file:s0
+/vendor/lib64/libmorpho_super_resolution\.so u:object_r:same_process_hal_file:s0
+/vendor/lib64/libanc_hdr\.so u:object_r:same_process_hal_file:s0
+/vendor/lib64/vendor.qti.hardware.camera.postproc@1.0\.so u:object_r:same_process_hal_file:s0
+
# MAC (Bluetooth)
/vendor/bin/init\.bt_mac\.sh u:object_r:bt_mac_exec:s0
/mnt/vendor/persist/t2m_param(/.*)? u:object_r:persist_t2m_param_file:s0
diff --git a/sepolicy/vendor/hal_camera_default.te b/sepolicy/vendor/hal_camera_default.te
index d08c1dc0a8780c300f397061d4078be7b62f14de..5cb1f46c6f00db48c649784bee238ead159ed810 100644
--- a/sepolicy/vendor/hal_camera_default.te
+++ b/sepolicy/vendor/hal_camera_default.te
@@ -4,4 +4,10 @@ allow hal_camera_default vendor_xdsp_device:chr_file r_file_perms;
allow hal_camera_default vendor_sysfs_camera:dir r_dir_perms;
allow hal_camera_default vendor_sysfs_camera:file rw_file_perms;
-set_prop(hal_camera_default, vendor_t2m_sys_prop)
+set_prop(hal_camera_default, vendor_t2m_prop)
+
+allow hal_camera_default persist_camera_file:dir rw_dir_perms;
+allow hal_camera_default persist_camera_file:file create_file_perms;
+
+allow hal_camera_default mnt_vendor_file:dir rw_dir_perms;
+allow hal_camera_default mnt_vendor_file:file create_file_perms;
diff --git a/sepolicy/vendor/property.te b/sepolicy/vendor/property.te
deleted file mode 100644
index 3da1f6757a5cdc8a8e34fc889b7af0822711ad1d..0000000000000000000000000000000000000000
--- a/sepolicy/vendor/property.te
+++ /dev/null
@@ -1 +0,0 @@
-vendor_internal_prop(vendor_t2m_sys_prop)
diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts
index cbec373c994534f9f892c8b9560f044755434a2e..e1932b69e2fb6139c140d848f081e8c1f0d59733 100644
--- a/sepolicy/vendor/property_contexts
+++ b/sepolicy/vendor/property_contexts
@@ -1,4 +1 @@
-# Serial Nums
-vendor.t2m.camera_main.sn u:object_r:vendor_t2m_sys_prop:s0
-vendor.t2m.camera_aux.sn u:object_r:vendor_t2m_sys_prop:s0
-vendor.t2m.camera_front.sn u:object_r:vendor_t2m_sys_prop:s0
+persist.vendor.camera.tctrom u:object_r:vendor_camera_prop:s0
diff --git a/system_ext.prop b/system_ext.prop
index 964c383226748e73d89da11a55093f24417982cb..06fd1006d8c42f291c3bc0ebd365dc602f80f924 100644
--- a/system_ext.prop
+++ b/system_ext.prop
@@ -2,6 +2,11 @@
persist.bluetooth.bqr.event_mask=0x8000000E
persist.bluetooth.bqr.min_interval_ms=60000
+# Camera
+persist.vendor.camera.privapp.list=com.fp5.camera,foundation.e.camera
+persist.vendor.camera.tctrom=1
+sys.camera.enable.hsbatch=true
+
# Display
debug.sf.enable_hwc_vds=1
@@ -23,7 +28,6 @@ persist.dbg.vt_avail_ovr=1
persist.dbg.wfc_avail_ovr=1
# Media
-media.settings.xml=/vendor/etc/media_profiles_vendor.xml
media.stagefright.thumbnail.prefer_hw_codecs=true
ro.media.recorder-max-base-layer-fps=60
vendor.mm.enable.qcom_parser=4044018
diff --git a/vendor.prop b/vendor.prop
index b9c98316b1a10d881ee52f0dd71924644fa9f789..84dc887515f5cc39fc66f4a2fff5500e10d1ef86 100644
--- a/vendor.prop
+++ b/vendor.prop
@@ -141,9 +141,13 @@ ro.surface_flinger.wcg_composition_dataspace=143261696
ro.incremental.enable=yes
# Media
+debug.stagefright.c2inputsurface=-1
debug.stagefright.ccodec=4
debug.stagefright.omx_default_rank=0
+# MTE
+arm64.memtag.process.system_server=off
+
# Netflix
ro.netflix.bsp_rev=Q875-32408-1