Merge "sepolicy: Give read/write permission to vender_gles_data_file"
diff --git a/generic/private/vendor_init.te b/generic/private/vendor_init.te
new file mode 100644
index 0000000..48c61e7
--- /dev/null
+++ b/generic/private/vendor_init.te
@@ -0,0 +1,29 @@
+# Copyright (c) 2019, 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.
+
+# QCV:vendor_init settable for vendor_exported_system_prop
+set_prop(vendor_init, vendor_exported_system_prop)
diff --git a/generic/vendor/common/attributes b/generic/vendor/common/attributes
index 39a8573..b2bc687 100644
--- a/generic/vendor/common/attributes
+++ b/generic/vendor/common/attributes
@@ -55,3 +55,7 @@
 attribute hal_capabilityconfigstore_qti;
 attribute hal_capabilityconfigstore_qti_client;
 attribute hal_capabilityconfigstore_qti_server;
+
+attribute hal_dataconnection_qti;
+attribute hal_dataconnection_qti_client;
+attribute hal_dataconnection_qti_server;
diff --git a/generic/vendor/common/charger.te b/generic/vendor/common/charger.te
new file mode 100644
index 0000000..b6fc4cd
--- /dev/null
+++ b/generic/vendor/common/charger.te
@@ -0,0 +1,37 @@
+# Copyright (c) 2019, 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.
+allow charger self:capability2 wake_alarm;
+r_dir_file(charger, sysfs_battery_supply)
+r_dir_file(charger, sysfs_usb_supply)
+
+allow charger {
+    sysfs_battery_supply
+    sysfs_usb_supply
+}:file w_file_perms;
+
+dontaudit charger device:dir r_dir_perms;
+dontaudit charger self:capability sys_admin;
diff --git a/generic/vendor/common/file.te b/generic/vendor/common/file.te
index ee538cc..c9f6e3d 100644
--- a/generic/vendor/common/file.te
+++ b/generic/vendor/common/file.te
@@ -36,6 +36,7 @@
 type sysfs_fingerprint, sysfs_type, fs_type;
 type sysfs_graphics, sysfs_type, fs_type;
 type sysfs_kgsl, sysfs_type, fs_type;
+type sysfs_kgsl_proc, sysfs_type, fs_type;
 type hbtp_kernel_sysfs, sysfs_type, fs_type;
 type sysfs_irqbalance, sysfs_type, fs_type;
 type sysfs_laser, sysfs_type, fs_type;
diff --git a/generic/vendor/common/file_contexts b/generic/vendor/common/file_contexts
index e4b431b..2ed7104 100644
--- a/generic/vendor/common/file_contexts
+++ b/generic/vendor/common/file_contexts
@@ -40,6 +40,7 @@
 /dev/rmnet_ctrl.*                               u:object_r:rmnet_device:s0
 /dev/at_.*                                      u:object_r:at_device:s0
 /dev/video([0-9])+                              u:object_r:video_device:s0
+/dev/cvp*                                       u:object_r:video_device:s0
 /dev/media([0-9])+                              u:object_r:video_device:s0
 /dev/v4l-subdev.*                               u:object_r:video_device:s0
 /dev/qseecom                                    u:object_r:tee_device:s0
@@ -183,6 +184,7 @@
 /vendor/lib(64)?/hw/android\.hardware\.graphics\.mapper@2\.0-impl-qti-display\.so   u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/vendor\.qti\.hardware\.display\.mapper@1\.0\.so   u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/vendor\.qti\.hardware\.display\.mapper@1\.1\.so   u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libcamxexternalformatutils\.so                    u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libgralloccore\.so        u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libgrallocutils\.so       u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libqdMetaData\.so         u:object_r:same_process_hal_file:s0
@@ -191,6 +193,7 @@
 /vendor/lib(64)?/libadreno_utils\.so       u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libgsl\.so                u:object_r:same_process_hal_file:s0
 
+/vendor/lib(64)?/hw/vulkan\.adreno\.so     u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libEGL_adreno\.so         u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libGLESv1_CM_adreno\.so   u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libGLESv2_adreno\.so      u:object_r:same_process_hal_file:s0
@@ -229,6 +232,10 @@
 # libGLESv2_adreno depends on this
 /vendor/lib(64)?/libllvm-glnext\.so         u:object_r:same_process_hal_file:s0
 
+# libOpenCL and its dependencies
+/vendor/lib(64)?/libOpenCL\.so              u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libq3dtools_adreno\.so     u:object_r:same_process_hal_file:s0
+
 # Loaded by native loader (zygote) for all processes
 /vendor/lib(64)?/libadsprpc\.so             u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libcdsprpc\.so             u:object_r:same_process_hal_file:s0
@@ -236,6 +243,11 @@
 /vendor/lib(64)?/libmdsprpc\.so             u:object_r:same_process_hal_file:s0
 /vendor/lib/dsp/fastrpc_shell_0             u:object_r:same_process_hal_file:s0
 
+# Fastcv libs
+/vendor/lib(64)?/libfastcvdsp_stub\.so      u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libfastcvadsp_stub\.so     u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libfastcvopt\.so           u:object_r:same_process_hal_file:s0
+
 # data files
 /data/vendor/netmgr(/.*)?              u:object_r:netmgr_data_file:s0
 /data/vendor/netmgr/recovery(/.*)?     u:object_r:netmgr_recovery_data_file:s0
@@ -280,9 +292,6 @@
 /mnt/vendor/persist/time(/.*)?       u:object_r:persist_time_file:s0
 /mnt/vendor/persist/audio(/.*)?      u:object_r:persist_audio_file:s0
 
-/metadata                 u:object_r:rootfs:s0
-/metadata/.*              u:object_r:vold_data_file:s0
-
 # graphics device
 /dev/mdss_rotator                               u:object_r:graphics_device:s0
 /dev/dri/card0                                  u:object_r:graphics_device:s0
@@ -354,6 +363,7 @@
 /sys/devices/virtual/graphics/fb([0-3])+/ad                         u:object_r:sysfs_graphics:s0
 /sys/devices/virtual/graphics/fb([0-3])+/pp_bl_event                u:object_r:sysfs_graphics:s0
 /sys/devices/virtual/rotator/mdss_rotator/caps                      u:object_r:sysfs_graphics:s0
+/sys/devices/virtual/hdcp/msm_hdcp/min_level_change                 u:object_r:sysfs_graphics:s0
 /sys/class/lcd_bias/secure_mode                                     u:object_r:sysfs_graphics:s0
 /sys/class/leds/wled/secure_mode                                    u:object_r:sysfs_graphics:s0
 
diff --git a/generic/vendor/common/genfs_contexts b/generic/vendor/common/genfs_contexts
index c24344e..13c5700 100644
--- a/generic/vendor/common/genfs_contexts
+++ b/generic/vendor/common/genfs_contexts
@@ -95,6 +95,7 @@
 genfscon sysfs /devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qcom,usb-pdphy@1700/usbpd0/typec     u:object_r:sysfs_usb_c:s0
 genfscon sysfs /module/diagchar                                         u:object_r:sysfs_diag:s0
 
+genfscon sysfs /devices/virtual/kgsl/kgsl/proc                          u:object_r:sysfs_kgsl_proc:s0
 genfscon sysfs /devices/virtual/workqueue/kgsl-events/cpumask                  u:object_r:sysfs_kgsl:s0
 genfscon sysfs /devices/virtual/workqueue/kgsl-events/nice                     u:object_r:sysfs_kgsl:s0
 genfscon sysfs /devices/virtual/workqueue/kgsl-workqueue/cpumask               u:object_r:sysfs_kgsl:s0
