summaryrefslogtreecommitdiff
path: root/libs/binder/BackendUnifiedServiceManager.cpp
diff options
context:
space:
mode:
author Devin Moore <devinmoore@google.com> 2024-10-23 17:12:19 +0000
committer Devin Moore <devinmoore@google.com> 2024-10-25 21:58:02 +0000
commit74bc589a226cf790a7d600dbe32a3a5861a5b265 (patch)
tree8546eae7f00c9fc5fd672b4a066fc94629eb03ae /libs/binder/BackendUnifiedServiceManager.cpp
parentdcca938df5392f77110c0a89820f0e22ae379b55 (diff)
Use ProcessState::selfOrNull in ServiceManager APIs
Allow the APIs to be used when ProcessState isn't initialized. This allows the use of these APIs in systems like microdroid where there is no kernel binder driver. Test: atest vm_accessor_test Bug: 358427181 Change-Id: Ie981b0ca4335ddc7a5676d30721c01be1ffdf35e
Diffstat (limited to 'libs/binder/BackendUnifiedServiceManager.cpp')
-rw-r--r--libs/binder/BackendUnifiedServiceManager.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libs/binder/BackendUnifiedServiceManager.cpp b/libs/binder/BackendUnifiedServiceManager.cpp
index f7b9f059a5..dfc084a661 100644
--- a/libs/binder/BackendUnifiedServiceManager.cpp
+++ b/libs/binder/BackendUnifiedServiceManager.cpp
@@ -105,7 +105,8 @@ static const char* kStaticCachableList[] = {
};
bool BinderCacheWithInvalidation::isClientSideCachingEnabled(const std::string& serviceName) {
- if (ProcessState::self()->getThreadPoolMaxTotalThreadCount() <= 0) {
+ sp<ProcessState> self = ProcessState::selfOrNull();
+ if (!self || self->getThreadPoolMaxTotalThreadCount() <= 0) {
ALOGW("Thread Pool max thread count is 0. Cannot cache binder as linkToDeath cannot be "
"implemented. serviceName: %s",
serviceName.c_str());