Not abort when the function is not found in dns_helper.so
As the NDK API name is not final until reviewed by NDK council, it is
possible that after rolling out DnsResolver the methods would need to be
renamed.
Bug: 314893716
Test: manually change code to dlsym a non-existing function and there is
no crash.
Change-Id: I3da924c87a0e3995b8eb8fa8f4d1176a92fbc9e3
diff --git a/DnsProxyListener.cpp b/DnsProxyListener.cpp
index e70ddb4..8064aef 100644
--- a/DnsProxyListener.cpp
+++ b/DnsProxyListener.cpp
@@ -685,7 +685,8 @@
InitFn ADnsHelper_init = reinterpret_cast<InitFn>(dlsym(handle, "ADnsHelper_init"));
if (!ADnsHelper_init) {
LOG(ERROR) << __func__ << ": " << dlerror();
- abort();
+ // TODO: Change to abort() when NDK is finalized
+ return nullptr;
}
const int ret = (*ADnsHelper_init)();
if (ret) {
@@ -697,7 +698,8 @@
reinterpret_cast<IsUidBlockedFn>(dlsym(handle, "ADnsHelper_isUidNetworkingBlocked"));
if (!f) {
LOG(ERROR) << __func__ << ": " << dlerror();
- abort();
+ // TODO: Change to abort() when NDK is finalized
+ return nullptr;
}
return f;
}