Merge "qdma_app: adding permissions for mediametrics_service"
diff --git a/generic/private/property.te b/generic/private/property.te
index c09f969..cbb1fc5 100644
--- a/generic/private/property.te
+++ b/generic/private/property.te
@@ -27,5 +27,5 @@
 
 # QCV: define property type vendor_exported_system_prop
 # and vendor_exported_odm_prop
-type vendor_exported_system_prop, property_type;
-type vendor_exported_odm_prop, property_type;
+vendor_restricted_prop(vendor_exported_system_prop);
+vendor_restricted_prop(vendor_exported_odm_prop);
diff --git a/generic/vendor/common/feature_enabler_client.te b/generic/vendor/common/feature_enabler_client.te
index ab66cbf..3df91c2 100644
--- a/generic/vendor/common/feature_enabler_client.te
+++ b/generic/vendor/common/feature_enabler_client.te
@@ -1,4 +1,4 @@
-# Copyright (c) 2019, The Linux Foundation. All rights reserved.
+# Copyright (c) 2019 - 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
@@ -31,6 +31,7 @@
 init_daemon_domain(vendor_feature_enabler_client)
 allow vendor_feature_enabler_client tee_device:chr_file rw_file_perms;
 allow vendor_feature_enabler_client ion_device:chr_file rw_file_perms;
+allow vendor_feature_enabler_client vendor_smcinvoke_device:chr_file rw_file_perms;
 unix_socket_connect(vendor_feature_enabler_client , vendor_ssgtzd, vendor_ssgtzd)
 
 
@@ -44,3 +45,8 @@
 # Binder access for featenab_client.service
 vndbinder_use(vendor_feature_enabler_client)
 allow vendor_feature_enabler_client vendor_qfeatenab_client_service:service_manager { add find };
+
+#Allow access to display services and graphics_device for DRM
+allow vendor_feature_enabler_client vendor_qdisplay_service:service_manager find;
+hal_client_domain(vendor_feature_enabler_client, hal_graphics_composer)
+allow vendor_feature_enabler_client graphics_device:chr_file rw_file_perms;
diff --git a/generic/vendor/common/property.te b/generic/vendor/common/property.te
index a2766fd..27a205b 100644
--- a/generic/vendor/common/property.te
+++ b/generic/vendor/common/property.te
@@ -24,75 +24,76 @@
 # 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.
-type vendor_ctl_netmgrd_prop, property_type;
-type vendor_ctl_port-bridge_prop, property_type;
-type vendor_ctl_qcrild_prop, property_type;
-type vendor_camera_prop, property_type;
-type vendor_cnd_prop, property_type;
-type vendor_crash_cnt_prop, property_type;
-type vendor_crash_detect_prop, property_type;
-type vendor_ims_prop, property_type;
-type vendor_ipacm_prop, property_type;
-type vendor_ipacm-diag_prop, property_type;
-type vendor_modem_diag_prop, property_type;
-type vendor_msm_irqbalance_prop, property_type;
-type vendor_per_mgr_state_prop, property_type;
-type vendor_dataqti_prop, property_type;
-type vendor_dataqdp_prop, property_type;
-type vendor_ramdump_prop, property_type;
-type vendor_sensors_prop, property_type;
-type vendor_tee_listener_prop, property_type;
-type vendor_display_prop, property_type;
-type vendor_usb_prop, property_type;
-type vendor_radio_prop, property_type;
 
-#Needed for  ubwc support
-type vendor_gralloc_prop, property_type;
+vendor_internal_prop(vendor_ctl_netmgrd_prop);
+vendor_internal_prop(vendor_ctl_port-bridge_prop);
+vendor_internal_prop(vendor_ctl_qcrild_prop);
+vendor_restricted_prop(vendor_camera_prop);
+vendor_restricted_prop(vendor_cnd_prop);
+vendor_internal_prop(vendor_crash_cnt_prop);
+vendor_internal_prop(vendor_crash_detect_prop);
+vendor_restricted_prop(vendor_ims_prop);
+vendor_internal_prop(vendor_ipacm_prop);
+vendor_internal_prop(vendor_ipacm-diag_prop);
+vendor_internal_prop(vendor_modem_diag_prop);
+vendor_internal_prop(vendor_msm_irqbalance_prop);
+vendor_restricted_prop(vendor_per_mgr_state_prop);
+vendor_internal_prop(vendor_dataqti_prop);
+vendor_internal_prop(vendor_dataqdp_prop);
+vendor_internal_prop(vendor_ramdump_prop);
+vendor_internal_prop(vendor_sensors_prop);
+vendor_restricted_prop(vendor_tee_listener_prop);
+vendor_restricted_prop(vendor_display_prop);
+vendor_internal_prop(vendor_usb_prop);
+vendor_restricted_prop(vendor_radio_prop);
 
