diff options
| author | 2023-02-16 03:50:01 +0000 | |
|---|---|---|
| committer | 2023-02-16 03:50:01 +0000 | |
| commit | ab322f4fd1bea681e821c25d1747b9b58b512759 (patch) | |
| tree | 976586914f3e051338b862efeafbb0042f82298a | |
| parent | 8931ca6ba7787198f9e0e04017dc3173b7cf6bea (diff) | |
| parent | 91e3f29f369b58bfb18162b0786df85c110dacf3 (diff) | |
Merge "libbinder: warn when vndbinder use is wasted" am: c847b39215 am: 91e3f29f36
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2433883
Change-Id: I03bfea9439915d03cf84d142e660cea691de86bf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | libs/binder/ProcessState.cpp | 9 | ||||
| -rw-r--r-- | libs/binder/include/binder/ProcessState.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index 254dda81a6..5f1f50672a 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -100,6 +100,10 @@ static void verifyNotForked(bool forked) { LOG_ALWAYS_FATAL_IF(forked, "libbinder ProcessState can not be used after fork"); } +bool ProcessState::isVndservicemanagerEnabled() { + return access("/vendor/bin/vndservicemanager", R_OK) == 0; +} + sp<ProcessState> ProcessState::init(const char *driver, bool requireDefault) { #ifdef BINDER_IPC_32BIT @@ -123,6 +127,11 @@ sp<ProcessState> ProcessState::init(const char *driver, bool requireDefault) driver = "/dev/binder"; } + if (0 == strcmp(driver, "/dev/vndbinder") && !isVndservicemanagerEnabled()) { + ALOGE("vndservicemanager is not started on this device, you can save resources/threads " + "by not initializing ProcessState with /dev/vndbinder."); + } + // we must install these before instantiating the gProcess object, // otherwise this would race with creating it, and there could be the // possibility of an invalid gProcess object forked by another thread diff --git a/libs/binder/include/binder/ProcessState.h b/libs/binder/include/binder/ProcessState.h index 471c9949aa..ce578e3f5c 100644 --- a/libs/binder/include/binder/ProcessState.h +++ b/libs/binder/include/binder/ProcessState.h @@ -38,6 +38,8 @@ public: static sp<ProcessState> self(); static sp<ProcessState> selfOrNull(); + static bool isVndservicemanagerEnabled(); + /* initWithDriver() can be used to configure libbinder to use * a different binder driver dev node. It must be called *before* * any call to ProcessState::self(). The default is /dev/vndbinder |