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/AGnssRil.cpp b/gnss/1.0/default/AGnssRil.cpp
index 480571d..1458327 100644
--- a/gnss/1.0/default/AGnssRil.cpp
+++ b/gnss/1.0/default/AGnssRil.cpp
@@ -42,6 +42,7 @@
AGnssRil::~AGnssRil() {
sThreadFuncArgsList.clear();
+ sInterfaceExists = false;
}
void AGnssRil::requestSetId(uint32_t flags) {
@@ -50,7 +51,10 @@
return;
}
- sAGnssRilCbIface->requestSetIdCb(flags);
+ auto ret = sAGnssRilCbIface->requestSetIdCb(flags);
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
void AGnssRil::requestRefLoc(uint32_t /*flags*/) {
@@ -59,7 +63,10 @@
return;
}
- sAGnssRilCbIface->requestRefLocCb();
+ auto ret = sAGnssRilCbIface->requestRefLocCb();
+ if (!ret.isOk()) {
+ ALOGE("%s: Unable to invoke callback", __func__);
+ }
}
pthread_t AGnssRil::createThreadCb(const char* name, void (*start)(void*), void* arg) {