Merge tag 'LA.UM.9.6.2.c26-02500-89xx.0' into int/11/fp3

"LA.UM.9.6.2.c26-02500-89xx.0"

* tag 'LA.UM.9.6.2.c26-02500-89xx.0':
  ueventd: Set permissions for KGSL sysfs node

Change-Id: Id2892086a62503672402d6ab36e3585ed3e86e32
diff --git a/dlkm/AndroidKernelModule.mk b/dlkm/AndroidKernelModule.mk
index 2d2ddad..9d0c57e 100644
--- a/dlkm/AndroidKernelModule.mk
+++ b/dlkm/AndroidKernelModule.mk
@@ -120,6 +120,13 @@
 	      cp $1 $1.unsigned; \
 	      $(MODULE_SIGN_FILE) \$$KMOD_SIG_HASH $(MODSECKEY) $(MODPUBKEY) $1; \
 	   fi; \
+	   signed=`find $(TARGET_OUT_VENDOR) -type f -name texfat.ko`; \
+	   unsigned=`find $(PRODUCT_OUT) -maxdepth 1 -type f -name texfat.ko` ; \
+	   if [ -n \"\$$unsigned\" ] && [ -z \"\$$signed\" ]; then \
+	       echo \"Signing kernel module: texfat\"; \
+	       $(MODULE_SIGN_FILE) \$$KMOD_SIG_HASH $(MODSECKEY) $(MODPUBKEY) $(DRIVER_UNSIGNED_PATH) $(DRIVER_SIGNED_PATH); \
+	       echo \"Signing complete\" ; \
+	   fi; \
 	"
 endef
 
diff --git a/generate_extra_images.mk b/generate_extra_images.mk
index 30a75fe..32eec00 100644
--- a/generate_extra_images.mk
+++ b/generate_extra_images.mk
@@ -56,6 +56,7 @@
     $(hide) $(call assert-max-image-size,$@,$(BOARD_PERSISTIMAGE_PARTITION_SIZE))
 endef
 
+ifneq ($(strip $(FP3_SKIP_PERSIST_IMG)),true)
 $(INSTALLED_PERSISTIMAGE_TARGET): $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(INTERNAL_PERSISTIMAGE_FILES)
 	$(build-persistimage-target)
 
@@ -66,6 +67,7 @@
 .PHONY: persistimage
 persistimage: $(INSTALLED_PERSISTIMAGE_TARGET)
 
+endif #end of FP3_SKIP_PERSIST_IMG
 endif
 endif
 
@@ -267,6 +269,3 @@
 $(BUILT_SYSTEMIMAGE): otavendormod
 
 endif
-
-#Print PRODUCT_PACKAGES & PRODUCT_PACKAGES_DEBUG to output log
-$(call dump-products)
diff --git a/nfc/libnfc-brcm.conf b/nfc/libnfc-brcm.conf
index 9eca31c..d39a140 100644
--- a/nfc/libnfc-brcm.conf
+++ b/nfc/libnfc-brcm.conf
@@ -76,7 +76,7 @@
 # NXP PN65T 0x03
 # NXP PN548C2 0x02
 # NXP PN66T 0x03
-NFA_MAX_EE_SUPPORTED=0x03
+NFA_MAX_EE_SUPPORTED=0x02
 ##############################################################################
 # Deactivate notification wait time out in seconds used in ETSI Reader mode
 # 0 - Infinite wait
@@ -94,7 +94,7 @@
 # eSE               0x01
 # UICC              0x02
 
-NXP_PRFD_TECH_SE=0x01
+NXP_PRFD_TECH_SE=0x02
 
 ################################################################################
 #Set bit to 1 , black list is enabled
diff --git a/qti_whitelist.xml b/qti_whitelist.xml
index 7dcadbd..bf679a4 100755
--- a/qti_whitelist.xml
+++ b/qti_whitelist.xml
@@ -48,6 +48,8 @@
     <allow-in-power-save package="com.qualcomm.qti.callenhancement" />
     <allow-in-power-save package="com.qualcomm.qti.smartassistant" />
     <allow-in-power-save package="com.skyhook.blp" />
+    <!-- These are customer apps that need to freely run in the background -->
+    <allow-in-power-save package="com.netcompany.smittestop_exposure_notification" />
     <!-- These telephony applications need access to non-[System]SDK APIs -->
     <hidden-api-whitelisted-app package="com.qualcomm.uimremoteserver" />
     <hidden-api-whitelisted-app package="com.qualcomm.uimremoteclient" />
diff --git a/rootdir/etc/init.qcom.early_boot.sh b/rootdir/etc/init.qcom.early_boot.sh
old mode 100644
new mode 100755
index 96337ba..b2e880d
--- a/rootdir/etc/init.qcom.early_boot.sh
+++ b/rootdir/etc/init.qcom.early_boot.sh
@@ -452,13 +452,6 @@
         setprop persist.vendor.radio.atfwd.start true;;
 esac
 
-#set default lcd density
-#Since lcd density has read only
-#property, it will not overwrite previous set
-#property if any target is setting forcefully.
-set_density_by_fb
-
-
 # set Lilliput LCD density for ADP
 product=`getprop ro.build.product`
 
@@ -552,3 +545,12 @@
     gpu_freq=`cat /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies` 2> /dev/null
     setprop vendor.gpu.available_frequencies "$gpu_freq"
 fi
+
+batinfo=`cat /sys/class/power_supply/bms/resistance_id`
+if [ "$batinfo" -ge 9000 ] && [ "$batinfo" -le 11000 ]; then
+    setprop ro.hardware.battery_info "F3AC - 3060mAh"
+elif [ "$batinfo" -ge 42500 ] && [ "$batinfo" -le 57500 ]; then
+    setprop ro.hardware.battery_info "F3AC1 - 3000mAh"
+else
+    setprop ro.hardware.battery_info "Unknown battery"
+fi
diff --git a/rootdir/etc/init.qcom.post_boot.sh b/rootdir/etc/init.qcom.post_boot.sh
index 3ebdc9b..0ec3edb 100644
--- a/rootdir/etc/init.qcom.post_boot.sh
+++ b/rootdir/etc/init.qcom.post_boot.sh
@@ -1084,15 +1084,6 @@
     fi
 }
 