-type vendor_system_prop, property_type;
+#Needed for ubwc support
+vendor_restricted_prop(vendor_gralloc_prop);
+
+vendor_internal_prop(vendor_system_prop);
 
 #imsrcsservice
-type vendor_ctl_vendor_imsrcsservice_prop, property_type;
+vendor_restricted_prop(vendor_ctl_vendor_imsrcsservice_prop);
 
 # HBTP
-type vendor_ctl_vendor_hbtp_prop, property_type;
+vendor_internal_prop(vendor_ctl_vendor_hbtp_prop);
 
 # Bluetooth props
-type vendor_bluetooth_prop, property_type;
+vendor_restricted_prop(vendor_bluetooth_prop);
 
 #time service
-type vendor_time_service_prop, property_type;
+vendor_internal_prop(vendor_time_service_prop);
 
 # Audio props
-type vendor_audio_prop, property_type;
+vendor_restricted_prop(vendor_audio_prop);
 
 #ss-restart
-type vendor_ssr_prop, property_type;
+vendor_internal_prop(vendor_ssr_prop);
 
 #ss-services (PD)
-type vendor_pd_locater_dbg_prop, property_type;
+vendor_internal_prop(vendor_pd_locater_dbg_prop);
 
 #capabilityconfigstore hal (CCHAL)
-type vendor_cap_configstore_dbg_prop, property_type;
+vendor_internal_prop(vendor_cap_configstore_dbg_prop);
 
 #rmt_storage
-type vendor_ctl_vendor_rmt_storage_prop, property_type;
+vendor_internal_prop(vendor_ctl_vendor_rmt_storage_prop);
 
-type vendor_gpu_prop, property_type;
+vendor_internal_prop(vendor_gpu_prop);
 
-type vendor_public_vendor_default_prop, property_type;
+vendor_restricted_prop(vendor_public_vendor_default_prop);
 
 # alarm property
-type vendor_alarm_boot_prop, property_type;
+vendor_restricted_prop(vendor_alarm_boot_prop);
 
 #wlan-vendor prop
-type vendor_wifi_prop, property_type;
+vendor_internal_prop(vendor_wifi_prop);
 
 #qdcmss property
-type vendor_qdcmss_prop, property_type;
+vendor_internal_prop(vendor_qdcmss_prop);
 
 #adsprpc props
-type vendor_adsprpc_prop, property_type;
+vendor_restricted_prop(vendor_adsprpc_prop);
 
 # Wifi version recorder
-type vendor_wifi_version, property_type;
+vendor_internal_prop(vendor_wifi_version);
diff --git a/generic/vendor/test/property.te b/generic/vendor/test/property.te
index d6dddc3..aceb08e 100644
--- a/generic/vendor/test/property.te
+++ b/generic/vendor/test/property.te
@@ -24,7 +24,7 @@
 # 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.
-type vendor_sensors_dbg_prop, property_type;
+vendor_restricted_prop(vendor_sensors_dbg_prop);
 
 #WiFi Display
-type vendor_wfd_vendor_debug_prop, property_type;
+vendor_internal_prop(vendor_wfd_vendor_debug_prop);
diff --git a/legacy/vendor/common/file.te b/legacy/vendor/common/file.te
index 0e13e7a..874697c 100644
--- a/legacy/vendor/common/file.te
+++ b/legacy/vendor/common/file.te
@@ -90,7 +90,7 @@
 type proc_audiod, fs_type, proc_type;
 
 #file type for irqbalance socket
-type msm_irqbalance_socket, file_type;
+type vendor_msm_irqbalance_socket, file_type;
 
 # Sensor file types
 type sensors_socket, file_type;
@@ -315,7 +315,7 @@
 type sysfs_uio_file, fs_type, sysfs_type;
 
 #irq balance sysfs type
