diff --git a/common.mk b/common.mk index 5d3c5f6..631862c 100644 --- a/common.mk +++ b/common.mk @@ -299,6 +299,13 @@ PRODUCT_COPY_FILES += \ PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/configs/public.libraries.txt:$(TARGET_COPY_OUT_VENDOR)/etc/public.libraries.txt +# Modem switcher +PRODUCT_PACKAGES += \ + ModemConfig + +PRODUCT_COPY_FILES += \ + $(shell find $(LOCAL_PATH)/rootdir/vendor/oem -type f -printf '%p:$(TARGET_COPY_OUT_VENDOR)/oem/%P\n') + # Net PRODUCT_PACKAGES += \ android.system.net.netd@1.1.vendor \ diff --git a/lineage.dependencies b/lineage.dependencies index fe6499b..3670aba 100644 --- a/lineage.dependencies +++ b/lineage.dependencies @@ -2,5 +2,9 @@ { "repository": "android_kernel_sony_sdm845", "target_path": "kernel/sony/sdm845" + }, + { + "repository": "android_hardware_sony_SonyOpenTelephony", + "target_path": "hardware/sony/SonyOpenTelephony" } ] diff --git a/rootdir/etc/fstab.qcom b/rootdir/etc/fstab.qcom index 3899e06..357e50a 100644 --- a/rootdir/etc/fstab.qcom +++ b/rootdir/etc/fstab.qcom @@ -52,4 +52,5 @@ # and fails if it does not find it. /dev/block/bootdevice/by-name/frp /persistent emmc defaults defaults /dev/block/bootdevice/by-name/misc /misc emmc defaults defaults +/vendor/oem /oem none bind nofail /dev/block/zram0 none swap defaults zramsize=1073741824 diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc index d7ac94e..7cc5405 100644 --- a/rootdir/etc/init.qcom.rc +++ b/rootdir/etc/init.qcom.rc @@ -1069,6 +1069,12 @@ service vendor-sensor-sh /vendor/bin/init.qcom.sensors.sh user root oneshot +on property:persist.vendor.somc.cust.modem0=* + setprop persist.somc.cust.modem0 ${persist.vendor.somc.cust.modem0} + +on property:persist.vendor.somc.cust.modem1=* + setprop persist.somc.cust.modem1 ${persist.vendor.somc.cust.modem1} + service qcom-post-boot /vendor/bin/init.qcom.post_boot.sh class late_start user root diff --git a/sepolicy/vendor/file.te b/sepolicy/vendor/file.te index f9ad186..fab1dfe 100644 --- a/sepolicy/vendor/file.te +++ b/sepolicy/vendor/file.te @@ -51,3 +51,4 @@ type qns_data_file, file_type; # Socket type tad_socket, file_type; +type vendor_oem_file, file_type, vendor_file_type; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index b8cd440..39cff67 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -34,6 +34,9 @@ /mnt/idd/socket/idd_co_stream u:object_r:idd_socket:s0 /mnt/idd/startup-prober(/.*)? u:object_r:startupprober_file:s0 +# OEM subdirectory +/vendor/oem(/.*)? u:object_r:vendor_oem_file:s0 + # NFC /dev/pn553 u:object_r:nfc_device:s0 diff --git a/sepolicy/vendor/init.te b/sepolicy/vendor/init.te index dffcd8f..3e6857f 100644 --- a/sepolicy/vendor/init.te +++ b/sepolicy/vendor/init.te @@ -1,3 +1,6 @@ +# Allow init to mount on idd_rca_dir, idd_root_dir, oemfs, qns_file +allow init { idd_rca_dir idd_root_dir oemfs qns_data_file }:dir mounton; + # Allow init to read files in /lta-label r_dir_file(init, lta_label) diff --git a/sepolicy/vendor/modem-switcher.te b/sepolicy/vendor/modem-switcher.te index 6f3c4cd..15dcdc7 100644 --- a/sepolicy/vendor/modem-switcher.te +++ b/sepolicy/vendor/modem-switcher.te @@ -3,6 +3,7 @@ type modem-switcher_exec, exec_type, system_file_type, file_type; init_daemon_domain(modem-switcher) +typeattribute modem-switcher system_executes_vendor_violators; typeattribute modem-switcher system_writes_vendor_properties_violators; # Allow access to the HALs @@ -29,6 +30,9 @@ allow modem-switcher hidl_memory_hwservice:hwservice_manager find; # Allow modem-switcher to read files in /oem r_dir_file(modem-switcher, oemfs) +# Allow modem-switcher to read files in /vendor/oem +r_dir_file(modem-switcher, vendor_oem_file) + # Allow modem-switcher to get cust_system_prop get_prop(modem-switcher, cust_system_prop) diff --git a/sepolicy/vendor/modemconfig_app.te b/sepolicy/vendor/modemconfig_app.te new file mode 100644 index 0000000..24ba439 --- /dev/null +++ b/sepolicy/vendor/modemconfig_app.te @@ -0,0 +1,19 @@ +type modemconfig_app, domain; + +app_domain(modemconfig_app) + +# Allow modemconfig_app to find app_api_service +allow modemconfig_app app_api_service:service_manager find; + +# Allow modemconfig_app to find radio_service +allow modemconfig_app radio_service:service_manager find; + +# Allow modemconfig_app read and write /data/data subdirectory +allow modemconfig_app app_data_file:dir create_dir_perms; +allow modemconfig_app app_data_file:{ file lnk_file } create_file_perms; + +# Allow modemconfig_app read files in /vendor +r_dir_file(modemconfig_app, vendor_file) + +# Allow modemconfig_app to set cust_system_prop +set_prop(modemconfig_app, cust_system_prop) diff --git a/sepolicy/vendor/property_contexts b/sepolicy/vendor/property_contexts index fc770e2..988472d 100644 --- a/sepolicy/vendor/property_contexts +++ b/sepolicy/vendor/property_contexts @@ -10,6 +10,7 @@ vendor.wlan. u:object_r:vendor_wifi_prop:s0 vendor.keyprovd.suntory.prov u:object_r:suntory_prop:s0 persist.somc.cust. u:object_r:cust_system_prop:s0 persist.somc.modemswitcher. u:object_r:sony_modemswitcher_prop:s0 +persist.vendor.somc.cust. u:object_r:cust_system_prop:s0 somc.cust. u:object_r:cust_debug_system_prop:s0 sony.modemswitcher. u:object_r:sony_modemswitcher_prop:s0 ro.semc. u:object_r:exported_default_prop:s0 diff --git a/sepolicy/vendor/seapp_contexts b/sepolicy/vendor/seapp_contexts new file mode 100644 index 0000000..6cca5ae --- /dev/null +++ b/sepolicy/vendor/seapp_contexts @@ -0,0 +1 @@ +user=_app seinfo=platform name=com.sony.opentelephony.modemconfig isPrivApp=true domain=modemconfig_app type=app_data_file diff --git a/sepolicy/vendor/vendor_init.te b/sepolicy/vendor/vendor_init.te index cfcb90f..5f6e0c7 100644 --- a/sepolicy/vendor/vendor_init.te +++ b/sepolicy/vendor/vendor_init.te @@ -18,3 +18,6 @@ allow vendor_init proc_sysctl_autogroup:file w_file_perms; allow vendor_init proc_sysctl_schedboost:file w_file_perms; set_prop(vendor_init, vendor_power_prop) + +# Allow vendor init to set cust_system_prop +set_prop(vendor_init, cust_system_prop)