-function start_hbtp()
-{
-        # Start the Host based Touch processing but not in the power off mode.
-        bootmode=`getprop ro.bootmode`
-        if [ "charger" != $bootmode ]; then
-                start vendor.hbtp
-        fi
-}
-
 case "$target" in
     "msm7201a_ffa" | "msm7201a_surf" | "msm7627_ffa" | "msm7627_6x" | "msm7627a"  | "msm7627_surf" | \
     "qsd8250_surf" | "qsd8250_ffa" | "msm7630_surf" | "msm7630_1x" | "msm7630_fusion" | "qsd8650a_st1x")
@@ -1434,26 +1425,6 @@
                 if [ -f /sys/devices/soc0/hw_platform ]; then
                     hw_platform=`cat /sys/devices/soc0/hw_platform`
                 fi
-                case "$soc_id" in
-                    "239")
-                    case "$hw_platform" in
-                        "Surf")
-                            case "$platform_subtype_id" in
-                                "1" | "2")
-                                    start_hbtp
-                                ;;
-                            esac
-                        ;;
-                        "MTP")
-                            case "$platform_subtype_id" in
-                                "3")
-                                    start_hbtp
-                                ;;
-                            esac
-                        ;;
-                    esac
-                    ;;
-                esac
             ;;
             "268" | "269" | "270" | "271")
                 echo 10 > /sys/class/net/rmnet0/queues/rx-0/rps_cpus
@@ -2280,28 +2251,6 @@
         case "$soc_id" in
             "293" | "304" | "338" | "351")
 