-type sysfs_irqbalance , sysfs_type, fs_type;
+type vendor_sysfs_irqbalance , sysfs_type, fs_type;
 
 # vpp files
 type vendor_vpp_data_file, file_type, data_file_type;
diff --git a/legacy/vendor/common/file_contexts b/legacy/vendor/common/file_contexts
index e3e2906..75ce898 100644
--- a/legacy/vendor/common/file_contexts
+++ b/legacy/vendor/common/file_contexts
@@ -150,7 +150,7 @@
 /dev/socket/rild3                               u:object_r:rild_socket:s0
 /dev/socket/rild3-debug                         u:object_r:rild_debug_socket:s0
 /dev/socket/rild-debug3                         u:object_r:rild_debug_socket:s0
-/dev/socket/msm_irqbalance                      u:object_r:msm_irqbalance_socket:s0
+/dev/socket/msm_irqbalance                      u:object_r:vendor_msm_irqbalance_socket:s0
 /dev/socket/mlid                                u:object_r:mlid_socket:s0
 /dev/socket/ssgqmig                             u:object_r:ssgqmig_socket:s0
 /dev/socket/ssgtzd                              u:object_r:ssgtzd_socket:s0
@@ -217,7 +217,7 @@
 /(vendor|system/vendor)/bin/mmi                 u:object_r:vendor_mmi_exec:s0
 /(vendor|system/vendor)/bin/mmid                u:object_r:vendor_mmi_exec:s0
 /(vendor|system/vendor)/bin/qdcmss              u:object_r:qdcm-ss_exec:s0
-/(vendor|system/vendor)/bin/msm_irqbalance      u:object_r:msm_irqbalanced_exec:s0
+/(vendor|system/vendor)/bin/msm_irqbalance      u:object_r:vendor_msm_irqbalanced_exec:s0
 /(vendor|system/vendor)/bin/imsdatadaemon       u:object_r:ims_exec:s0
 /(vendor|system/vendor)/bin/imsqmidaemon        u:object_r:ims_exec:s0
 /(vendor|system/vendor)/bin/ims_rtp_daemon      u:object_r:hal_imsrtp_exec:s0
@@ -370,7 +370,7 @@
 /sys/devices/soc/[a-f0-9]+.ssusb/power_supply/usb(/.*)?             u:object_r:sysfs_usb_supply:s0
 /sys/devices/soc/qpnp-vadc-[0-9]+(/.*)?                             u:object_r:sysfs_vadc_dev:s0
 /sys/bus/spmi/devices(/.*)?                                         u:object_r:sysfs_spmi_dev:s0
-/sys/kernel/irq_helper/irq_blacklist_on                             u:object_r:sysfs_irqbalance:s0
+/sys/kernel/irq_helper/irq_blacklist_on                             u:object_r:vendor_sysfs_irqbalance:s0
 /sys/devices/virtual/graphics/fb([0-3])+/idle_time                  u:object_r:sysfs_graphics:s0
 /sys/devices/virtual/graphics/fb([0-3])+/dynamic_fps                u:object_r:sysfs_graphics:s0
 /sys/devices/virtual/graphics/fb([0-3])+/product_description        u:object_r:sysfs_graphics:s0
diff --git a/legacy/vendor/common/init_shell.te b/legacy/vendor/common/init_shell.te
index 9316f47..0c09fd6 100644
--- a/legacy/vendor/common/init_shell.te
+++ b/legacy/vendor/common/init_shell.te
@@ -81,8 +81,8 @@
 set_prop(qti_init_shell, vendor_mpctl_prop)
 set_prop(qti_init_shell, vendor_bluetooth_prop)
 set_prop(qti_init_shell, sensors_prop)
-set_prop(qti_init_shell, msm_irqbalance_prop)
-set_prop(qti_init_shell, msm_irqbl_sdm630_prop)
+set_prop(qti_init_shell, vendor_msm_irqbalance_prop)
+set_prop(qti_init_shell, vendor_msm_irqbl_sdm630_prop)
 set_prop(qti_init_shell, vendor_ipacm_prop)
 set_prop(qti_init_shell, vendor_ipacm-diag_prop)
 set_prop(qti_init_shell, vendor_dataqti_prop)
