Snap for 4810559 from f68bbe081debe61204b216eb4ea7bebe8bdc0208 to pi-release

Change-Id: I86cfd7cd8107e778cc41890c5563c10be4ca04fd
diff --git a/Makefile b/Makefile
index d712ef4..54a1a19 100644
--- a/Makefile
+++ b/Makefile
@@ -77,6 +77,7 @@
 # implementation of CHRE. Example: this CHRE implementation is never built for
 # google_cm4_nanohub as Nanohub itself is a CHRE implementation.
 include $(CHRE_PREFIX)/build/variant/google_arm64_android.mk
+include $(CHRE_PREFIX)/build/variant/google_hexagonv55_slpi-see.mk
 include $(CHRE_PREFIX)/build/variant/google_hexagonv60_slpi.mk
 include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi.mk
 include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi-uimg.mk
diff --git a/build/arch/hexagon.mk b/build/arch/hexagon.mk
index cedf33a..ea35293 100644
--- a/build/arch/hexagon.mk
+++ b/build/arch/hexagon.mk
@@ -28,6 +28,9 @@
 
 # Hexagon Compiler Flags #######################################################
 
+# Define CUST_H to allow including the customer header file.
+TARGET_CFLAGS += -DCUST_H
+
 # Add Hexagon compiler flags
 TARGET_CFLAGS += $(HEXAGON_CFLAGS)
 
@@ -71,7 +74,7 @@
 
 # Supported Hexagon Architectures ##############################################
 
-HEXAGON_SUPPORTED_ARCHS = v60 v62 v65
+HEXAGON_SUPPORTED_ARCHS = v55 v60 v62 v65
 
 # Environment Checks ###########################################################
 
diff --git a/build/nanoapp/app.mk b/build/nanoapp/app.mk
index 13989f2..1ac1041 100644
--- a/build/nanoapp/app.mk
+++ b/build/nanoapp/app.mk
@@ -107,6 +107,7 @@
 # Supported variants includes
 include $(CHRE_PREFIX)/build/variant/google_arm64_android.mk
 include $(CHRE_PREFIX)/build/variant/google_cm4_nanohub.mk
+include $(CHRE_PREFIX)/build/variant/google_hexagonv55_slpi-see.mk
 include $(CHRE_PREFIX)/build/variant/google_hexagonv60_slpi.mk
 include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi.mk
 include $(CHRE_PREFIX)/build/variant/google_hexagonv62_slpi-uimg.mk
diff --git a/build/variant/google_hexagonv55_slpi-see.mk b/build/variant/google_hexagonv55_slpi-see.mk
new file mode 100644
index 0000000..c418569
--- /dev/null
+++ b/build/variant/google_hexagonv55_slpi-see.mk
@@ -0,0 +1,43 @@
+#
+# Google CHRE Reference Implementation for Hexagon v55 Architecture on SLPI
+#
+
+include $(CHRE_PREFIX)/build/clean_build_template_args.mk
+
+TARGET_NAME = google_hexagonv55_slpi-see
+# Sized based on the buffer allocated in the host daemon (4096 bytes), minus
+# FlatBuffer overhead (max 80 bytes), minus some extra space to make a nice
+# round number and allow for addition of new fields to the FlatBuffer
+TARGET_CFLAGS = -DCHRE_MESSAGE_TO_HOST_MAX_SIZE=4000
+TARGET_CFLAGS += $(GOOGLE_HEXAGONV55_SLPI-SEE_CFLAGS)
+TARGET_VARIANT_SRCS = $(GOOGLE_HEXAGONV55_SLPI-SEE_SRCS)
+TARGET_SO_LATE_LIBS = $(GOOGLE_HEXAGONV55_SLPI-SEE_LATE_LIBS)
+TARGET_PLATFORM_ID = 0x476f6f676c000004
+HEXAGON_ARCH = v55
+
+TARGET_CFLAGS += $(SLPI_CFLAGS)
+TARGET_VARIANT_SRCS += $(SLPI_SRCS)
+
+# Add SLPI/SEE-specific compiler flags and source files
+TARGET_CFLAGS += $(SLPI_SEE_CFLAGS)
+TARGET_CFLAGS += $(SLPI_SEE_QMI_CFLAGS)
+TARGET_VARIANT_SRCS += $(SLPI_SEE_SRCS)
+TARGET_VARIANT_SRCS += $(SLPI_SEE_QMI_SRCS)
+
+ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
+ifneq ($(IS_NANOAPP_BUILD),)
+TARGET_SO_LATE_LIBS += $(CHRE_PREFIX)/build/app_support/google_slpi/libchre_slpi_skel.so
+include $(CHRE_PREFIX)/build/nanoapp/google_slpi.mk
+endif
+
+include $(CHRE_PREFIX)/build/arch/hexagon.mk
+
+# remove any CUST_H definitions by common code for this variant
+TARGET_CFLAGS := $(filter-out -DCUST_H%, $(TARGET_CFLAGS))
+# add our private definition, only if requested by variant config
+ifdef TARGET_V55_CUST_H
+TARGET_CFLAGS += -DCUST_H=\"$(TARGET_V55_CUST_H)\"
+endif
+
+include $(CHRE_PREFIX)/build/build_template.mk
+endif
diff --git a/build/variant/google_hexagonv65_slpi-see-uimg.mk b/build/variant/google_hexagonv65_slpi-see-uimg.mk
index 4af02ce..c7b5faa 100644
--- a/build/variant/google_hexagonv65_slpi-see-uimg.mk
+++ b/build/variant/google_hexagonv65_slpi-see-uimg.mk
@@ -22,7 +22,9 @@
 
 # Add SLPI/SEE-specific compiler flags and source files
 TARGET_CFLAGS += $(SLPI_SEE_CFLAGS)