-                # Start Host based Touch processing
-                case "$hw_platform" in
-                     "MTP" | "Surf" | "RCM" )
-                        #if this directory is present, it means that a
-                        #1200p panel is connected to the device.
-                        dir="/sys/bus/i2c/devices/3-0038"
-                        if [ ! -d "$dir" ]; then
-                              start_hbtp
-                        fi
-                        ;;
-                esac
-
-                if [ $soc_id -eq "338" ]; then
-                    case "$hw_platform" in
-                        "QRD" )
-                            if [ $platform_subtype_id -eq "1" ]; then
-                               start_hbtp
-                            fi
-                            ;;
-                    esac
-                fi
-
                 #init task load, restrict wakeups to preferred cluster
                 echo 15 > /proc/sys/kernel/sched_init_task_load
 
@@ -2439,13 +2388,6 @@
         case "$soc_id" in
             "349" | "350")
 
-            # Start Host based Touch processing
-            case "$hw_platform" in
-                 "MTP" | "Surf" | "RCM" | "QRD" )
-                          start_hbtp
-                    ;;
-            esac
-
             for devfreq_gov in /sys/class/devfreq/qcom,mincpubw*/governor
             do
                 echo "cpufreq" > $devfreq_gov
@@ -2624,20 +2566,6 @@
         case "$soc_id" in
            "303" | "307" | "308" | "309" | "320" | "386" | "436")
 
-                  # Start Host based Touch processing
-                  case "$hw_platform" in
-                    "MTP" )
-			start_hbtp
-                        ;;
-                  esac
-
-                  case "$hw_platform" in
-                    "Surf" | "RCM" )
-			if [ $platform_subtype_id -ne "4" ]; then
-			    start_hbtp
-		        fi
-                        ;;
-                  esac
                 # Apply Scheduler and Governor settings for 8917 / 8920
 
                 echo 20000000 > /proc/sys/kernel/sched_ravg_window
@@ -2719,13 +2647,6 @@
         case "$soc_id" in
              "294" | "295" | "313" )
 
-                  # Start Host based Touch processing
-                  case "$hw_platform" in
-                    "MTP" | "Surf" | "RCM" )
-                        start_hbtp
-                        ;;
-                  esac
-
                 # Apply Scheduler and Governor settings for 8937/8940
 
                 # HMP scheduler settings
@@ -2822,12 +2743,6 @@
         case "$soc_id" in
              "354" | "364" | "353" | "363" )
 
-                # Start Host based Touch processing
-                case "$hw_platform" in
-                    "MTP" | "Surf" | "RCM" | "QRD" )
-                    start_hbtp
-                ;;
-                esac
 
                 # Apply settings for sdm429/sda429/sdm439/sda439
                 if [ $KernelVersionA -ge 4 ] && [ $KernelVersionB -ge 19 ]; then
@@ -3044,17 +2959,6 @@
             ;;
         esac
 
-        case "$soc_id" in
-             "386" | "436")
-
-                # Start Host based Touch processing
-                case "$hw_platform" in
-                    "QRD" )
-                    start_hbtp
-                ;;
-                esac
-	    ;;
-	esac
     ;;
 esac
 
@@ -3131,25 +3035,12 @@
             # Start cdsprpcd only for sdm660 and disable for sdm630
             start vendor.cdsprpcd
 
-            # Start Host based Touch processing
-                case "$hw_platform" in
-                        "MTP" | "Surf" | "RCM" | "QRD" )
-                        start_hbtp
-                        ;;
-                esac
             ;;
         esac
         #Apply settings for sdm630 and Tahaa
         case "$soc_id" in
             "318" | "327" | "385" )
 
-            # Start Host based Touch processing
-            case "$hw_platform" in
-                "MTP" | "Surf" | "RCM" | "QRD" )
-                start_hbtp
-                ;;
-            esac
-
 	    # Disable cdsprpcd daemon for sdm630
 	    setprop vendor.fastrpc.disable.cdsprpcd.daemon 1
 
@@ -3332,13 +3223,6 @@
         case "$soc_id" in
             "336" | "337" | "347" | "360" | "393" )
 
