Return existing interfaces for repeated getExtension calls
Also, reset static state in destructors of interfaces.
Until now, new interfaces were being created for each repeated
getExtension() call to the Gnss interface. This was causing
asserts to fail which were checking for multiple
simultaneous instances of these interfaces.
Death notifications should still required to be created for all
interfaces including callback interfaces.
Bug: 35391416
Test: Verified that Maps still work after forcing a system_server
crash.
Change-Id: I8ce0888016637a3d9b62db5619a3c8c569262c0d
diff --git a/gnss/1.0/default/GnssXtra.cpp b/gnss/1.0/default/GnssXtra.cpp
index 065bb33..d124ce1 100644
--- a/gnss/1.0/default/GnssXtra.cpp
+++ b/gnss/1.0/default/GnssXtra.cpp
@@ -35,6 +35,7 @@
GnssXtra::~GnssXtra() {
sThreadFuncArgsList.clear();
+ sInterfaceExists = false;
}
pthread_t GnssXtra::createThreadCb(const char* name, void (*start)(void*), void* arg) {
@@ -53,7 +54,10 @@
return;
}
- sGnssXtraCbIface->downloadRequestCb();
+ auto ret = sGnssXtraCbIface->downloadRequestCb();
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
// Methods from ::android::hardware::gnss::V1_0::IGnssXtra follow.