diff --git a/generic/vendor/common/hal_camera.te b/generic/vendor/common/hal_camera.te
index 93e97bf..88921a6 100644
--- a/generic/vendor/common/hal_camera.te
+++ b/generic/vendor/common/hal_camera.te
@@ -62,3 +62,6 @@
 r_dir_file(hal_camera, adsprpcd_file);
 #allow camera to access adsprpc_prop
 get_prop(hal_camera, vendor_adsprpc_prop)
+
+# This is needed to access GPU
+allow hal_camera_default gpu_device:chr_file rw_file_perms;
diff --git a/generic/vendor/common/hal_memtrack_default.te b/generic/vendor/common/hal_memtrack_default.te
index b9dd0a6..f41fd70 100644
--- a/generic/vendor/common/hal_memtrack_default.te
+++ b/generic/vendor/common/hal_memtrack_default.te
@@ -24,4 +24,6 @@
 # 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.
-allow hal_memtrack_default debugfs_kgsl:file r_file_perms;
+
+#Acess to kgsl memory /sys/class/kgsl/kgsl/proc/<pid>/mtrack
+r_dir_file(hal_memtrack_default, sysfs_kgsl_proc);
diff --git a/generic/vendor/common/hal_rcsservice.te b/generic/vendor/common/hal_rcsservice.te
index 2eef1fb..7debd7a 100644
--- a/generic/vendor/common/hal_rcsservice.te
+++ b/generic/vendor/common/hal_rcsservice.te
@@ -58,10 +58,12 @@
 # allow imsrcsd capabilities
 wakelock_use(hal_rcsservice)
 allow hal_rcsservice self:capability net_bind_service;