-            # Start Host based Touch processing
-            case "$hw_platform" in
-              "MTP" | "Surf" | "RCM" | "QRD" )
-                  start_hbtp
-                  ;;
-            esac
-
       # Core control parameters on silver
       echo 0 0 0 0 1 1 > /sys/devices/system/cpu/cpu0/core_ctl/not_preferred
       echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
@@ -4579,18 +4463,6 @@
         case "$soc_id" in
             "347" )
 
-            # Start Host based Touch processing
-            case "$hw_platform" in
-              "Surf" | "RCM" | "QRD" )
-                  start_hbtp
-                  ;;
-              "MTP" )
-                  if [ $platform_subtype_id != 5 ]; then
-                      start_hbtp
-                  fi
-                  ;;
-            esac
-
       # Core control parameters on silver
       echo 4 > /sys/devices/system/cpu/cpu0/core_ctl/min_cpus
       echo 60 > /sys/devices/system/cpu/cpu0/core_ctl/busy_up_thres
@@ -5092,25 +4964,6 @@
                 platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
         fi
 
-        case "$soc_id" in
-                "321" | "341")
-                # Start Host based Touch processing
-                case "$hw_platform" in
-                    "QRD" )
-                            case "$platform_subtype_id" in
-                                   "32") #QVR845 do nothing
-                                     ;;
-                                   *)
-                                         start_hbtp
-                                     ;;
-                            esac
-                     ;;
-                    *)
-                          start_hbtp
-                     ;;
-                esac
-         ;;
-        esac
 	# Core control parameters
 	echo 2 > /sys/devices/system/cpu/cpu4/core_ctl/min_cpus
 	echo 60 > /sys/devices/system/cpu/cpu4/core_ctl/busy_up_thres
@@ -5376,22 +5229,6 @@
         platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
     fi
 
-    case "$hw_platform" in
-        "MTP" | "Surf" | "RCM" )
-            # Start Host based Touch processing
-            case "$platform_subtype_id" in
-                "0" | "1" | "2" | "3" | "4")
-                    start_hbtp
-                    ;;
-            esac
-        ;;
-        "HDK" )
-            if [ -d /sys/kernel/hbtpsensor ] ; then
-                start_hbtp
-            fi
-        ;;
-    esac
-
     echo 0 > /sys/module/lpm_levels/parameters/sleep_disabled
     configure_memory_parameters
     target_type=`getprop ro.hardware.type`
@@ -5590,22 +5427,6 @@
         platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
     fi
 
-    case "$hw_platform" in
-        "MTP" | "Surf" | "RCM" )
-            # Start Host based Touch processing
-            case "$platform_subtype_id" in
-                "0" | "1")
-                    start_hbtp
-                    ;;
-            esac
-        ;;
-        "HDK" )
-            if [ -d /sys/kernel/hbtpsensor ] ; then
-                start_hbtp
-            fi
-        ;;
-    esac
-
 	#Setting the min and max supported frequencies
 	reg_val=`cat /sys/devices/platform/soc/780130.qfprom/qfprom0/nvmem | od -An -t d4`
 	feature_id=$(((reg_val >> 20) & 0xFF))
@@ -5928,27 +5749,6 @@
 		platform_subtype_id=`cat /sys/devices/soc0/platform_subtype_id`
 	fi
 
-	case "$soc_id" in
-		"292") #msm8998 apq8098_latv
-		# Start Host based Touch processing
-		case "$hw_platform" in
-		"QRD")
-			case "$platform_subtype_id" in
-				"0")
-					start_hbtp
-					;;
-				"16")
-					if [ $platform_major_version -lt 6 ]; then
-						start_hbtp
-					fi
-					;;
-			esac
-
-			;;
-		esac
-	    ;;
-	esac
-
 	echo N > /sys/module/lpm_levels/system/pwr/cpu0/ret/idle_enabled
 	echo N > /sys/module/lpm_levels/system/pwr/cpu1/ret/idle_enabled
 	echo N > /sys/module/lpm_levels/system/pwr/cpu2/ret/idle_enabled
