diff --git a/cat/patches/audio_configuration.patch b/cat/patches/audio_configuration.patch deleted file mode 100644 index 2649edb..0000000 --- a/cat/patches/audio_configuration.patch +++ /dev/null @@ -1,293 +0,0 @@ -diff --git a/services/audiopolicy/config/audio_policy_configuration.xml b/services/audiopolicy/config/audio_policy_configuration.xml -index b28381b32d..218cdf8e8f 100644 ---- a/services/audiopolicy/config/audio_policy_configuration.xml -+++ b/services/audiopolicy/config/audio_policy_configuration.xml -@@ -1,5 +1,8 @@ - -- -+ -- - - - - -- -+ - - - - - -- -+ - -+ Earpiece - Speaker -+ Telephony Tx - Built-In Mic - Built-In Back Mic -+ FM Tuner -+ Telephony Rx - - Speaker - -- -- -+ -+ -+ -+ -+ - -- -- -+ -+ - -- -- -- -- -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - -- -+ -+ -+ -+ - -+ - -- -+ -+ -+ -+ -+ -+ -+ - - -- -+ - - -+ - - - -- -+ - - -- -- -- -- -+ - - -- -+ - - -- -+ -+ -+ -+ - - -- -+ - - -- -+ - - -- -+ - - -- -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - -- -+ - - -- -+ -+ -+ -+ - - -- -+ - - -- -+ - - -- -+ - - - - -- -- -- -- -- -- -- -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ - - - - -- -- -+ -+ - - -- -+ - - -- -- -- -- -- -- -- -+ - - - - -- -+ - -- -- -+ -+ - - - -- -- -- -- -- -- - diff --git a/duoqin/duoqin_f21pro.mk b/duoqin/duoqin_f21pro.mk index 7f7338e..2678347 100644 --- a/duoqin/duoqin_f21pro.mk +++ b/duoqin/duoqin_f21pro.mk @@ -36,7 +36,7 @@ PRODUCT_PACKAGE_OVERLAYS += device/wephone/duoqin/overlay PRODUCT_COPY_FILES += \ device/wephone/duoqin/wephone.rc:vendor/etc/init/wephone.rc \ - device/wephone/duoqin/wephone-boot.sh:vendor/bin/wephone-boot.sh + device/wephone/duoqin/wephone.sh:vendor/bin/wephone.sh PRODUCT_COPY_FILES += \ device/wephone/duoqin/files/mtk-kpd.idc:$(TARGET_COPY_OUT_SYSTEM)/usr/idc/mtk-kpd.idc \ diff --git a/duoqin/patches/launcher3.patch b/duoqin/patches/launcher3.patch new file mode 100644 index 0000000..940ecb7 --- /dev/null +++ b/duoqin/patches/launcher3.patch @@ -0,0 +1,25 @@ +diff --git a/res/layout/search_container_all_apps.xml b/res/layout/search_container_all_apps.xml +index e1646ba43..850d86ccc 100644 +--- a/res/layout/search_container_all_apps.xml ++++ b/res/layout/search_container_all_apps.xml +@@ -34,4 +34,5 @@ + android:singleLine="true" + android:textColor="?android:attr/textColorSecondary" + android:textColorHint="@drawable/all_apps_search_hint" +- android:textSize="16sp" /> +\ No newline at end of file ++ android:textSize="16sp" ++ android:visibility="gone" /> +diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java +index 88a9abaf8..d4a65f05b 100644 +--- a/src/com/android/launcher3/config/FeatureFlags.java ++++ b/src/com/android/launcher3/config/FeatureFlags.java +@@ -52,7 +52,7 @@ public final class FeatureFlags { + * Enable moving the QSB on the 0th screen of the workspace. This is not a configuration feature + * and should be modified at a project level. + */ +- public static final boolean QSB_ON_FIRST_SCREEN = true; ++ public static final boolean QSB_ON_FIRST_SCREEN = false; + + /** + * Feature flag to handle define config changes dynamically instead of killing the process. diff --git a/duoqin/sepolicy/asus.te b/duoqin/sepolicy/asus.te new file mode 100644 index 0000000..8965ab9 --- /dev/null +++ b/duoqin/sepolicy/asus.te @@ -0,0 +1,10 @@ +allow cameraserver phhsu_exec:file rx_file_perms; + +type asus_motor_device, file_type; +allow cameraserver asus_motor_device:chr_file { open read write ioctl }; +allowxperm cameraserver asus_motor_device:chr_file ioctl { 0x4d02 }; + +type vendor_sysfs_graphics, file_type; +allow platform_app vendor_sysfs_graphics:dir r_dir_perms; +allow platform_app vendor_sysfs_graphics:file r_file_perms; + diff --git a/duoqin/sepolicy/board_properties.te b/duoqin/sepolicy/board_properties.te new file mode 100644 index 0000000..4ed75dc --- /dev/null +++ b/duoqin/sepolicy/board_properties.te @@ -0,0 +1,4 @@ +type sysfs_board_properties, fs_type, sysfs_type; + +allow system_server sysfs_board_properties:dir search; +allow system_server sysfs_board_properties:file r_file_perms; diff --git a/duoqin/sepolicy/bootanim.te b/duoqin/sepolicy/bootanim.te new file mode 100644 index 0000000..bba8c50 --- /dev/null +++ b/duoqin/sepolicy/bootanim.te @@ -0,0 +1,3 @@ +#11-14 21:15:02.748 477 477 I auditd : type=1400 audit(0.0:104): avc: denied { search } for comm="BootAnimation" name="dri" dev="tmpfs" ino=1108 scontext=u:r:bootanim:s0 tcontext=u:object_r:gpu_device:s0 tclass=dir permissive=0 +#Seen on some MTK devices +allow bootanim gpu_device:dir r_dir_perms; diff --git a/duoqin/sepolicy/charger.te b/duoqin/sepolicy/charger.te new file mode 100644 index 0000000..cbcb255 --- /dev/null +++ b/duoqin/sepolicy/charger.te @@ -0,0 +1,15 @@ +# Allow charger to write to sysfs_backlight_attr (only for huawei) +attribute sysfs_backlight_attr; +allow charger sysfs_backlight_attr:file rw_file_perms; + +# Allow charger to write to sysfs_led_attr (only for huawei) +# attribute sysfs_led_attr; +# allow charger sysfs_led_attr:file rw_file_perms; + +# Allow charger to read and write to sysfs_power +allow charger sysfs_power:file rw_file_perms; +allow charger sysfs_power:dir r_dir_perms; +allow charger sysfs_power:lnk_file read; + +# The system charger can write powerctl properties +set_prop(charger, powerctl_prop) diff --git a/duoqin/sepolicy/file_contexts b/duoqin/sepolicy/file_contexts index 4b19cc9..220312b 100644 --- a/duoqin/sepolicy/file_contexts +++ b/duoqin/sepolicy/file_contexts @@ -1 +1,22 @@ -/vendor/bin/wephone-boot.sh u:object_r:wephone_exec:s0 +/system/bin/phh-su u:object_r:phhsu_exec:s0 +/system/bin/vndk-detect u:object_r:vndk_detect_exec:s0 +/system/etc/usb_audio_policy_configuration.xml u:object_r:vendor_configs_file:s0 +/system/bin/rw-system.sh u:object_r:phhsu_exec:s0 +/system/bin/phh-on-boot.sh u:object_r:phhsu_exec:s0 +/system/bin/phh-on-data.sh u:object_r:phhsu_exec:s0 +/system/bin/wephone.sh u:object_r:phhsu_exec:s0 +/system/bin/asus-motor u:object_r:phhsu_exec:s0 +/system/bin/xiaomi-touch u:object_r:phhsu_exec:s0 + +/bt_firmware(/.*)? u:object_r:bt_firmware_file:s0 + +/sec_storage(/.*)? u:object_r:teecd_data_file:s0 +/dev/dsm u:object_r:dmd_device:s0 + +/system/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.oppo.compat u:object_r:hal_fingerprint_oppo_compat_exec:s0 +/system/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.oplus.compat u:object_r:hal_fingerprint_oppo_compat_exec:s0 + +/efs u:object_r:efs_file:s0 + +/dev/smcinvoke u:object_r:smcinvoke_device:s0 +/system/bin/hw/android\.hardware\.bluetooth\.audio-service-system u:object_r:hal_audio_sysbta_exec:s0 diff --git a/duoqin/sepolicy/genfs_contexts b/duoqin/sepolicy/genfs_contexts new file mode 100644 index 0000000..56e8950 --- /dev/null +++ b/duoqin/sepolicy/genfs_contexts @@ -0,0 +1 @@ +genfscon sysfs /board_properties u:object_r:sysfs_board_properties:s0 diff --git a/duoqin/sepolicy/hal.te b/duoqin/sepolicy/hal.te new file mode 100644 index 0000000..cb44422 --- /dev/null +++ b/duoqin/sepolicy/hal.te @@ -0,0 +1,10 @@ +type hal_fingerprint_oppo_compat, domain; +hal_client_domain(hal_fingerprint_oppo_compat, hal_fingerprint) +hal_server_domain(hal_fingerprint_oppo_compat, hal_fingerprint) + +type hal_fingerprint_oppo_compat_exec, exec_type, vendor_file_type, file_type; +init_daemon_domain(hal_fingerprint_oppo_compat) + + +type hal_fingerprint_oppo, domain; +allow hal_fingerprint_oppo vendor_default_prop:property_service { set }; diff --git a/duoqin/sepolicy/hal_aguiledbelt_hwservice.te b/duoqin/sepolicy/hal_aguiledbelt_hwservice.te new file mode 100644 index 0000000..7058096 --- /dev/null +++ b/duoqin/sepolicy/hal_aguiledbelt_hwservice.te @@ -0,0 +1,4 @@ +type hal_aguiledbelt_hwservice, hwservice_manager_type; +allow system_app hal_aguiledbelt_hwservice:hwservice_manager { find }; +type hal_aguiledbelt, domain; +allow system_app hal_aguiledbelt:binder { call }; diff --git a/duoqin/sepolicy/hal_audio_sysbta.te b/duoqin/sepolicy/hal_audio_sysbta.te new file mode 100644 index 0000000..d871ed3 --- /dev/null +++ b/duoqin/sepolicy/hal_audio_sysbta.te @@ -0,0 +1,10 @@ +type hal_audio_sysbta, domain, coredomain; +hal_server_domain(hal_audio_sysbta, hal_audio) + +type hal_audio_sysbta_exec, exec_type, system_file_type, file_type; +init_daemon_domain(hal_audio_sysbta) + +hal_client_domain(hal_audio_sysbta, hal_allocator) + +# allow audioserver to call hal_audio dump with its own fd to retrieve status +allow hal_audio_sysbta audioserver:fifo_file write; diff --git a/duoqin/sepolicy/hardware_overlay.te b/duoqin/sepolicy/hardware_overlay.te new file mode 100644 index 0000000..d3bb487 --- /dev/null +++ b/duoqin/sepolicy/hardware_overlay.te @@ -0,0 +1 @@ +allow priv_app overlay_service:service_manager find; diff --git a/duoqin/sepolicy/hostapd.te b/duoqin/sepolicy/hostapd.te new file mode 100644 index 0000000..fd37b61 --- /dev/null +++ b/duoqin/sepolicy/hostapd.te @@ -0,0 +1,4 @@ +type hostapd, domain; + +allow hostapd wifi_data_file:dir create_dir_perms; +allow hostapd wifi_data_file:file create_file_perms; diff --git a/duoqin/sepolicy/huawei.te b/duoqin/sepolicy/huawei.te new file mode 100644 index 0000000..2988ed6 --- /dev/null +++ b/duoqin/sepolicy/huawei.te @@ -0,0 +1,37 @@ +allow ueventd proc:file r_file_perms; +permissive ueventd; + +type teecd_data_file, file_type; +type dmd_device, file_type; +allow hal_fingerprint_server dmd_device:chr_file rw_file_perms; +allow hal_fingerprint_server sysfs:file rw_file_perms; +allow tee hal_fingerprint_default:process { getattr }; +allow tee teecd_data_file:dir { search read write create getattr add_name open }; +allow tee teecd_data_file:file { read write create getattr open }; +allow tee system_data_file:dir { getattr }; + +type oeminfo_nvm, domain; +type oeminfo_nvm_device, file_type; +allowxperm oeminfo_nvm oeminfo_nvm_device:blk_file ioctl { 0x1260 }; + +allow charger rootfs:file { ioctl read getattr lock map execute entrypoint open }; + +# This is use exclusively for init to relabel /dev/selinux from tmpfs to device +allow kernel tmpfs:{ dir file } relabelfrom; +allow kernel device:{ dir file } relabelto; + +# system/core/init/mount_handler.cpp likes to browse all /sys/block/xxx, so let it do so... +type sys_block_sdd, file_type; +allow init { sysfs sys_block_sdd }:dir r_dir_perms; +allow init { sysfs sys_block_sdd }:file r_file_perms; +allow init { sysfs sys_block_sdd }:lnk_file read; + +allowxperm vendor_init { teecd_data_file }:dir ioctl { + FS_IOC_GET_ENCRYPTION_POLICY + FS_IOC_SET_ENCRYPTION_POLICY +}; + +# Fixes boot issue in EMUI 9 P20 lite +type sys_block_mmcblk0, file_type; +allow init sys_block_mmcblk0:lnk_file read; +allow init sysfs_zram:lnk_file read; diff --git a/duoqin/sepolicy/init.te b/duoqin/sepolicy/init.te new file mode 100644 index 0000000..42f5bf5 --- /dev/null +++ b/duoqin/sepolicy/init.te @@ -0,0 +1,13 @@ +#This is in Android 8.0, but not 8.1 +domain_trans(init, rootfs, adbd) + +#This is used on Huawei devices to f2fs data partition +allow init userdata_block_device:blk_file relabelto; +allow init userdata_block_device:lnk_file relabelto; + +allow vendor_init vendor_init:capability { sys_module }; + +allow init system_file:lnk_file create_file_perms; + +#fix adb in some cases +allow init adbd_exec:lnk_file read; diff --git a/duoqin/sepolicy/keymaster.te b/duoqin/sepolicy/keymaster.te new file mode 100644 index 0000000..8d98211 --- /dev/null +++ b/duoqin/sepolicy/keymaster.te @@ -0,0 +1,8 @@ +#Access to fake keymaster SPL/Android version props +get_prop(hal_keymaster, default_prop); +get_prop(tee, default_prop); + +get_prop(hal_keymaster, system_prop); + +get_prop(hal_gatekeeper, system_prop); + diff --git a/duoqin/sepolicy/keystore.te b/duoqin/sepolicy/keystore.te new file mode 100644 index 0000000..0ae4112 --- /dev/null +++ b/duoqin/sepolicy/keystore.te @@ -0,0 +1,3 @@ +allow keystore domain:process getattr; +allow keystore domain:dir r_dir_perms; +allow keystore domain:file r_file_perms; diff --git a/duoqin/sepolicy/lenovo.te b/duoqin/sepolicy/lenovo.te new file mode 100644 index 0000000..19e3314 --- /dev/null +++ b/duoqin/sepolicy/lenovo.te @@ -0,0 +1,4 @@ +type sysfs_tp, file_type; + +#Allow treble_app access to /sys/devices/virtual/touch/tp_dev/gesture_on +allow system_app sysfs_tp:file rw_file_perms; diff --git a/duoqin/sepolicy/lmkd.te b/duoqin/sepolicy/lmkd.te new file mode 100644 index 0000000..46e1a61 --- /dev/null +++ b/duoqin/sepolicy/lmkd.te @@ -0,0 +1 @@ +allow lmkd self:capability sys_ptrace; diff --git a/duoqin/sepolicy/mediatek.te b/duoqin/sepolicy/mediatek.te new file mode 100644 index 0000000..0344d0f --- /dev/null +++ b/duoqin/sepolicy/mediatek.te @@ -0,0 +1,29 @@ +type hal_graphics_allocator_default, domain; +type proc_ged, file_type; +allowxperm domain proc_ged:file ioctl { 0x6700-0x67ff }; + +allow init mnt_product_file:dir mounton; + +type mtk_hal_audio, domain; +typeattribute mtk_hal_audio hal_broadcastradio_client; + +type mtk_hal_power, domain; +allow mtk_hal_power system_data_root_file:file create_file_perms; +allow zygote ashmem_device:chr_file execute; + +attribute hal_mms_server; +binder_call({appdomain -isolated_app}, hal_mms_server) +binder_call(hal_mms_server, {appdomain -isolated_app}) + +type mtk_hal_mms_hwservice, hwservice_manager_type; +allow { appdomain -isolated_app } mtk_hal_mms_hwservice:hwservice_manager find; + +#denied { read } for comm="tkuinit" name="u:object_r:default_prop:s0" dev="tmpfs" ino=2029 scontext=u:r:tkcore:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=1 +#denied { open } for comm="tkuinit" path="/dev/__properties__/u:object_r:default_prop:s0" dev="tmpfs" ino=2029 scontext=u:r:tkcore:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=1 +#denied { getattr } for comm="tkuinit" path="/dev/__properties__/u:object_r:default_prop:s0" dev="tmpfs" ino=2029 scontext=u:r:tkcore:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=1 + +type tkcore, domain; +permissive tkcore; + +allow platform_app sysfs_leds:dir r_dir_perms; +allow platform_app sysfs_leds:file r_file_perms; diff --git a/duoqin/sepolicy/nubia.te b/duoqin/sepolicy/nubia.te new file mode 100644 index 0000000..42ddf93 --- /dev/null +++ b/duoqin/sepolicy/nubia.te @@ -0,0 +1,4 @@ +# Shoulder buttons/triggers +type sensitivity_sysfs, file_type; +allow shell sensitivity_sysfs:file rw_file_perms; +allow system_app sensitivity_sysfs:file rw_file_perms; diff --git a/duoqin/sepolicy/oppo.te b/duoqin/sepolicy/oppo.te new file mode 100644 index 0000000..e43887c --- /dev/null +++ b/duoqin/sepolicy/oppo.te @@ -0,0 +1,10 @@ +type sysfs_usb_supply, file_type; + +allow system_app sysfs_usb_supply:file rw_file_perms; + +type hal_fingerprint_oplus, domain; +allow hal_fingerprint_oplus vendor_default_prop:property_service set; + +get_prop(hal_fingerprint_oplus, default_prop); +get_prop(system_server, vendor_default_prop); + diff --git a/duoqin/sepolicy/phh.te b/duoqin/sepolicy/phh.te new file mode 100644 index 0000000..a068156 --- /dev/null +++ b/duoqin/sepolicy/phh.te @@ -0,0 +1,17 @@ +type phhota_dev, dev_type; +typeattribute phhota_dev mlstrustedobject; + +allow phhsu_daemon phhota_dev:blk_file rw_file_perms; +allow system_app phhota_dev:blk_file rw_file_perms; +allow kernel phhsu_daemon:fd use; + +allow phhsu_daemon gsi_data_file:file ioctl; +allowxperm phhsu_daemon gsi_data_file:file ioctl { 0x660b }; + +allow phhsu_daemon loop_device:blk_file ioctl; +allowxperm phhsu_daemon loop_device:blk_file ioctl { 0x4c00 }; + +allow phhsu_daemon userdata_block_device:blk_file ioctl; +allowxperm phhsu_daemon userdata_block_device:blk_file ioctl { 0x1278 0x127a }; + +allow kernel gsi_data_file:file rw_file_perms; diff --git a/duoqin/sepolicy/property_contexts b/duoqin/sepolicy/property_contexts new file mode 100644 index 0000000..185a08b --- /dev/null +++ b/duoqin/sepolicy/property_contexts @@ -0,0 +1,2 @@ +persist.sys.sf.hs_mode u:object_r:sf_hs_mode_prop:s0 +hwc.exynos.vsync_mode u:object_r:vendor_hwc_prop:s0 diff --git a/duoqin/sepolicy/qcrilam_app.te b/duoqin/sepolicy/qcrilam_app.te new file mode 100644 index 0000000..2b8e76e --- /dev/null +++ b/duoqin/sepolicy/qcrilam_app.te @@ -0,0 +1,22 @@ +type qcrilam_app, domain; + +app_domain(qcrilam_app) + +# Needed to get access to /data/data/me.phh.qcrilam +# Only getattr and search are requested since qcrilam does not write to its own directory +# /data/data/me.phh.qcrilam only has two empty subdirs +dontaudit qcrilam_app app_data_file:dir { getattr search }; + +# Access services that should be available to all apps +allow qcrilam_app app_api_service:service_manager find; + +# Find media.audio_flinger +allow qcrilam_app audioserver_service:service_manager find; +# Find isub +allow qcrilam_app radio_service:service_manager find; + +# Find the vendor.qti.hardware.radio.am::IQcRilAudio HIDL service +# And grant binder access to the host (`rild`) +hal_client_domain(qcrilam_app, hal_telephony) + +allow qcrilam_app cgroup:file w_file_perms; diff --git a/duoqin/sepolicy/qualcomm.te b/duoqin/sepolicy/qualcomm.te new file mode 100644 index 0000000..a1ddd5b --- /dev/null +++ b/duoqin/sepolicy/qualcomm.te @@ -0,0 +1,32 @@ +type bt_firmware_file, file_type; +type rild, domain; + +#me.phh.treble.qti.audio is system-signed +allow system_app hal_telephony_hwservice:hwservice_manager { find }; +allow { rild system_app } { rild system_app }:binder { call transfer }; + +#Pixel 1 +type vnd_qcril_audio_hwservice, hwservice_manager_type; +allow system_app vnd_qcril_audio_hwservice:hwservice_manager { find }; + +#Pixel 2 +type vnd_qcrilhook_hwservice, hwservice_manager_type; +allow system_app vnd_qcrilhook_hwservice:hwservice_manager { find }; + +#OP6 +allow system_app hal_telephony_hwservice:hwservice_manager { find }; + +# cf https://github.com/phhusson/treble_experimentations/issues/131 +# SELinux : avc: denied { add } for interface=android.hardware.tetheroffload.control::IOffloadControl pid=15220 scontext=u:r:ipacm:s0 tcontext=u:object_r:hal_tetheroffload_hwservice:s0 tclass=hwservice_manager permissive=0 +type ipacm, hwservice_manager_type; +allow ipacm hal_tetheroffload_hwservice:hwservice_manager { add }; + +type rpmb_device, file_type; +allow tee rpmb_device:blk_file rw_file_perms; +allowxperm tee rpmb_device:blk_file ioctl { 0xb300-0xbfff }; + +attribute smcinvoke_device_29_0; +type smcinvoke_device, dev_type; +typeattribute smcinvoke_device smcinvoke_device_29_0; + +get_prop(rild, default_prop); diff --git a/duoqin/sepolicy/samsung.te b/duoqin/sepolicy/samsung.te new file mode 100644 index 0000000..7dee392 --- /dev/null +++ b/duoqin/sepolicy/samsung.te @@ -0,0 +1,22 @@ +type boot_prop, property_type; + +set_prop(system_server, boot_prop); + +type hal_graphics_composer_default, domain; + +type sf_hs_mode_prop, property_type; + +get_prop(hal_graphics_composer_default, sf_hs_mode_prop); + +type vendor_hwc_prop, property_type; + +get_prop(hal_graphics_composer_default, vendor_hwc_prop); + +type sysfs_vnswap, file_type; +allow init sysfs_vnswap:{file lnk_file } r_file_perms; + +allow kernel { mac_perms_file hwservice_contexts_file property_contexts_file service_contexts_file seapp_contexts_file file_contexts_file }:file relabelto; +allow kernel tmpfs:file relabelfrom; + +type sysfs_ski_display_writable, file_type; +allow platform_app sysfs_ski_display_writable:file r_file_perms; diff --git a/duoqin/sepolicy/seapp_contexts b/duoqin/sepolicy/seapp_contexts new file mode 100644 index 0000000..3a704a6 --- /dev/null +++ b/duoqin/sepolicy/seapp_contexts @@ -0,0 +1 @@ +user=_app seinfo=platform name=me.phh.qcrilam domain=qcrilam_app type=app_data_file diff --git a/duoqin/sepolicy/service.te b/duoqin/sepolicy/service.te new file mode 100644 index 0000000..a9120f9 --- /dev/null +++ b/duoqin/sepolicy/service.te @@ -0,0 +1 @@ +type qcrilam_service, service_manager_type; diff --git a/duoqin/sepolicy/service_contexts b/duoqin/sepolicy/service_contexts new file mode 100644 index 0000000..a390e3f --- /dev/null +++ b/duoqin/sepolicy/service_contexts @@ -0,0 +1,16 @@ +qti.ims.ext u:object_r:radio_service:s0 +# SPRD IMS +ims_ex u:object_r:radio_service:s0 +ims_ut_ex u:object_r:radio_service:s0 +ims_doze_manager u:object_r:radio_service:s0 +irit u:object_r:radio_service:s0 + +# MTK IMS +mwis u:object_r:radio_service:s0 +mtkIms u:object_r:radio_service:s0 + +# Audio AIDL interface +android.hardware.bluetooth.audio.IBluetoothAudioProviderFactory/sysbta u:object_r:hal_audio_service:s0 + +# QcRilAm +me.phh.qcrilam u:object_r:qcrilam_service:s0 diff --git a/duoqin/sepolicy/su.te b/duoqin/sepolicy/su.te new file mode 100644 index 0000000..f8829cd --- /dev/null +++ b/duoqin/sepolicy/su.te @@ -0,0 +1,151 @@ +type phhsu_daemon, domain, mlstrustedsubject; +type phhsu_exec, exec_type, file_type; +type phhsu_daemon_tmpfs, file_type; + +typeattribute phhsu_daemon coredomain; +permissive phhsu_daemon; + +tmpfs_domain(phhsu_daemon); +domain_auto_trans(init, phhsu_exec, phhsu_daemon); +file_type_auto_trans(phhsu_daemon, device, phhsu_daemon); + +allow { appdomain shell } phhsu_daemon:unix_stream_socket { connectto write read }; +allow { appdomain shell } phhsu_daemon:sock_file { write read }; +allow { appdomain shell } phhsu_exec:file { getattr read open execute execute_no_trans }; + +create_pty(shell) +allowxperm shell devpts:chr_file ioctl { TCSETSF TCGETS unpriv_tty_ioctls }; +allowxperm { phhsu_daemon untrusted_app untrusted_app_27 } untrusted_app_all_devpts:chr_file ioctl { TCSETSF TCGETS unpriv_tty_ioctls }; + +allow servicemanager phhsu_daemon:dir { search read }; +allow servicemanager phhsu_daemon:file { open read }; +allow servicemanager phhsu_daemon:process { getattr }; +allow servicemanager phhsu_daemon:binder { call transfer }; + +typeattribute phhsu_daemon mlstrustedobject; +typeattribute phhsu_daemon mlstrustedsubject; + +allow shell su_exec:file getattr; +typeattribute su mlstrustedsubject; + +allow phhsu_daemon { system_api_service app_api_service system_server_service }:service_manager find; + +allow system_server phhsu_daemon:fifo_file { read write getattr }; +allow system_server phhsu_daemon:fd use; +allow system_server phhsu_daemon:binder { call transfer }; +allow system_server shell_devpts:chr_file { read write }; + +# Add su to various domains +net_domain(phhsu_daemon) + +hwbinder_use(phhsu_daemon) + +allow domain untrusted_app_all_devpts:chr_file { getattr read write }; +allow phhsu_daemon untrusted_app_all_devpts:chr_file { getattr read write open ioctl }; +allow phhsu_daemon untrusted_app_all:fifo_file { getattr read write open ioctl }; +allow phhsu_daemon zygote_exec:file { execute read open execute_no_trans getattr }; + +allow appdomain phhsu_daemon:dir { search }; + +allow phhsu_daemon self:global_capability_class_set { sys_resource sys_ptrace }; + +allow phhsu_daemon self:dir rw_dir_perms; +allow phhsu_daemon self:file { rwx_file_perms create rename setattr unlink }; +allow phhsu_daemon self:lnk_file { r_file_perms execmod }; + +allow phhsu_daemon adbd_exec:file { getattr read }; +allow phhsu_daemon { rootfs same_process_hal_file system_file tmpfs }:file { mounton getattr }; +allow phhsu_daemon self:capability { sys_admin chown setuid setgid net_raw dac_override dac_read_search kill fowner mknod }; +allow phhsu_daemon self:capability2 { syslog }; +allow phhsu_daemon shell_exec:file rx_file_perms; +allow phhsu_daemon system_file:file { rx_file_perms entrypoint }; +allow phhsu_daemon kmsg_device:chr_file { ioctl w_file_perms }; +allow phhsu_daemon toolbox_exec:file rx_file_perms; +allow phhsu_daemon system_block_device:{ lnk_file file } r_file_perms; + +allow { phhsu_daemon shell } domain:dir rw_dir_perms; +allow { phhsu_daemon shell } domain:file rw_file_perms; +allow { phhsu_daemon shell } domain:lnk_file rw_file_perms; +allow { phhsu_daemon shell } rootfs:file { rwx_file_perms create rename setattr unlink }; +allow { phhsu_daemon shell } rootfs:dir rw_dir_perms; +allow phhsu_daemon asec_apk_file:dir rw_dir_perms; + +allow phhsu_daemon shell_devpts:chr_file rw_file_perms; + +allow phhsu_daemon app_data_file:dir rw_dir_perms; +allow phhsu_daemon app_data_file:file { rwx_file_perms create rename setattr unlink }; +allow phhsu_daemon dalvikcache_data_file:dir rw_dir_perms; +allow phhsu_daemon dalvikcache_data_file:file { rwx_file_perms create rename setattr unlink }; +allow phhsu_daemon dalvikcache_data_file:lnk_file { r_file_perms execmod }; +allow phhsu_daemon system_data_file:file { rwx_file_perms create rename setattr unlink }; +allow phhsu_daemon system_data_file:dir rw_dir_perms; +allow phhsu_daemon system_data_file:file { rwx_file_perms create rename setattr unlink }; +allow phhsu_daemon system_file:dir rw_dir_perms; +allow phhsu_daemon system_file:file { rwx_file_perms create rename setattr unlink }; +allow phhsu_daemon init:unix_stream_socket { connectto }; +allow phhsu_daemon self:process { ptrace setexec execmem setfscreate }; +allow phhsu_daemon app_data_file:file { rwx_file_perms create rename setattr unlink }; +allow phhsu_daemon app_data_file:dir rw_dir_perms; +allow phhsu_daemon ashmem_device:chr_file { execute }; +allow phhsu_daemon dex2oat_exec:file rx_file_perms; + + +allow phhsu_daemon phhsu_daemon_tmpfs:file rwx_file_perms; + +allow phhsu_daemon { proc_type dev_type exec_type file_type sysfs_type fs_type phhsu_daemon }:file { rwx_file_perms create mounton setattr getattr relabelto relabelfrom unlink rename }; +allow phhsu_daemon { proc_type dev_type exec_type file_type sysfs_type fs_type phhsu_daemon }:lnk_file { rw_file_perms create mounton setattr getattr relabelto relabelfrom unlink rename}; +allow phhsu_daemon { proc_type dev_type exec_type file_type sysfs_type fs_type phhsu_daemon }:dir { rw_dir_perms create mounton setattr getattr relabelto relabelfrom unlink rename}; +allow phhsu_daemon { proc_type dev_type exec_type file_type sysfs_type fs_type phhsu_daemon }:chr_file { rwx_file_perms unlink rename ioctl}; +allow phhsu_daemon { proc_type dev_type exec_type file_type sysfs_type fs_type phhsu_daemon }:blk_file { rw_file_perms create unlink rename ioctl}; + +allow phhsu_daemon device:file rwx_file_perms; +allow phhsu_daemon device:dir rw_dir_perms; + +allow phhsu_daemon domain:process { ptrace signal signull getattr }; +allow phhsu_daemon selinuxfs:file rwx_file_perms; +allow domain phhsu_daemon:process { sigchld }; +allow phhsu_daemon domain:binder { call transfer }; +allow phhsu_daemon kernel:system { syslog_read syslog_mod }; +allow phhsu_daemon kernel:security { setenforce compute_av }; +allow phhsu_daemon domain:unix_stream_socket { getattr }; + +allow phhsu_daemon logdr_socket:sock_file write; +allow phhsu_daemon logd:unix_stream_socket connectto; + +allow phhsu_daemon property_type:property_service { set }; +allow phhsu_daemon property_socket:sock_file { write }; +allow phhsu_daemon property_type:file rw_file_perms; +allow phhsu_daemon { hwservicemanager hwservice_manager_type }:hwservice_manager { list add find }; +allow phhsu_daemon domain:unix_dgram_socket rw_socket_perms; + +allow phhsu_daemon tombstoned_intercept_socket:sock_file { write }; +allow phhsu_daemon tombstoned:unix_stream_socket { connectto }; + +allow phhsu_daemon { property_data_file data_file_type tmpfs }:file create_file_perms; +allow phhsu_daemon { property_data_file data_file_type tmpfs }:dir create_dir_perms; + +allow phhsu_daemon { tmpfs fs_type }:filesystem { mount remount unmount associate }; + +allow phhsu_daemon phhsu_daemon:file relabelfrom; + +allow phhsu_daemon properties_device:dir { map }; +allow phhsu_daemon { tmpfs }:dir { mounton }; +allow phhsu_daemon { file_type shell_data_file system_file}:file { relabelto relabelfrom} ; + +allow phhsu_daemon domain:fd { use }; +allow phhsu_daemon domain:unix_stream_socket { connectto ioctl getattr getopt read write shutdown }; +allow phhsu_daemon self:netlink_kobject_uevent_socket create_socket_perms; +allow phhsu_daemon self:{ netlink_tcpdiag_socket } { create_socket_perms nlmsg_write nlmsg_read }; +allow phhsu_daemon self:{ netlink_selinux_socket } { create_socket_perms }; + +allow phhsu_daemon file_type:file create_file_perms; +allow phhsu_daemon file_type:dir create_dir_perms; + +allow phhsu_daemon domain:process { transition }; + + +# 05-09 00:05:30.149 18450 18450 W lprename: type=1400 audit(0.0:40923): avc: denied { ioctl } for path="/dev/block/sda25" dev="tmpfs" ino=19441 ioctlcmd=0x1278 scontext=u:r:phhsu_daemon:s0 tcontext=u:object_r:super_block_device:s0 tclass=blk_file permissive=0 +# 06-06 12:59:53.775 30150 30150 I auditd : type=1400 audit(0.0:35585): avc: denied { ioctl } for comm="blockdev" path="/dev/block/dm-3" dev="tmpfs" ino=12687 ioctlcmd=0x125d scontext=u:r:phhsu_daemon:s0 tcontext=u:object_r:dm_device:s0 tclass=blk_file permissive=0 + +allowxperm phhsu_daemon { file_type block_device }:blk_file ioctl { 0-0xffff }; +allowxperm phhsu_daemon { system_block_device super_block_device dm_device }:blk_file ioctl { 0x1278-0x127a 0x125d }; diff --git a/duoqin/sepolicy/treble_app.te b/duoqin/sepolicy/treble_app.te new file mode 100644 index 0000000..2afdd24 --- /dev/null +++ b/duoqin/sepolicy/treble_app.te @@ -0,0 +1,45 @@ +allow system_app hal_wifi_hostapd_hwservice:hwservice_manager { add find }; +allow system_app hidl_base_hwservice:hwservice_manager { add }; +allow system_app wifi_data_file:dir create_dir_perms; +allow system_app wifi_data_file:file create_file_perms; + +allow system_app sysfs_batteryinfo:file rw_file_perms; + +type vendor_camera_prop, property_type; +set_prop(system_app, vendor_camera_prop); +type camera_prop, property_type; +set_prop(system_app, camera_prop); + +type hal_ext_fingerprint_hwservice, hwservice_manager_type; +allow system_app hal_ext_fingerprint_hwservice:hwservice_manager { find }; +type hal_fingerprint_default, domain; +allow system_app hal_fingerprint_default:binder { call }; +allow system_app sysfs_power:dir r_dir_perms; +allow system_app sysfs_power:file rw_file_perms; +allow system_app sysfs_power:lnk_file read; + +type default_hisi_hwservice, hwservice_manager_type; +allow system_app default_hisi_hwservice:hwservice_manager { find }; + +type hal_tp_default, domain; +allow system_app hal_tp_default:binder { call }; + +#cam2api +allow system_app vendor_default_prop:property_service { set }; + +set_prop(system_app, default_prop); +#set_prop(system_app, exported3_default_prop); +set_prop(system_app, telephony_config_prop); + +type mtk_hal_rild_hwservice, hwservice_manager_type; +allow system_app mtk_hal_rild_hwservice:hwservice_manager { find}; + +type mtk_vilte_support_prop, property_type; +allow system_app mtk_vilte_support_prop:property_service set; + +type hal_gesturewake_hwservice, hwservice_manager_type; +type hal_gesturewake_default, domain; +allow system_app hal_gesturewake_hwservice:hwservice_manager { find }; +allow system_app hal_gesturewake_default:binder { call transfer }; +allow hal_gesturewake_default system_app:binder { call transfer }; + diff --git a/duoqin/sepolicy/vndk_detect.te b/duoqin/sepolicy/vndk_detect.te new file mode 100644 index 0000000..797094a --- /dev/null +++ b/duoqin/sepolicy/vndk_detect.te @@ -0,0 +1,27 @@ +type vndk_detect, coredomain, domain; +type vndk_detect_exec, exec_type, file_type; + +init_daemon_domain(vndk_detect); +allow vndk_detect sepolicy_file:file r_file_perms; +set_prop(vndk_detect,system_prop); +set_prop(vndk_detect,debug_prop); + +allow vndk_detect shell_exec:file rx_file_perms; +allow vndk_detect toolbox_exec:file rx_file_perms; +#/system/bin/grep +allow vndk_detect system_file:file rx_file_perms; + +#mount -o bind /system/bin/adbd /sbin/adbd +allow vndk_detect adbd_exec:file { getattr read }; +allow vndk_detect rootfs:file { mounton getattr }; +allow vndk_detect self:capability { sys_admin }; + +#mount -o bind /system/etc/usb_audio_policy_configuration.xml /vendor/etc/usb_audio_policy_configuration.xml +allow init vendor_configs_file:file { getattr mounton }; + +#/sys/module/five +allow vndk_detect sysfs:file r_file_perms; +allow vndk_detect sysfs:dir r_dir_perms; + +#/proc/filesystems +allow vndk_detect proc_filesystems:file r_file_perms; diff --git a/duoqin/sepolicy/vold.te b/duoqin/sepolicy/vold.te new file mode 100644 index 0000000..7cbd585 --- /dev/null +++ b/duoqin/sepolicy/vold.te @@ -0,0 +1,2 @@ +allow vold system_data_file:lnk_file { unlink }; +allow mediaextractor sdcard_type:file read; diff --git a/duoqin/sepolicy/wephone.te b/duoqin/sepolicy/wephone.te deleted file mode 100644 index 8117d89..0000000 --- a/duoqin/sepolicy/wephone.te +++ /dev/null @@ -1,3 +0,0 @@ -# wephone service -type wephone, domain; -type wephone_exec, exec_type, vendor_file_type, file_type; \ No newline at end of file diff --git a/duoqin/sepolicy/xiaomi.te b/duoqin/sepolicy/xiaomi.te new file mode 100644 index 0000000..4d7d20a --- /dev/null +++ b/duoqin/sepolicy/xiaomi.te @@ -0,0 +1,12 @@ +type vendor_sysfs_displayfeature, domain, mlstrustedobject; +allow platform_app vendor_sysfs_displayfeature:dir search; + +allow platform_app vendor_sysfs_displayfeature:file write; +allow platform_app vendor_sysfs_displayfeature:file open; +allow platform_app vendor_sysfs_displayfeature:file getattr; + +type sysfs_tp_fodstatus, property_type; +allow shell sysfs_tp_fodstatus:file getattr; + +allow shell vendor_sysfs_displayfeature:dir search; + diff --git a/duoqin/su/Android.mk b/duoqin/su/Android.mk new file mode 100644 index 0000000..4d2e612 --- /dev/null +++ b/duoqin/su/Android.mk @@ -0,0 +1,11 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := su +LOCAL_MODULE := phh-su +LOCAL_MODULE_CLASS := EXECUTABLES + +LOCAL_INIT_RC := su.rc + +include $(BUILD_PREBUILT) diff --git a/duoqin/su/su b/duoqin/su/su new file mode 100755 index 0000000..59f1aaf Binary files /dev/null and b/duoqin/su/su differ diff --git a/duoqin/su/su.rc b/duoqin/su/su.rc new file mode 100644 index 0000000..935bdde --- /dev/null +++ b/duoqin/su/su.rc @@ -0,0 +1,2 @@ +service sudaemon /system/bin/phh-su --daemon + class main diff --git a/duoqin/wephone-boot.sh b/duoqin/wephone-boot.sh deleted file mode 100755 index dcdaa24..0000000 --- a/duoqin/wephone-boot.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/system/bin/sh - -touch /mnt/wephone_script \ No newline at end of file diff --git a/duoqin/wephone.rc b/duoqin/wephone.rc index db67e76..e9e80a7 100644 --- a/duoqin/wephone.rc +++ b/duoqin/wephone.rc @@ -1,2 +1,2 @@ -on early-boot - exec - root -- /vendor/bin/wephone-boot.sh \ No newline at end of file +on post-fs + exec - root -- /system/bin/wephone.sh diff --git a/duoqin/wephone.sh b/duoqin/wephone.sh new file mode 100755 index 0000000..5879528 --- /dev/null +++ b/duoqin/wephone.sh @@ -0,0 +1,3 @@ +#!/system/bin/sh + +touch /mnt/banana