Merge changes I1e2cf37e,I76da777e,Ib8842773
* changes:
Simplify hello world example, fix build for external
Implement dynamic loading of nanoapps
Clean up EventLoop, fix shutdown sequence
diff --git a/host/hal_generic/generic_context_hub.cc b/host/hal_generic/generic_context_hub.cc
index 82c40b0..a122bea 100644
--- a/host/hal_generic/generic_context_hub.cc
+++ b/host/hal_generic/generic_context_hub.cc
@@ -32,6 +32,7 @@
namespace implementation {
using ::android::hardware::Return;
+using ::android::hardware::contexthub::V1_0::AsyncEventType;
using ::android::hardware::contexthub::V1_0::Result;
using ::android::hardware::contexthub::V1_0::TransactionResult;
using ::android::chre::HostProtocolHost;
@@ -236,6 +237,20 @@
}
}
+void GenericContextHub::SocketCallbacks::onConnected() {
+ if (mHaveConnected) {
+ ALOGI("Reconnected to CHRE daemon");
+ if (mParent.mCallbacks != nullptr) {
+ mParent.mCallbacks->handleHubEvent(AsyncEventType::RESTARTED);
+ }
+ }
+ mHaveConnected = true;
+}
+
+void GenericContextHub::SocketCallbacks::onDisconnected() {
+ ALOGW("Lost connection to CHRE daemon");
+}
+
void GenericContextHub::SocketCallbacks::handleNanoappMessage(
uint64_t appId, uint32_t messageType, uint16_t hostEndpoint,
const void *messageData, size_t messageDataLen) {
diff --git a/host/hal_generic/generic_context_hub.h b/host/hal_generic/generic_context_hub.h
index f1c54c5..6b3abb6 100644
--- a/host/hal_generic/generic_context_hub.h
+++ b/host/hal_generic/generic_context_hub.h
@@ -66,6 +66,8 @@
public:
SocketCallbacks(GenericContextHub& parent);
void onMessageReceived(const void *data, size_t length) override;
+ void onConnected() override;
+ void onDisconnected() override;
void handleNanoappMessage(
uint64_t appId, uint32_t messageType, uint16_t hostEndpoint,
@@ -85,6 +87,7 @@
private:
GenericContextHub& mParent;
+ bool mHaveConnected = false;
};
sp<SocketCallbacks> mSocketCallbacks;