diff --git a/rootdir/etc/init.qcom.rc b/rootdir/etc/init.qcom.rc
index 77b75c0..29e7391 100755
--- a/rootdir/etc/init.qcom.rc
+++ b/rootdir/etc/init.qcom.rc
@@ -28,6 +28,7 @@
 import /vendor/etc/init/hw/init.qti.ufs.rc
 import /vendor/etc/init/hw/init.qcom.usb.rc
 import /vendor/etc/init/hw/init.qcom.test.rc
+import /vendor/etc/init/hw/init.msm.usb.configfs.rc
 import /vendor/etc/init/hw/init.target.rc
 import /vendor/etc/init/hw/init.qcom.factory.rc
 
@@ -90,7 +91,6 @@
     write /sys/devices/virtual/cvp/cvp/boot 1
     exec u:r:vendor_qti_init_shell:s0 -- /vendor/bin/init.qcom.early_boot.sh
     exec u:r:vendor_qti_init_shell:s0 -- /vendor/bin/init.qti.can.sh
-    setprop ro.sf.lcd_density ${vendor.display.lcd_density}
 
     chown system system /mnt/vendor/persist/data/pfm/licenses
     chmod 0775 /mnt/vendor/persist/data/pfm/licenses
@@ -145,7 +145,7 @@
     chmod 2770 /dev/socket/qmux_radio
 
     mkdir /persist/drm 0770 system system
-    mkdir /persist/bluetooth 0770 bluetooth bluetooth
+    mkdir /mnt/vendor/persist/bluetooth 0770 bluetooth bluetooth
     mkdir /persist/misc 0770 system system
     mkdir /persist/alarm 0770 system system
     mkdir /mnt/vendor/persist/time 0770 system system
@@ -900,13 +900,6 @@
     disabled
     oneshot
 
-service vendor.hbtp /vendor/bin/hbtp_daemon
-     class main
-     user system
-     group system
-     capabilities SYS_NICE
-     disabled
-
 service chre /vendor/bin/chre
     class late_start
     user system
diff --git a/rootdir/etc/init.qcom.sh b/rootdir/etc/init.qcom.sh
index b80e98a..bfb9281 100644
--- a/rootdir/etc/init.qcom.sh
+++ b/rootdir/etc/init.qcom.sh
@@ -216,7 +216,6 @@
         else
              hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
         fi
-
         case "$soc_id" in
              "317" | "324" | "325" | "326" | "318" | "327" )
                   case "$hw_platform" in
@@ -374,24 +373,6 @@
         else
              hw_platform=`cat /sys/devices/system/soc/soc0/hw_platform`
         fi
-        case "$soc_id" in
-             "293" | "304" | "338" | "351" | "349" | "350" )
-                  case "$hw_platform" in
-                       "Surf")
-                                    setprop qemu.hw.mainkeys 0
-                                    ;;
-                       "MTP")
-                                    setprop qemu.hw.mainkeys 0
-                                    ;;
-                       "RCM")
-                                    setprop qemu.hw.mainkeys 0
-                                    ;;
-                       "QRD")
-                                    setprop qemu.hw.mainkeys 0
-                                    ;;
-                  esac
-                  ;;
-       esac
         ;;
     "sdm710")
         if [ -f /sys/devices/soc0/soc_id ]; then
diff --git a/rootdir/etc/init.qcom.test.rc b/rootdir/etc/init.qcom.test.rc
index 85b2fa9..08b4966 100644
--- a/rootdir/etc/init.qcom.test.rc
+++ b/rootdir/etc/init.qcom.test.rc
@@ -25,9 +25,6 @@
 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-on early-init
-    write /proc/sys/kernel/kptr_restrict 0
-
 # this will make sure you have /data ready and then you try to create the dir.
 on post-fs-data
     # Create directory for Graphics applications
diff --git a/rootdir/etc/ueventd.qcom.rc b/rootdir/etc/ueventd.qcom.rc
index e7a4561..ac5da0e 100644
--- a/rootdir/etc/ueventd.qcom.rc
+++ b/rootdir/etc/ueventd.qcom.rc
@@ -29,7 +29,7 @@
 # Firmware directory Path
 # Below macro will be read by uevent and path will
 # be added to search path for firmware loading