+allow hal_rcsservice self:capability2 wake_alarm;
 
 #diag
 userdebug_or_eng(`
   diag_use(hal_rcsservice)
+  binder_call(hal_rcsservice, radio)
 ')
 
 set_prop(hal_rcsservice, ctl_vendor_imsrcsservice_prop)
diff --git a/generic/vendor/common/hwservice.te b/generic/vendor/common/hwservice.te
index c841096..10a178f 100644
--- a/generic/vendor/common/hwservice.te
+++ b/generic/vendor/common/hwservice.te
@@ -36,7 +36,7 @@
 type hal_imscallinfo_hwservice, hwservice_manager_type;
 type hal_ipacm_hwservice, hwservice_manager_type;
 type hal_hbtp_hwservice, hwservice_manager_type;
-type hal_perf_hwservice, hwservice_manager_type, untrusted_app_visible_hwservice_violators;
+type hal_perf_hwservice, hwservice_manager_type;
 type hal_tui_comm_hwservice, hwservice_manager_type;
 type hal_qdutils_disp_hwservice, hwservice_manager_type;
 type hal_display_color_hwservice, hwservice_manager_type;
diff --git a/generic/vendor/common/init-qcom-sensors-sh.te b/generic/vendor/common/init-qcom-sensors-sh.te
index 14136b5..d00dc54 100644
--- a/generic/vendor/common/init-qcom-sensors-sh.te
+++ b/generic/vendor/common/init-qcom-sensors-sh.te
@@ -41,3 +41,4 @@
 allow init-qcom-sensors-sh sensors_device:chr_file r_file_perms;
 
 set_prop(init-qcom-sensors-sh, sensors_prop)
+get_prop(init-qcom-sensors-sh, vendor_sensors_prop)
\ No newline at end of file
diff --git a/generic/vendor/common/property.te b/generic/vendor/common/property.te
index c6df503..4c275db 100644
--- a/generic/vendor/common/property.te
+++ b/generic/vendor/common/property.te
@@ -93,3 +93,6 @@
 
 #adsprpc props
 type vendor_adsprpc_prop, property_type;
+
+#sensors props
+type vendor_sensors_prop, property_type;
\ No newline at end of file
diff --git a/generic/vendor/common/property_contexts b/generic/vendor/common/property_contexts
index 5777f7a..587d0e5 100644
--- a/generic/vendor/common/property_contexts
+++ b/generic/vendor/common/property_contexts
@@ -62,14 +62,16 @@
 persist.vendor.data.profile_update u:object_r:vendor_dataqdp_prop:s0
 vendor.sys.listeners.registered   u:object_r:vendor_tee_listener_prop:s0
 vendor.sys.modem.diag.     u:object_r:vendor_modem_diag_prop:s0
-vendor.display.               u:object_r:vendor_display_prop:s0
 vendor.usb.                u:object_r:vendor_usb_prop:s0
 persist.vendor.usb.        u:object_r:vendor_usb_prop:s0
+ro.vendor.usb.             u:object_r:vendor_usb_prop:s0
+vendor.display.               u:object_r:vendor_display_prop:s0
 ro.vendor.display.            u:object_r:vendor_display_prop:s0
 persist.vendor.display.       u:object_r:vendor_display_prop:s0
 vendor.gralloc.            u:object_r:vendor_gralloc_prop:s0
 vendor.peripheral.         u:object_r:vendor_per_mgr_state_prop:s0
 vendor.ims.                u:object_r:ims_prop:s0
+ro.build.software.version  u:object_r:ims_prop:s0
 persist.vendor.ims.        u:object_r:ims_prop:s0
 persist.vendor.qti.telephony.vt_cam_interface u:object_r:ims_prop:s0
 ctl.vendor.imsrcsservice   u:object_r:ctl_vendor_imsrcsservice_prop:s0
@@ -119,3 +121,6 @@
 
 #vendor-adsprpc
 vendor.fastrpc.                  u:object_r:vendor_adsprpc_prop:s0
+
+#vendor-sensors
+init.svc.vendor.sensors          u:object_r:vendor_sensors_prop:s0
diff --git a/generic/vendor/common/qtidataservices_app.te b/generic/vendor/common/qtidataservices_app.te
index a7dfbaf..906e606 100644
--- a/generic/vendor/common/qtidataservices_app.te
+++ b/generic/vendor/common/qtidataservices_app.te
@@ -47,3 +47,4 @@
 binder_call(qtidataservices_app, rild)
 
 net_domain(qtidataservices_app)
+hal_client_domain(qtidataservices_app, hal_perf)
diff --git a/generic/vendor/common/rild.te b/generic/vendor/common/rild.te
index 1cbde6c..7c046e6 100644
--- a/generic/vendor/common/rild.te
+++ b/generic/vendor/common/rild.te
@@ -55,6 +55,7 @@
 add_hwservice(rild, hal_iwlan_hwservice)
 
 add_hwservice(rild, hal_dataconnection_hwservice)
+hal_server_domain(rild, hal_dataconnection_qti)
 
 get_prop(rild, exported3_radio_prop)
 get_prop(rild, vendor_dataqdp_prop)
diff --git a/generic/vendor/common/system_server.te b/generic/vendor/common/system_server.te
index 76bb33b..e147c11 100644
--- a/generic/vendor/common/system_server.te
+++ b/generic/vendor/common/system_server.te
@@ -48,3 +48,5 @@
 
 # allow system_server to access vendor display property.
 get_prop(system_server, vendor_display_prop)
+
+hal_client_domain(system_server, hal_dataconnection_qti)
diff --git a/generic/vendor/common/vendor_hal_dataconnection_qti.te b/generic/vendor/common/vendor_hal_dataconnection_qti.te
new file mode 100644
index 0000000..e8d245c
--- /dev/null
+++ b/generic/vendor/common/vendor_hal_dataconnection_qti.te
@@ -0,0 +1,31 @@
+# Copyright (c) 2019, 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.
+
+binder_call(hal_dataconnection_qti_client, hal_dataconnection_qti_server)
+binder_call(hal_dataconnection_qti_server, hal_dataconnection_qti_client)
+
+hal_attribute_hwservice(hal_dataconnection_qti, hal_dataconnection_hwservice)
diff --git a/generic/vendor/common/vendor_init.te b/generic/vendor/common/vendor_init.te
index b5db873..47975b5 100644
--- a/generic/vendor/common/vendor_init.te
+++ b/generic/vendor/common/vendor_init.te
@@ -25,8 +25,6 @@
 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-typeattribute vendor_init data_between_core_and_vendor_violators;
-
 allow vendor_init persist_block_device:{ blk_file lnk_file } relabelto;
 allow vendor_init unlabeled:dir { r_dir_perms setattr relabelfrom };
 allow vendor_init unlabeled:file { r_file_perms setattr relabelfrom };
@@ -62,13 +60,7 @@
 allow vendor_init vendor_file:system module_load;
 
 allow vendor_init {
-    bluetooth_data_file
     vendor_camera_data_file
-    dhcp_data_file
-    media_rw_data_file
-    nfc_data_file
-    system_data_file
-    tombstone_data_file
     vendor_tui_data_file
 }:dir create_dir_perms;
 
@@ -95,4 +87,4 @@
 set_prop(vendor_init, exported_system_prop)
 
 #Access vendor bluetooth properties
-set_prop(vendor_init, vendor_bluetooth_prop)
\ No newline at end of file
+set_prop(vendor_init, vendor_bluetooth_prop)
diff --git a/generic/vendor/kona/genfs_contexts b/generic/vendor/kona/genfs_contexts
index 3bc5a5c..4e58538 100644
--- a/generic/vendor/kona/genfs_contexts
+++ b/generic/vendor/kona/genfs_contexts
@@ -88,5 +88,15 @@
 genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-03/c440000.qcom,spmi:qcom,pm8150b@3:qcom,leds@d000/leds/hr_led1 u:object_r:sysfs_graphics:s0
 genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-03/c440000.qcom,spmi:qcom,pm8150b@3:qcom,leds@d000/leds/hr_led2 u:object_r:sysfs_graphics:s0
 
+#qdss sysfs-node
+genfscon sysfs /devices/platform/soc/6b05000.tmc/coresight-tmc-etf u:object_r:sysfs_qdss_dev:s0
+genfscon sysfs /devices/platform/soc/6048000.tmc/coresight-tmc-etr u:object_r:sysfs_qdss_dev:s0
+genfscon sysfs /devices/platform/soc/6002000.stm/coresight-stm u:object_r:sysfs_qdss_dev:s0
+genfscon sysfs /devices/platform/soc/soc:hwevent/coresight-hwevent u:object_r:sysfs_qdss_dev:s0
+genfscon sysfs /devices/platform/soc/6b0c000.csr/coresight-swao-csr u:object_r:sysfs_qdss_dev:s0
+
 # USBPD device node
 genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm8150b@2:qcom,usb-pdphy@1700/usbpd/usbpd0 u:object_r:sysfs_usbpd_device:s0
+
+#net sysfs
+genfscon sysfs /devices/platform/soc/1c10000.qcom,pcie/pci0002:00/0002:00:00.0/0002:01:00.0/0306_02.01.00_IP_HW0/net u:object_r:sysfs_net:s0
diff --git a/generic/vendor/msmnile/genfs_contexts b/generic/vendor/msmnile/genfs_contexts
index e22c2ad..09abd90 100644
--- a/generic/vendor/msmnile/genfs_contexts
+++ b/generic/vendor/msmnile/genfs_contexts
@@ -107,3 +107,6 @@
 genfscon sysfs /bus/mhi/devices/0306_00.01.00_QMI1/mhi_uci u:object_r:sysfs_mhi:s0
 genfscon sysfs /devices/platform/soc/1c08000.qcom,pcie/pci0001:00/0001:00:00.0/0001:01:00.0/0306_01.01.00_QMI0 u:object_r:sysfs_mhi:s0
 genfscon sysfs /devices/platform/soc/1c08000.qcom,pcie/pci0001:00/0001:00:00.0/0001:01:00.0/0306_01.01.00_QMI1 u:object_r:sysfs_mhi:s0
+
+#net sysfs
+genfscon sysfs /devices/platform/soc/1c08000.qcom,pcie/pci0001:00/0001:00:00.0/0001:01:00.0/0306_01.01.00_IP_HW0/net u:object_r:sysfs_net:s0
diff --git a/legacy/vendor/common/attributes b/legacy/vendor/common/attributes
index ed73f8c..1c3a088 100644
--- a/legacy/vendor/common/attributes
+++ b/legacy/vendor/common/attributes
@@ -123,3 +123,7 @@
 attribute hal_btconfigstore;
 attribute hal_btconfigstore_client;
 attribute hal_btconfigstore_server;
+
+attribute hal_dataconnection_qti;
+attribute hal_dataconnection_qti_client;
+attribute hal_dataconnection_qti_server;
diff --git a/legacy/vendor/common/file_contexts b/legacy/vendor/common/file_contexts
index 12e1fb9..b1d2650 100644
--- a/legacy/vendor/common/file_contexts
+++ b/legacy/vendor/common/file_contexts
@@ -304,6 +304,8 @@
 /(vendor|system/vendor)/bin/btnvtool            u:object_r:btnvtool_exec:s0
 /(vendor|system/vendor)/bin/btsnoop                             u:object_r:btsnoop_exec:s0
 /(vendor|system/vendor)/bin/wifidisplayhalservice               u:object_r:wifidisplayhalservice_qti_exec:s0
+/(vendor|system/vendor)/bin/wfdhdcphalservice                   u:object_r:wfdhdcphalservice_qti_exec:s0
+/(vendor|system/vendor)/bin/wfdvndservice                       u:object_r:wfdvndservice_exec:s0
 /(vendor|system/vendor)/bin/fmhal_service                       u:object_r:fmhal_service_exec:s0
 /(vendor|system/vendor)/bin/usf_epos            u:object_r:usf_exec:s0
 /(vendor|system/vendor)/bin/usf_gesture         u:object_r:usf_exec:s0
@@ -432,6 +434,7 @@
 /sys/devices/virtual/graphics/fb([0-3])+/msm_fb_persist_mode        u:object_r:sysfs_graphics:s0
 /sys/devices/virtual/graphics/fb([0-3])+/config                     u:object_r:sysfs_graphics:s0
 /sys/devices/virtual/rotator/mdss_rotator/caps                      u:object_r:sysfs_graphics:s0
+/sys/devices/virtual/hdcp/msm_hdcp/min_level_change                 u:object_r:sysfs_graphics:s0
 
 /sys/devices/platform/vfb.([0-3])+/graphics/fb([0-3])+/modes        u:object_r:sysfs_graphics:s0
 /sys/devices/platform/vfb.([0-3])+/graphics/fb([0-3])+/mode         u:object_r:sysfs_graphics:s0
@@ -652,6 +655,7 @@
 /vendor/lib(64)?/hw/gralloc\.msm8998\.so   u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/hw/android\.hardware\.graphics\.mapper@2\.0-impl-qti-display\.so   u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/vendor\.qti\.hardware\.display\.mapper@1\.0\.so   u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/libcamxexternalformatutils\.so                    u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libqdMetaData\.so         u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libqservice\.so           u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libqdutils\.so            u:object_r:same_process_hal_file:s0
@@ -659,6 +663,7 @@
 /vendor/lib(64)?/libgsl\.so                u:object_r:same_process_hal_file:s0
 
 /vendor/lib(64)?/hw/vulkan\.msm8998\.so    u:object_r:same_process_hal_file:s0
+/vendor/lib(64)?/hw/vulkan\.adreno\.so     u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libEGL_adreno\.so         u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libGLESv1_CM_adreno\.so   u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/libGLESv2_adreno\.so      u:object_r:same_process_hal_file:s0
diff --git a/legacy/vendor/common/hwservice_contexts b/legacy/vendor/common/hwservice_contexts
index 5adf25b..8b4765a 100644
--- a/legacy/vendor/common/hwservice_contexts
+++ b/legacy/vendor/common/hwservice_contexts
@@ -97,4 +97,5 @@
 vendor.qti.hardware.wifidisplaysession::IWifiDisplaySession  u:object_r:wifidisplayhalservice_hwservice:s0
 vendor.qti.hardware.wifidisplaysession::IWifiDisplaySessionVideoTrack    u:object_r:wifidisplayhalservice_hwservice:s0
 vendor.qti.hardware.wifidisplaysession::IWifiDisplaySessionAudioTrack    u:object_r:wifidisplayhalservice_hwservice:s0
+vendor.qti.hardware.wifidisplaysession::IWifiDisplaySessionImageTrack    u:object_r:wifidisplayhalservice_hwservice:s0
 vendor.qti.hardware.bluetooth_audio::IBluetoothAudioProvidersFactory u:object_r:hal_audio_hwservice:s0
diff --git a/legacy/vendor/common/mediacodec.te b/legacy/vendor/common/mediacodec.te
index 2319388..df8c90a 100644
--- a/legacy/vendor/common/mediacodec.te
+++ b/legacy/vendor/common/mediacodec.te
@@ -53,3 +53,5 @@
 allow mediacodec hal_display_config_hwservice:hwservice_manager find;
 allow mediacodec hal_graphics_composer_default:binder call;
 allow mediacodec qdisplay_service:service_manager find;
+#Allow mediacodec to access audio devices for tunnel decoding
+allow mediacodec audio_device:chr_file rw_file_perms;
diff --git a/legacy/vendor/common/property_contexts b/legacy/vendor/common/property_contexts
index 274ef19..d871452 100644
--- a/legacy/vendor/common/property_contexts
+++ b/legacy/vendor/common/property_contexts
@@ -33,6 +33,7 @@
 vendor.wc_transport.       u:object_r:vendor_bluetooth_prop:s0
 ro.vendor.bluetooth.       u:object_r:vendor_bluetooth_prop:s0
 vendor.ims.                u:object_r:qcom_ims_prop:s0
+ro.build.software.version  u:object_r:qcom_ims_prop:s0
 persist.vendor.ims.disabled       u:object_r:qcom_ims_prop:s0
 vendor.service.qti.ims.enabled    u:object_r:qcom_ims_prop:s0
 persist.vendor.ims.        u:object_r:qcom_ims_prop:s0
diff --git a/legacy/vendor/common/rild.te b/legacy/vendor/common/rild.te
index 7cddb89..588bc61 100644
--- a/legacy/vendor/common/rild.te
+++ b/legacy/vendor/common/rild.te
@@ -78,6 +78,7 @@
 add_hwservice(rild, hal_iwlan_hwservice)
 
 add_hwservice(rild, hal_dataconnection_hwservice)
+hal_server_domain(rild, hal_dataconnection_qti)
 
 get_prop(rild, exported3_radio_prop)
 set_prop(rild, vendor_xlat_prop)
diff --git a/legacy/vendor/common/system_server.te b/legacy/vendor/common/system_server.te
index d07a31e..e0ee7b5 100644
--- a/legacy/vendor/common/system_server.te
+++ b/legacy/vendor/common/system_server.te
@@ -102,7 +102,7 @@
 allow system_server usf:process signal;
 #allow system_server usf:unix_stream_socket connectto;
 
-get_prop(system_server, vendor_xlat_prop)
+hal_client_domain(system_server, hal_dataconnection_qti)
 
 #Allow access to netmgrd socket
 #netmgr_socket(system_server);
diff --git a/legacy/vendor/common/vendor_hal_dataconnection_qti.te b/legacy/vendor/common/vendor_hal_dataconnection_qti.te
new file mode 100644
index 0000000..e8d245c
--- /dev/null
+++ b/legacy/vendor/common/vendor_hal_dataconnection_qti.te
@@ -0,0 +1,31 @@
+# Copyright (c) 2019, 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.
+
+binder_call(hal_dataconnection_qti_client, hal_dataconnection_qti_server)
+binder_call(hal_dataconnection_qti_server, hal_dataconnection_qti_client)
+
+hal_attribute_hwservice(hal_dataconnection_qti, hal_dataconnection_hwservice)
diff --git a/legacy/vendor/common/vndservice.te b/legacy/vendor/common/vndservice.te
index 5dfda70..16b08dc 100644
--- a/legacy/vendor/common/vndservice.te
+++ b/legacy/vendor/common/vndservice.te
@@ -30,3 +30,4 @@
 type qseeproxy_service,                  vndservice_manager_type;
 type esepmdaemon_service,                vndservice_manager_type;
 type wfdnativemm_service,                vndservice_manager_type;
+type wfdhdcpvndservice_service,          vndservice_manager_type;
diff --git a/legacy/vendor/common/vndservice_contexts b/legacy/vendor/common/vndservice_contexts
index a426119..45435c1 100644
--- a/legacy/vendor/common/vndservice_contexts
+++ b/legacy/vendor/common/vndservice_contexts
@@ -30,3 +30,4 @@
 com.qualcomm.qti.qseeproxy                     u:object_r:qseeproxy_service:s0
 eSEPowerManagerService                         u:object_r:esepmdaemon_service:s0
 wfd.native.mm.service                          u:object_r:wfdnativemm_service:s0
+wfdhdcpvndservice                              u:object_r:wfdhdcpvndservice_service:s0
diff --git a/legacy/vendor/common/wfdhdcphalservice.te b/legacy/vendor/common/wfdhdcphalservice.te
new file mode 100644
index 0000000..4486e52
--- /dev/null
+++ b/legacy/vendor/common/wfdhdcphalservice.te
@@ -0,0 +1,44 @@
+# Copyright (c) 2019 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.
+
+#Define Domain
+type wfdhdcphalservice_qti, domain;
+type wfdhdcphalservice_qti_exec, exec_type, vendor_file_type, file_type;
+
+hal_server_domain(wfdhdcphalservice_qti, hal_drm)
+init_daemon_domain(wfdhdcphalservice_qti)
+
+#Allow to call wfdhdcpvndservice
+vndbinder_use(wfdhdcphalservice_qti)
+allow wfdhdcphalservice_qti wfdhdcpvndservice_service:service_manager find;
+binder_call(wfdhdcphalservice_qti, wfdvndservice);
+
+#Allow access to display config hal
+hal_client_domain(wfdhdcphalservice_qti, hal_graphics_composer)
+
+#Allow to use fd from mediacodec and wfd app
+allow wfdhdcphalservice_qti { mediacodec system_app }:fd use;
diff --git a/legacy/vendor/common/wfdvndservice.te b/legacy/vendor/common/wfdvndservice.te
new file mode 100644
index 0000000..c0b432d
--- /dev/null
+++ b/legacy/vendor/common/wfdvndservice.te
@@ -0,0 +1,53 @@
+# Copyright (c) 2019 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.
+
+
+#Define Domain
+type wfdvndservice, domain;
+type wfdvndservice_exec, exec_type, vendor_file_type, file_type;
+
+init_daemon_domain(wfdvndservice)
+
+#Allow net for hdcp connection
+net_domain(wfdvndservice)
+
+#Allow to use Vendor Binder IPC
+vndbinder_use(wfdvndservice)
+
+#Allow to host sink hdcp vnd service
+add_service(wfdvndservice, wfdhdcpvndservice_service)
+binder_call(wfdvndservice, wfdhdcphalservice_qti);
+
+#Allow access to firmware files for HDCP session
+r_dir_file(wfdvndservice, firmware_file)
+
+#Allow for using fds
+allow wfdvndservice { mediacodec system_app wfdhdcphalservice_qti}:fd use;
+
+#Allow access to tee/ion device
+allow wfdvndservice tee_device:chr_file rw_file_perms;
+allow wfdvndservice ion_device:chr_file r_file_perms;
diff --git a/legacy/vendor/test/dumpstate.te b/legacy/vendor/test/dumpstate.te
index 94a705d..72085b3 100644
--- a/legacy/vendor/test/dumpstate.te
+++ b/legacy/vendor/test/dumpstate.te
@@ -26,3 +26,12 @@
 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 allow dumpstate binder_state:file r_file_perms;
+
+#Needed by CTS test case
+allow dumpstate adsprpcd_file:dir getattr;
+allow dumpstate bt_firmware_file:dir getattr;
+allow dumpstate bt_firmware_file:filesystem getattr;
+allow dumpstate firmware_file:dir getattr;
+allow dumpstate firmware_file:filesystem getattr;
+dontaudit dumpstate sysfs:file * ;
+
diff --git a/qva/private/qvrd.te b/qva/private/qvrd.te
index 4feafd2..9cc750a 100644
--- a/qva/private/qvrd.te
+++ b/qva/private/qvrd.te
@@ -27,16 +27,24 @@
 
 typeattribute qvrd coredomain;
 typeattribute qvrd mlstrustedsubject;
-type qvrd_exec, exec_type, system_file_type, file_type;
+type qvrd_exec, system_file_type, exec_type, file_type;
 
 init_daemon_domain(qvrd)
 
+#
+# General
+#
+
 binder_call(qvrd, system_server);
 
 # Allow interracting with qvrd directory
 allow qvrd qvrd_data_file:dir create_dir_perms;
 allow qvrd qvrd_data_file:file create_file_perms;
 
+#allow binder use for checking permissions
+binder_use(qvrd)
+allow qvrd permission_service:service_manager find;
+
 #Allow hardware binder use
 hwbinder_use(qvrd)
 get_prop(qvrd, hwservicemanager_prop)
@@ -44,6 +52,10 @@
 # Allow access to our socket
 allow qvrd qvrd_socket:sock_file rw_file_perms;
 
+#
+# Sensors
+#
+
 
 # Allow access to sensor1 API
 allow qvrd self:socket create_socket_perms_no_ioctl;
diff --git a/qva/private/untrusted_app_all.te b/qva/private/untrusted_app_all.te
old mode 100755
new mode 100644
index b27b032..bcb1e2e
--- a/qva/private/untrusted_app_all.te
+++ b/qva/private/untrusted_app_all.te
@@ -26,3 +26,5 @@
 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 unix_socket_connect(untrusted_app_all, dpmtcm, dpmd)
+unix_socket_connect(untrusted_app_all, qvrd, qvrd)
+allow untrusted_app_all qvrd:fd use;
diff --git a/qva/vendor/common/attributes b/qva/vendor/common/attributes
index 549b2d6..5ecebe3 100644
--- a/qva/vendor/common/attributes
+++ b/qva/vendor/common/attributes
@@ -96,3 +96,7 @@
 attribute hal_btconfigstore;
 attribute hal_btconfigstore_client;
 attribute hal_btconfigstore_server;
+
+attribute hal_wifilearner;
+attribute hal_wifilearner_client;
+attribute hal_wifilearner_server;
diff --git a/qva/vendor/common/device.te b/qva/vendor/common/device.te
index 2b313a8..5adafd6 100755
--- a/qva/vendor/common/device.te
+++ b/qva/vendor/common/device.te
@@ -38,3 +38,9 @@
 type efs_boot_dev, dev_type;
 type smem_log_device, dev_type;
 type fm_radio_device, dev_type;
+
+#define qg char device
+type qg_device, dev_type;
+
+#define qvr external sensor device
+type qvr_external_sensor_device, dev_type;
diff --git a/qva/vendor/common/dumpstate.te b/qva/vendor/common/dumpstate.te
new file mode 100644
index 0000000..4cc4f23
--- /dev/null
+++ b/qva/vendor/common/dumpstate.te
@@ -0,0 +1,39 @@
+# Copyright (c) 2019, 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.
+
+
+# CTS test case  CtsSecurityHostTestCases#testNoBugreportDenials
+# tries to check the if there are any denials from
+# dumpstate. As per the b/131578979 discussion
+# adding dontaudit for now.
+
+allow dumpstate adsprpcd_file:dir getattr;
+allow dumpstate bt_firmware_file:dir getattr;
+allow dumpstate bt_firmware_file:filesystem getattr;
+allow dumpstate firmware_file:dir getattr;
+allow dumpstate firmware_file:filesystem getattr;
+dontaudit dumpstate sysfs:file *;
diff --git a/qva/vendor/common/file.te b/qva/vendor/common/file.te
index a043efb..42ec55c 100644
--- a/qva/vendor/common/file.te
+++ b/qva/vendor/common/file.te
@@ -95,3 +95,6 @@
 
 #rmnet module files
 type sysfs_rmnet, fs_type, sysfs_type;
+
+#qvrservice sysfs files
+type sysfs_qvr_external_sensor, sysfs_type, fs_type;
diff --git a/qva/vendor/common/file_contexts b/qva/vendor/common/file_contexts
index ceb644e..f584e5b 100644
--- a/qva/vendor/common/file_contexts
+++ b/qva/vendor/common/file_contexts
@@ -40,7 +40,9 @@
 /dev/mhi_.*                           u:object_r:mhi_device:s0
 /dev/smem_log                         u:object_r:smem_log_device:s0
 /dev/radio0                           u:object_r:fm_radio_device:s0
-
+/dev/qg                               u:object_r:qg_device:s0
+/dev/qg_battery                       u:object_r:qg_device:s0
+/dev/qvr_external_sensor_ioctl        u:object_r:qvr_external_sensor_device:s0
 ###################################
 # Dev socket nodes
 #
@@ -106,6 +108,7 @@
 /(vendor|system/vendor)/bin/fstman                                                 u:object_r:fstman_exec:s0
 /(vendor|system/vendor)/bin/wigighalsvc                                            u:object_r:wigighalsvc_exec:s0
 /(vendor|system/vendor)/bin/wigignpt                                               u:object_r:wigignpt_exec:s0
+/vendor/bin/hw/android\.hardware\.usb\@1\.[0-2]-service-qti                        u:object_r:hal_usb_qti_exec:s0
 
 #### Context for location features
 ## location daemons and binaries
@@ -138,6 +141,8 @@
 /sys/devices(/platform)?/soc/[a-z0-9]+\.qcom,pcie/pci[0-9:]+/[0-9:\.]+/[0-9:\.]+/net/wigig0/queues/rx-0/rps_cpus  u:object_r:sysfs_wigig:s0
 /sys/devices(/platform)?/soc/[a-z0-9]+\.qcom,pcie/pci[0-9:]+/[0-9:\.]+/[0-9:\.]+/net/wigig0/gro_flush_timeout     u:object_r:sysfs_wigig:s0
 
+/sys/devices(/platform)?/soc/soc:qcom,gpubw/devfreq/soc:qcom,gpubw(/.*)? u:object_r:sysfs_devfreq:s0
+
 ###################################
 # data files
 #
@@ -154,6 +159,7 @@
 /data/vendor/qdma(/.*)?                                             u:object_r:vendor_qdma_data_file:s0
 /data/vendor/vpp(/.*)?                                              u:object_r:vendor_vpp_data_file:s0
 /data/vendor/wifi/wigig_hostapd(/.*)?                               u:object_r:wigig_hostapd_socket:s0
+/data/vendor/lm(/.*)?                                               u:object_r:lm_data_file:s0
 
 ###################################
 # persist files
@@ -173,3 +179,6 @@
 # SVA files
 /vendor/lib(64)?/liblistenjni\.so          u:object_r:same_process_hal_file:s0
 /vendor/lib(64)?/liblistensoundmodel2\.so  u:object_r:same_process_hal_file:s0
+
+#wifilearner daemon
+/(vendor|system/vendor)/bin/wifilearner    u:object_r:wifilearnersvc_exec:s0
diff --git a/qva/vendor/common/genfs_contexts b/qva/vendor/common/genfs_contexts
index 98dc7b7..ef96868 100644
--- a/qva/vendor/common/genfs_contexts
+++ b/qva/vendor/common/genfs_contexts
@@ -37,3 +37,5 @@
 genfscon sysfs /devices/platform/soc/soc:qcom,msm-ext-disp/extcon/extcon1/cable.0/ u:object_r:sysfs_graphics:s0
 
 genfscon sysfs /module/rmnet_perf/parameters u:object_r:sysfs_rmnet:s0
+
+genfscon sysfs /kernel/qvr_external_sensor u:object_r:sysfs_qvr_external_sensor:s0
diff --git a/qva/vendor/common/hal_camera.te b/qva/vendor/common/hal_camera.te
index db472fc..7e239e2 100644
--- a/qva/vendor/common/hal_camera.te
+++ b/qva/vendor/common/hal_camera.te
@@ -29,3 +29,5 @@
 allowxperm hal_camera self:qipcrtr_socket ioctl msm_sock_ipc_ioctls;
 
 hal_client_domain(hal_camera_default, hal_vpp)
+
+allow hal_camera gpu_device:chr_file rw_file_perms;
diff --git a/qva/vendor/common/hal_perf_default.te b/qva/vendor/common/hal_perf_default.te
index 7a0d75c..915bfd3 100644
--- a/qva/vendor/common/hal_perf_default.te
+++ b/qva/vendor/common/hal_perf_default.te
@@ -25,7 +25,7 @@
 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-type hal_perf_default, domain;
+type hal_perf_default, domain, mlstrustedsubject;
 hal_server_domain_bypass(hal_perf_default, hal_perf)
 
 type hal_perf_default_exec, exec_type, vendor_file_type, file_type;
diff --git a/qva/vendor/common/hal_sensors_default.te b/qva/vendor/common/hal_sensors_default.te
new file mode 100644
index 0000000..69aee35
--- /dev/null
+++ b/qva/vendor/common/hal_sensors_default.te
@@ -0,0 +1,28 @@
+# Copyright (c) 2019, 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.
+
+allow hal_sensors_default qvrd:fd use;
diff --git a/qva/vendor/common/hal_usb.te b/qva/vendor/common/hal_usb.te
new file mode 100644
index 0000000..d67cf01
--- /dev/null
+++ b/qva/vendor/common/hal_usb.te
@@ -0,0 +1,41 @@
+# Copyright (c) 2019, 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.
+
+type hal_usb_qti, domain;
+hal_server_domain(hal_usb_qti, hal_usb_gadget)
+hal_server_domain(hal_usb_qti, hal_usb)
+
+type hal_usb_qti_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(hal_usb_qti)
+
+get_prop(hal_usb_qti, vendor_usb_prop)
+set_prop(hal_usb_qti, vendor_usb_prop)
+
+allow hal_usb_qti configfs:file create_file_perms;
+allow hal_usb_qti sysfs_usb_c:dir r_dir_perms;
+allow hal_usb_qti sysfs_usb_c:lnk_file r_file_perms;
+allow hal_usb_qti sysfs_usb_c:file rw_file_perms;
diff --git a/qva/vendor/common/hvdcp.te b/qva/vendor/common/hvdcp.te
index 9ba92b9..22a25dc 100644
--- a/qva/vendor/common/hvdcp.te
+++ b/qva/vendor/common/hvdcp.te
@@ -33,6 +33,7 @@
 
 # Add rules for access permissions
 allow hvdcp hvdcp_device:chr_file rw_file_perms;
+allow hvdcp qg_device:chr_file rw_file_perms;
 allow hvdcp {
     sysfs_battery_supply
     sysfs_usb_supply
@@ -64,5 +65,5 @@
 allow hvdcp persist_hvdcp_file:dir rw_dir_perms;
 allow hvdcp persist_hvdcp_file:file create_file_perms;
 
-get_prop(hvdcp, vendor_hvdcp_opti_prop)
+set_prop(hvdcp, vendor_hvdcp_opti_prop)
 wakelock_use(hvdcp)
diff --git a/qva/vendor/common/hwservice.te b/qva/vendor/common/hwservice.te
index b0a3083..573d0a6 100644
--- a/qva/vendor/common/hwservice.te
+++ b/qva/vendor/common/hwservice.te
@@ -46,3 +46,4 @@
 type hal_cvp_hwservice, hwservice_manager_type;
 type hal_fm_hwservice, hwservice_manager_type;
 type hal_btconfigstore_hwservice, hwservice_manager_type;
+type hal_wifilearner_hwservice, hwservice_manager_type;
diff --git a/qva/vendor/common/hwservice_contexts b/qva/vendor/common/hwservice_contexts
index 5063e73..cb52692 100644
--- a/qva/vendor/common/hwservice_contexts
+++ b/qva/vendor/common/hwservice_contexts
@@ -52,6 +52,7 @@
 vendor.qti.hardware.data.latency::ILinkLatency               u:object_r:hal_latency_hwservice:s0
 vendor.qti.hardware.scve.objecttracker::IObjectTracker       u:object_r:hal_scve_hwservice:s0
 vendor.qti.hardware.scve.panorama::IPanoramaStitching        u:object_r:hal_scve_hwservice:s0
+vendor.qti.hardware.scve.panorama::IPanoramaTracking         u:object_r:hal_scve_hwservice:s0
 vendor.qti.hardware.soter::ISoter                            u:object_r:hal_soter_hwservice:s0
 vendor.qti.hardware.fm::IFmHci                               u:object_r:hal_fm_hwservice:s0
 vendor.qti.esepowermanager::IEsePowerManager                 u:object_r:hal_esepowermanager_hwservice:s0
@@ -62,5 +63,7 @@
 vendor.qti.hardware.wifidisplaysession::IWifiDisplaySession  u:object_r:wifidisplayhalservice_hwservice:s0
 vendor.qti.hardware.wifidisplaysession::IWifiDisplaySessionVideoTrack    u:object_r:wifidisplayhalservice_hwservice:s0
 vendor.qti.hardware.wifidisplaysession::IWifiDisplaySessionAudioTrack    u:object_r:wifidisplayhalservice_hwservice:s0
+vendor.qti.hardware.wifidisplaysession::IWifiDisplaySessionImageTrack    u:object_r:wifidisplayhalservice_hwservice:s0
 vendor.qti.hardware.wifi.hostapd::IHostapdVendor             u:object_r:hal_wifi_hostapd_hwservice:s0
 vendor.qti.hardware.bluetooth_audio::IBluetoothAudioProvidersFactory  u:object_r:hal_audio_hwservice:s0
+vendor.qti.hardware.wifi.wifilearner::IWifiStats             u:object_r:hal_wifilearner_hwservice:s0
diff --git a/qva/vendor/common/platform_app.te b/qva/vendor/common/platform_app.te
index 3c0d975..3a130e3 100644
--- a/qva/vendor/common/platform_app.te
+++ b/qva/vendor/common/platform_app.te
@@ -28,3 +28,7 @@
 
 #perf
 hal_client_domain(platform_app, hal_perf)
+#cvp
+hal_client_domain(platform_app, hal_cvp)
+#scve
+hal_client_domain(platform_app, hal_scve)
diff --git a/qva/vendor/common/property.te b/qva/vendor/common/property.te
index 027c1bb..606a2af 100644
--- a/qva/vendor/common/property.te
+++ b/qva/vendor/common/property.te
@@ -73,3 +73,9 @@
 
 # hvdcp_opti prop
 type vendor_hvdcp_opti_prop, property_type;
+
+# property for xlat
+type vendor_xlat_prop, property_type;
+
+#qvr property
+type vendor_qvr_prop, property_type;
diff --git a/qva/vendor/common/property_contexts b/qva/vendor/common/property_contexts
index 805ea75..385ab9c 100644
--- a/qva/vendor/common/property_contexts
+++ b/qva/vendor/common/property_contexts
@@ -89,3 +89,9 @@
 persist.vendor.vin.                          u:object_r:vendor_hvdcp_opti_prop:s0
 persist.vendor.qg.                           u:object_r:vendor_hvdcp_opti_prop:s0
 persist.vendor.soh.                          u:object_r:vendor_hvdcp_opti_prop:s0
+
+# XLAT property
+persist.vendor.net.doxlat                    u:object_r:vendor_xlat_prop:s0
+
+#qvr properties
+vendor.qvr                       u:object_r:vendor_qvr_prop:s0
diff --git a/qva/vendor/common/qvrd.te b/qva/vendor/common/qvrd.te
new file mode 100644
index 0000000..3c052e7
--- /dev/null
+++ b/qva/vendor/common/qvrd.te
@@ -0,0 +1,89 @@
+# Copyright (c) 2016, 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.
+
+#
+# General
+#
+
+userdebug_or_eng(` allow qvrd diag_device:chr_file rw_file_perms');
+#r_dir_file(qvrd, vendor_file)
+r_dir_file(qvrd, sysfs_kgsl)
+
+#
+# Sensors
+#
+
+# Allow access to ADSP & SLPI
+allow qvrd { ion_device qdsp_device dsp_device xdsp_device }:chr_file r_file_perms;
+
+
+#
+# Display
+#
+
+# Allow access to /sys/devices/virtual/graphics/fb* for lineptr interrupts
+allow qvrd sysfs_graphics:file r_file_perms;
+
+#
+# Camera
+#
+
+hal_client_domain(qvrd, hal_camera);
+
+# Allow access to camera HAL and UVC nodes
+allow qvrd device:dir r_dir_perms;
+allow qvrd { gpu_device video_device camera_device sensors_device }:chr_file r_file_perms;
+
+
+#
+# Perfd
+#
+
+hal_client_domain(qvrd, hal_perf)
+
+allow qvrd fwk_sensor_hwservice:hwservice_manager find;
+hal_client_domain(qvrd, hal_sensors)
+
+# QVRD
+userdebug_or_eng(`
+allow qvrd debugfs:dir r_dir_perms;
+allow qvrd qti_debugfs:dir r_dir_perms;
+allow qvrd qti_debugfs:file rw_file_perms;
+')
+
+# Allow access to kgsl sysfs nodes for performance optimization
+allow qvrd sysfs_kgsl:file r_file_perms;
+
+# Allow access to qvr_external_sensor sysfs nodes for external viewers
+allow qvrd sysfs_qvr_external_sensor:dir r_dir_perms;
+allow qvrd sysfs_qvr_external_sensor:file rw_file_perms;
+
+# Allow access to qvr_external_sensor device nodes for external viewers
+allow qvrd qvr_external_sensor_device:chr_file rw_file_perms;
+
+# qvr properties
+get_prop(qvrd, vendor_qvr_prop)
diff --git a/qva/vendor/common/rild.te b/qva/vendor/common/rild.te
index 1678e79..b8e86ec 100644
--- a/qva/vendor/common/rild.te
+++ b/qva/vendor/common/rild.te
@@ -25,3 +25,4 @@
 # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+set_prop(rild, vendor_xlat_prop)
diff --git a/qva/vendor/common/system_server.te b/qva/vendor/common/system_server.te
index 38494b8..80ea1d0 100644
--- a/qva/vendor/common/system_server.te
+++ b/qva/vendor/common/system_server.te
@@ -44,4 +44,7 @@
 # allow WIGIG framework to access the capability config store
 hal_client_domain(system_server, hal_capabilityconfigstore_qti);
 # allow WIGIG framework access to wil6210 sysfs files like thermal_throttling
-allow system_server sysfs_wigig:file rw_file_perms;
\ No newline at end of file
+allow system_server sysfs_wigig:file rw_file_perms;
+
+# allow system_server to access IWifiStats HAL service
+hal_client_domain(system_server, hal_wifilearner);
diff --git a/qva/vendor/common/vendor_init.te b/qva/vendor/common/vendor_init.te
index fd2c11e..51eb47c 100644
--- a/qva/vendor/common/vendor_init.te
+++ b/qva/vendor/common/vendor_init.te
@@ -46,3 +46,5 @@
 userdebug_or_eng(`
   set_prop(vendor_init, vendor_audio_debug_prop)
 ')
+
+set_prop(vendor_init, vendor_disable_spu_prop)
diff --git a/qva/vendor/common/wifilearnersvc.te b/qva/vendor/common/wifilearnersvc.te
new file mode 100644
index 0000000..fe66018
--- /dev/null
+++ b/qva/vendor/common/wifilearnersvc.te
@@ -0,0 +1,41 @@
+# Copyright (c) 2019, 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.
+
+type wifilearnersvc, domain;
+type wifilearnersvc_exec, exec_type, vendor_file_type, file_type;
+
+init_daemon_domain(wifilearnersvc)
+hal_server_domain(wifilearnersvc, hal_wifilearner)
+
+#allows calls between client and server and vice-versa
+binder_call(hal_wifilearner_client, hal_wifilearner_server)
+binder_call(hal_wifilearner_server, hal_wifilearner_client)
+
+#register hal service and allow hal clients to find the service
+hal_attribute_hwservice(hal_wifilearner, hal_wifilearner_hwservice)
+
+allow hal_wifilearner self:netlink_generic_socket create_socket_perms_no_ioctl;
diff --git a/qva/vendor/lito/genfs_contexts b/qva/vendor/lito/genfs_contexts
new file mode 100644
index 0000000..d51ba81
--- /dev/null
+++ b/qva/vendor/lito/genfs_contexts
@@ -0,0 +1,52 @@
+# Copyright (c) 2019, 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.
+
+# Power supply device nodes
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/battery u:object_r:sysfs_battery_supply:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/dc u:object_r:sysfs_battery_supply:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/main u:object_r:sysfs_battery_supply:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qpnp,qg/power_supply/bms u:object_r:sysfs_battery_supply:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/pc_port u:object_r:sysfs_usb_supply:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,qpnp-smb5/power_supply/usb u:object_r:sysfs_usb_supply:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-02/c440000.qcom,spmi:qcom,pm7250b@2:qcom,usb-pdphy@1700/usbpd/usbpd0 u:object_r:sysfs_usbpd_device:s0
+genfscon sysfs /class/qcom-battery u:object_r:sysfs_battery_supply:s0
+
+#qdss sysfs-node
+genfscon sysfs /devices/platform/soc/6b05000.tmc/coresight-tmc-etf u:object_r:sysfs_qdss_dev:s0
+genfscon sysfs /devices/platform/soc/6048000.tmc/coresight-tmc-etr u:object_r:sysfs_qdss_dev:s0
+genfscon sysfs /devices/platform/soc/6002000.stm/coresight-stm u:object_r:sysfs_qdss_dev:s0
+genfscon sysfs /devices/platform/soc/soc:hwevent/coresight-hwevent u:object_r:sysfs_qdss_dev:s0
+genfscon sysfs /devices/platform/soc/6b0c000.csr/coresight-swao-csr u:object_r:sysfs_qdss_dev:s0
+genfscon sysfs /devices/platform/soc/soc:dummy_source/coresight-modem-diag u:object_r:sysfs_qdss_dev:s0
+
+# PMIC UI peripherals
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm8150@0:qcom,pm8150_rtc/rtc u:object_r:sysfs_rtc:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-03/c440000.qcom,spmi:qcom,pm7250b@3:qcom,vibrator@5300/leds/vibrator u:object_r:sysfs_leds:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-05/c440000.qcom,spmi:qcom,pm8150a@5:qcom,leds@d000/leds/red u:object_r:sysfs_graphics:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-05/c440000.qcom,spmi:qcom,pm8150a@5:qcom,leds@d000/leds/green u:object_r:sysfs_graphics:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-05/c440000.qcom,spmi:qcom,pm8150a@5:qcom,leds@d000/leds/blue u:object_r:sysfs_graphics:s0
+genfscon sysfs /devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-05/c440000.qcom,spmi:qcom,pm8150a@5:qcom,leds@d300/leds u:object_r:sysfs_leds:s0
diff --git a/qva/vendor/test/attributes b/qva/vendor/test/attributes
new file mode 100644
index 0000000..a4332f8
--- /dev/null
+++ b/qva/vendor/test/attributes
@@ -0,0 +1,31 @@
+# Copyright (c) 2019, 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.
+
+
+attribute qtiloopback;
+attribute qtiloopback_server;
+attribute qtiloopback_client;
diff --git a/qva/vendor/test/file_contexts b/qva/vendor/test/file_contexts
index e411009..4160940 100644
--- a/qva/vendor/test/file_contexts
+++ b/qva/vendor/test/file_contexts
@@ -27,3 +27,4 @@
 
 # for system_server to access /sys/kernel/debug/binder/state
 /sys/kernel/debug/binder/state                                      u:object_r:binder_state:s0
+/vendor/bin/Loopback_native 	                                    u:object_r:qtiloopback_native_exec:s0
diff --git a/qva/vendor/test/hwservice.te b/qva/vendor/test/hwservice.te
new file mode 100644
index 0000000..5aa04e3
--- /dev/null
+++ b/qva/vendor/test/hwservice.te
@@ -0,0 +1,29 @@
+
+# Copyright (c) 2019, 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.
+
+type qtiloopback_hwservice , hwservice_manager_type;
diff --git a/qva/vendor/test/hwservice_contexts b/qva/vendor/test/hwservice_contexts
new file mode 100644
index 0000000..5080691
--- /dev/null
+++ b/qva/vendor/test/hwservice_contexts
@@ -0,0 +1,28 @@
+# Copyright (c) 2019, 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.
+
+com.qualcomm.qti.loopbackhal::Iloopback                      u:object_r:qtiloopback_hwservice:s0
diff --git a/qva/vendor/test/qtiloopback_app.te b/qva/vendor/test/qtiloopback_app.te
new file mode 100644
index 0000000..1bc5ff3
--- /dev/null
+++ b/qva/vendor/test/qtiloopback_app.te
@@ -0,0 +1,38 @@
+# Copyright (c) 2019, 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.
+
+type qtiloopback_app, domain;
+app_domain(qtiloopback_app)
+userdebug_or_eng(`
+hal_client_domain(qtiloopback_app,qtiloopback)
+
+allow qtiloopback_app activity_service:service_manager find;
+allow qtiloopback_app cgroup:file rw_file_perms;
+allow qtiloopback_app system_app_data_file:dir r_dir_perms;
+allow qtiloopback_app app_api_service:service_manager find;
+
+')
diff --git a/qva/vendor/test/qtiloopback_native.te b/qva/vendor/test/qtiloopback_native.te
new file mode 100644
index 0000000..f903389
--- /dev/null
+++ b/qva/vendor/test/qtiloopback_native.te
@@ -0,0 +1,54 @@
+
+# Copyright (c) 2019, 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.
+
+type qtiloopback_native, domain;
+type qtiloopback_native_exec, exec_type, vendor_file_type, file_type;
+init_daemon_domain(qtiloopback_native)
+vndbinder_use(qtiloopback)
+userdebug_or_eng(`
+
+hal_server_domain_bypass(qtiloopback_native,qtiloopback)
+binder_call(qtiloopback_client,qtiloopback_server)
+binder_call(qtiloopback_server,qtiloopback_client)
+hal_attribute_hwservice(qtiloopback, qtiloopback_hwservice)
+
+netmgr_socket(qtiloopback_native)
+allow qtiloopback_native self:{
+    # Allow receiving NETLINK responses from WLAN driver.
+    netlink_socket
+    netlink_generic_socket
+    qipcrtr_socket
+    netlink_route_socket
+} create_socket_perms_no_ioctl;
+
+allow qtiloopback_native sysfs_diag:dir search;
+allow qtiloopback_native sysfs_timestamp_switch:file { open read };
+allow qtiloopback_native self:netlink_route_socket nlmsg_read;
+allow qtiloopback_native self:udp_socket { create ioctl };
+
+')
diff --git a/qva/vendor/test/seapp_contexts b/qva/vendor/test/seapp_contexts
index cc1f68d..a270ad1 100644
--- a/qva/vendor/test/seapp_contexts
+++ b/qva/vendor/test/seapp_contexts
@@ -27,4 +27,5 @@
 
 # Add new domain for location test apps
 user=_app seinfo=platform name=com.qualcomm.qct.dlt levelfrom=all domain=location_app_test type=app_data_file
-user=_app seinfo=platform name=com.qualcomm.qti.qlogcat levelfrom=all domain=location_app_test type=app_data_file
\ No newline at end of file
+user=_app seinfo=platform name=com.qualcomm.qti.qlogcat levelfrom=all domain=location_app_test type=app_data_file
+user=system seinfo=platform name=.loopbackservice domain=qtiloopback_app type=system_app_data_file