+TARGET_CFLAGS += $(SLPI_SEE_QSK_CFLAGS)
 TARGET_VARIANT_SRCS += $(SLPI_SEE_SRCS)
+TARGET_VARIANT_SRCS += $(SLPI_SEE_QSK_SRCS)
 
 # Enable uImage support.
 TARGET_VARIANT_SRCS += $(SYS_SUPPORT_PATH)/qcom/uimg_dl_ver.c
diff --git a/build/variant/google_hexagonv65_slpi-see.mk b/build/variant/google_hexagonv65_slpi-see.mk
index 46fd2f0..979a29f 100644
--- a/build/variant/google_hexagonv65_slpi-see.mk
+++ b/build/variant/google_hexagonv65_slpi-see.mk
@@ -20,7 +20,9 @@
 
 # Add SLPI/SEE-specific compiler flags and source files
 TARGET_CFLAGS += $(SLPI_SEE_CFLAGS)
+TARGET_CFLAGS += $(SLPI_SEE_QSK_CFLAGS)
 TARGET_VARIANT_SRCS += $(SLPI_SEE_SRCS)
+TARGET_VARIANT_SRCS += $(SLPI_SEE_QSK_SRCS)
 
 ifneq ($(filter $(TARGET_NAME)% all, $(MAKECMDGOALS)),)
 ifneq ($(IS_NANOAPP_BUILD),)
diff --git a/platform/platform.mk b/platform/platform.mk
index 449e0a6..cb03d4d 100644
--- a/platform/platform.mk
+++ b/platform/platform.mk
@@ -17,9 +17,6 @@
 
 # SLPI-specific Compiler Flags #################################################
 
-# Define CUST_H to allow including the customer header file.
-SLPI_CFLAGS += -DCUST_H
-
 # Include paths.
 SLPI_CFLAGS += -I$(SLPI_PREFIX)/build/ms
 SLPI_CFLAGS += -I$(SLPI_PREFIX)/build/cust
@@ -136,7 +133,7 @@
 SLPI_SEE_SRCS += platform/slpi/see/see_helper.cc
 
 SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc/framework/cm/pb/sns_client.pb.c
-SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc/framework/qcm/pb/sns_client_qsocket.pb.c
+SLPI_SEE_QSK_SRCS += $(SLPI_PREFIX)/ssc/framework/qcm/pb/sns_client_qsocket.pb.c
 SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc/framework/suid_sensor/pb/sns_suid.pb.c
 SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc/sensors/pb/sns_cal.pb.c
 SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc/sensors/pb/sns_physical_sensor_test.pb.c
@@ -147,7 +144,8 @@
 SLPI_SEE_SRCS += $(SLPI_PREFIX)/ssc/sensors/pb/sns_std_type.pb.c
 
 SLPI_SEE_SRCS += $(SLPI_PREFIX)/chre/chre/src/system/chre/platform/slpi/sns_osa.c
-SLPI_SEE_SRCS += $(SLPI_PREFIX)/chre/chre/src/system/chre/platform/slpi/sns_qsocket_client.c
+SLPI_SEE_QSK_SRCS += $(SLPI_PREFIX)/chre/chre/src/system/chre/platform/slpi/sns_qsocket_client.c
+SLPI_SEE_QMI_SRCS += $(SLPI_PREFIX)/chre/chre/src/system/chre/platform/slpi/sns_qmi_client.c
 
 # Simulator-specific Compiler Flags ############################################
 
diff --git a/platform/slpi/see/platform_sensor.cc b/platform/slpi/see/platform_sensor.cc
index c78d5b8..fa56270 100644
--- a/platform/slpi/see/platform_sensor.cc
+++ b/platform/slpi/see/platform_sensor.cc
@@ -402,7 +402,7 @@
 
   static SeeHelperCallback seeHelperCallback;
   if (!getSeeHelper()->init(&seeHelperCallback)) {
-    LOGE("Failed to initialize SEE helper");
+    FATAL_ERROR("Failed to initialize SEE helper");
   }
 }
 
@@ -416,7 +416,7 @@
   DynamicVector<SuidAttr> tempSensors;
   if (!getSuidAndAttrs("sensor_temperature", &tempSensors,
                        CHRE_SEE_NUM_TEMP_SENSORS)) {
-      LOGE("Failed to get temperature sensor UID and attributes");
+      FATAL_ERROR("Failed to get temperature sensor UID and attributes");
   }
 
 #ifndef CHREX_SENSOR_SUPPORT
@@ -437,7 +437,7 @@
 
     DynamicVector<SuidAttr> primarySensors;
     if (!getSuidAndAttrs(dataType, &primarySensors, 1 /* minNumSuids */)) {
-      LOGE("Failed to get primary sensor UID and attributes");
+      FATAL_ERROR("Failed to get primary sensor UID and attributes");
     } else {
       for (const auto& primarySensor : primarySensors) {
         sns_std_suid suid = primarySensor.suid;