-firmware_directories /vendor/firmware_mnt/image/
+firmware_directories /vendor/firmware/ /vendor/firmware_mnt/image/
 
 # the DIAG device node is not world writable/readable.
 /dev/diag                 0660   system     oem_2901
@@ -172,9 +172,6 @@
 /dev/qg                   0660  system     system
 /dev/qg_battery           0660  system     system
 
-#qvr
-/dev/qvr_external_sensor_ioctl      0660  system  system
-/sys/kernel/qvr_external_sensor/fd  0660  system  system
 /dev/bus/usb/001/002      0660   system     system
 /dev/bus/usb/001/003      0660   system     system
 /dev/bus/usb/001/004      0660   system     system
@@ -227,7 +224,7 @@
 /dev/msm_evrc             0660   system     audio
 /dev/msm_wma              0660   system     audio
 /dev/msm_wmapro           0660   system     audio
-/dev/msm_alac             0660   system     audio
+#/dev/msm_alac             0660   system     audio
 /dev/msm_ape              0660   system     audio
 /dev/msm_amrnb            0660   system     audio
 /dev/msm_amrwb            0660   system     audio
@@ -326,6 +323,9 @@
 /sys/devices/soc/600000.qcom,pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/wlan0/queues/rx-* rps_cpus 0660 system system
 /sys/devices/soc/600000.qcom,pcie/pci0000:00/0000:00:00.0/0000:01:00.0/net/p2p0/queues/rx-* rps_cpus 0660 system system
 
+# wlan loadable module
+/sys/module/wlan*   /parameters/fwpath        0660   wifi       wifi
+
 # wigig
 /sys/bus/pci/drivers/wil6210* 0000:01:00.0/wil6210/fst_link_loss 0660 wifi wifi
 /sys/bus/pci/drivers/wil6210* 0000:01:00.0/wil6210/thermal_throttling 0660 system system
@@ -358,10 +358,6 @@
 /sys/class/fts/touch_aoi aoi_set 0660 root system
 /sys/class/fts/touch_aoi power_set 0660 root system
 
-#ImproveTouch device
-/dev/hbtp_input           0660   system     system
-/dev/hbtp_vm              0660   system     system
-
 # Add device block for FRP
 /dev/block/platform/soc/7824900.sdhci/by-name/config    0600   system     system
 /dev/block/platform/soc/7464900.sdhci/by-name/frp       0600   system     system
@@ -385,16 +381,19 @@
 # LED class devices
 /sys/class/leds/red      delay_on     0640    system    system
 /sys/class/leds/red      delay_off    0640    system    system
-/sys/class/leds/red      breath       0640    system    system
+/sys/class/leds/red      breath       0666    system    system
 /sys/class/leds/red      trigger      0640    system    system
 /sys/class/leds/green    delay_on     0640    system    system
 /sys/class/leds/green    delay_off    0640    system    system
-/sys/class/leds/green    breath       0640    system    system
+/sys/class/leds/green    breath       0666    system    system
 /sys/class/leds/green    trigger      0640    system    system
 /sys/class/leds/blue     delay_on     0640    system    system
 /sys/class/leds/blue     delay_off    0640    system    system
-/sys/class/leds/blue     breath       0640    system    system
+/sys/class/leds/blue     breath       0666    system    system
 /sys/class/leds/blue     trigger      0640    system    system
+/sys/class/leds/red      brightness   0666    system    system
+/sys/class/leds/green    brightness   0666    system    system
+/sys/class/leds/blue     brightness   0666    system    system
 
 # NPU device
 /dev/msm_npu             0644   system     system
@@ -438,7 +437,6 @@
 /sys/class/graphics/fb0     modes                    0664    system  graphics
 /sys/class/graphics/fb0     mode                     0664    system  graphics
 /sys/class/graphics/fb0     msm_cmd_autorefresh_en   0664    system  graphics
-*/
 
 /sys/devices/platform/soc/ae00000.qcom,mdss_mdp power/control 0664 system graphics