@@ -155,7 +155,7 @@
 allow qti_init_shell sensors_persist_file:dir setattr;
 
 # To check if /system/bin/msm_irqbalance is persent in the device
-allow qti_init_shell msm_irqbalanced_exec:file getattr;
+allow qti_init_shell vendor_msm_irqbalanced_exec:file getattr;
 
 # To write to /data/vendor/perfd
 allow qti_init_shell mpctl_data_file:dir w_dir_perms;
diff --git a/legacy/vendor/common/msm_irqbalanced.te b/legacy/vendor/common/msm_irqbalanced.te
index d140891..c9f28a0 100644
--- a/legacy/vendor/common/msm_irqbalanced.te
+++ b/legacy/vendor/common/msm_irqbalanced.te
@@ -25,18 +25,18 @@
 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-type msm_irqbalanced, domain;
-type msm_irqbalanced_exec, exec_type, vendor_file_type, file_type;
+type vendor_msm_irqbalanced, domain;
+type vendor_msm_irqbalanced_exec, exec_type, vendor_file_type, file_type;
 
-init_daemon_domain(msm_irqbalanced)
+init_daemon_domain(vendor_msm_irqbalanced)
 
-allow msm_irqbalanced cgroup:dir { create add_name };
-allow msm_irqbalanced { proc sysfs_devices_system_cpu }:file w_file_perms;
-r_dir_file(msm_irqbalanced, sysfs_rqstats);
+allow vendor_msm_irqbalanced cgroup:dir { create add_name };
+allow vendor_msm_irqbalanced { proc sysfs_devices_system_cpu }:file w_file_perms;
+r_dir_file(vendor_msm_irqbalanced, sysfs_rqstats);
 
 # access smp_affinity
-allow msm_irqbalanced proc:file r_file_perms;
-allow msm_irqbalanced proc_interrupts:file r_file_perms;
-allow msm_irqbalanced proc_stat:file r_file_perms;
+allow vendor_msm_irqbalanced proc:file r_file_perms;
+allow vendor_msm_irqbalanced proc_interrupts:file r_file_perms;
+allow vendor_msm_irqbalanced proc_stat:file r_file_perms;
 # irq_blacklist_on
-allow msm_irqbalanced sysfs_irqbalance:file r_file_perms;
+allow vendor_msm_irqbalanced vendor_sysfs_irqbalance:file r_file_perms;
diff --git a/legacy/vendor/common/property.te b/legacy/vendor/common/property.te
index d24ea21..c635201 100644
--- a/legacy/vendor/common/property.te
+++ b/legacy/vendor/common/property.te
@@ -47,8 +47,8 @@
 type cnd_vendor_prop, property_type;
 type sensors_prop, property_type;
 type slpi_prop, property_type;
-type msm_irqbalance_prop, property_type;
-type msm_irqbl_sdm630_prop, property_type;
+type vendor_msm_irqbalance_prop, property_type;
+type vendor_msm_irqbl_sdm630_prop, property_type;
 type camera_prop, property_type;
 type spcomlib_prop, property_type;
 type vendor_display_prop, property_type;
diff --git a/legacy/vendor/common/property_contexts b/legacy/vendor/common/property_contexts
index c304bb4..a0329ee 100644
--- a/legacy/vendor/common/property_contexts
+++ b/legacy/vendor/common/property_contexts
@@ -58,10 +58,10 @@
 ctl.vendor.dataqti         u:object_r:vendor_dataqti_prop:s0
 ctl.vendor.dataadpl         u:object_r:vendor_dataadpl_prop:s0
 ctl.vendor.sensors                u:object_r:sensors_prop:s0
-ctl.vendor.msm_irqbalance         u:object_r:msm_irqbalance_prop:s0
-ctl.vendor.msm_irqbl_sdm630       u:object_r:msm_irqbl_sdm630_prop:s0
+ctl.vendor.msm_irqbalance         u:object_r:vendor_msm_irqbalance_prop:s0
+ctl.vendor.msm_irqbl_sdm630       u:object_r:vendor_msm_irqbl_sdm630_prop:s0
 vendor.slpi.               u:object_r:slpi_prop:s0
-ctl.vendor.msm_irqbal_lb          u:object_r:msm_irqbalance_prop:s0
+ctl.vendor.msm_irqbal_lb          u:object_r:vendor_msm_irqbalance_prop:s0
 vendor.spcom.              u:object_r:spcomlib_prop:s0
 vendor.display.               u:object_r:vendor_display_prop:s0
 ro.vendor.display.            u:object_r:vendor_display_prop:s0
