Use sensors PD when running on ADSP

CHRE daemon needs to initialize connection before connecting to ADSP.

Bug: 113644341
Test: Compile pass, push chre to /vendor/bin and reboot.
      Verify CHRE can be connected and load nanoapps.
Change-Id: Ib8f527da2fcabdb8d3618bcf23bb0f420a1375b3
Signed-off-by: Rick Chen <rickctchen@google.com>
diff --git a/host/msm/daemon/chre_daemon.cc b/host/msm/daemon/chre_daemon.cc
index f2f2921..462e654 100644
--- a/host/msm/daemon/chre_daemon.cc
+++ b/host/msm/daemon/chre_daemon.cc
@@ -61,6 +61,12 @@
 
 #include <utils/SystemClock.h>
 
+#ifdef ADSPRPC
+#include "remote.h"
+
+#define ITRANSPORT_PREFIX "'\":;./\\"
+#endif  // ADSPRPC
+
 //! The format string to use for logs from the CHRE implementation.
 #define HUB_LOG_FORMAT_STR "Hub (t=%.6f): %s"
 
@@ -696,6 +702,17 @@
   struct reverse_monitor_thread_data reverse_monitor;
   ::android::chre::SocketServer server;
 
+#ifdef ADSPRPC
+  remote_handle remote_handle_fd = 0xFFFFFFFF;
+  LOGD("Attaching to ADSP sensors PD");
+  if (remote_handle_open(ITRANSPORT_PREFIX "createstaticpd:sensorspd",
+                         &remote_handle_fd)) {
+    LOGE("Failed to open remote handle for sensorspd");
+  } else {
+    LOGV("Successfully opened remote handle for sensorspd");
+  }
+#endif  // ADSPRPC
+
 #ifdef CHRE_DAEMON_LPMA_ENABLED
   initWakeLockFds();
 #endif  // CHRE_DAEMON_LPMA_ENABLED