diff --git a/qva/vendor/common/property.te b/qva/vendor/common/property.te
index cf2baf7..16694b9 100644
--- a/qva/vendor/common/property.te
+++ b/qva/vendor/common/property.te
@@ -25,65 +25,65 @@
 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-type vendor_qcom_ims_prop, property_type;
-type vendor_dataadpl_prop, property_type;
-type vendor_cnd_vendor_prop, property_type;
-type vendor_spcomlib_prop, property_type;
-type vendor_qdma_prop, property_type;
-type vendor_mdm_helper_prop, property_type;
-type vendor_disable_spu_prop, property_type;
+vendor_internal_prop(vendor_qcom_ims_prop);
+vendor_internal_prop(vendor_dataadpl_prop);
+vendor_internal_prop(vendor_cnd_vendor_prop);
+vendor_internal_prop(vendor_spcomlib_prop);
+vendor_internal_prop(vendor_qdma_prop);
+vendor_internal_prop(vendor_mdm_helper_prop);
+vendor_internal_prop(vendor_disable_spu_prop);
 
 # boot mode property
-type vendor_boot_mode_prop, property_type;
+vendor_internal_prop(vendor_boot_mode_prop);
 
 #mpctl
-type vendor_mpctl_prop, property_type;
-type vendor_freq_prop, property_type;
+vendor_restricted_prop(vendor_mpctl_prop);
+vendor_internal_prop(vendor_freq_prop);
 #service opts
-type vendor_bservice_prop, property_type;
-type vendor_reschedule_service_prop, property_type;
-type vendor_cgroup_follow_prop, property_type;
-type vendor_scroll_prop, property_type;
+vendor_restricted_prop(vendor_bservice_prop);
+vendor_restricted_prop(vendor_reschedule_service_prop);
+vendor_restricted_prop(vendor_cgroup_follow_prop);
+vendor_restricted_prop(vendor_scroll_prop);
 
-type vendor_qspm_prop, property_type;
+vendor_restricted_prop(vendor_qspm_prop);
 #iop
-type vendor_iop_prop, property_type;
+vendor_restricted_prop(vendor_iop_prop);
 
 #properties for nfc
-type vendor_nfc_nq_prop, property_type;
+vendor_restricted_prop(vendor_nfc_nq_prop);
 
 # factory properties
-type vendor_ctl_vendor_mmid_prop, property_type;
+vendor_internal_prop(vendor_ctl_vendor_mmid_prop);
 
 # mmi
-type vendor_mmi_prop, property_type;
+vendor_internal_prop(vendor_mmi_prop);
 
 #mm-video
-type vendor_video_prop, property_type;
+vendor_restricted_prop(vendor_video_prop);
 
 # Audio debug props
-type vendor_audio_debug_prop, property_type;
+vendor_internal_prop(vendor_audio_debug_prop);
 
 # Seccam Prop
-type vendor_core_ctl_prop, property_type;
+vendor_internal_prop(vendor_core_ctl_prop);
 
-# property for vendor_location
-type vendor_location_prop, property_type;
+# property for location
+vendor_internal_prop(vendor_location_prop);
 
 # Netmgrd prop
-type vendor_data_ko_prop, property_type;
+vendor_internal_prop(vendor_data_ko_prop);
 # WIGIG
-type vendor_wigig_prop, property_type;
-type vendor_ctl_vendor_wigigsvc_prop, property_type;
+vendor_internal_prop(vendor_wigig_prop);
+vendor_internal_prop(vendor_ctl_vendor_wigigsvc_prop);
 
 # hvdcp_opti prop
-type vendor_hvdcp_opti_prop, property_type;
+vendor_internal_prop(vendor_hvdcp_opti_prop);
 
 # property for xlat
-type vendor_xlat_prop, property_type;
+vendor_internal_prop(vendor_xlat_prop);
 
 #qvr property
-type vendor_qvr_prop, property_type;
+vendor_restricted_prop(vendor_qvr_prop);
 
 #qmuxd property
-type vendor_ctl_qmuxd_prop, property_type;
+vendor_internal_prop(vendor_ctl_qmuxd_prop);