diff options
-rw-r--r-- | libs/binder/ndk/include_platform/android/binder_ibinder_platform.h | 2 | ||||
-rw-r--r-- | libs/binder/ndk/include_platform/android/binder_process.h | 13 | ||||
-rw-r--r-- | libs/binder/ndk/libbinder_ndk.map.txt | 1 | ||||
-rw-r--r-- | libs/binder/ndk/process.cpp | 4 |
4 files changed, 20 insertions, 0 deletions
diff --git a/libs/binder/ndk/include_platform/android/binder_ibinder_platform.h b/libs/binder/ndk/include_platform/android/binder_ibinder_platform.h index 89f21dda21..783e11f0e9 100644 --- a/libs/binder/ndk/include_platform/android/binder_ibinder_platform.h +++ b/libs/binder/ndk/include_platform/android/binder_ibinder_platform.h @@ -62,6 +62,8 @@ __attribute__((weak, warn_unused_result)) const char* AIBinder_getCallingSid() _ * This must be called before the object is sent to another process. * Aborts on invalid values. Not thread safe. * + * This overrides the setting in ABinderProcess_disableBackgroundScheduling. + * * \param binder local server binder to set the policy for * \param policy scheduler policy as defined in linux UAPI * \param priority priority. [-20..19] for SCHED_NORMAL, [1..99] for RT diff --git a/libs/binder/ndk/include_platform/android/binder_process.h b/libs/binder/ndk/include_platform/android/binder_process.h index 6aff994a15..2432099d6e 100644 --- a/libs/binder/ndk/include_platform/android/binder_process.h +++ b/libs/binder/ndk/include_platform/android/binder_process.h @@ -75,6 +75,19 @@ bool ABinderProcess_isThreadPoolStarted(void); void ABinderProcess_joinThreadPool(void); /** + * Disables (or enables) background scheduling. + * + * By default, binder threads execute at a lower priority. However, this can cause + * priority inversion, so it is recommended to be disabled in high priority + * or in system processes. + * + * See also AIBinder_setMinSchedulerPolicy, which overrides this setting. + * + * \param disable whether to disable background scheduling + */ +void ABinderProcess_disableBackgroundScheduling(bool disable); + +/** * This gives you an fd to wait on. Whenever data is available on the fd, * ABinderProcess_handlePolledCommands can be called to handle binder queries. * This is expected to be used in a single threaded process which waits on diff --git a/libs/binder/ndk/libbinder_ndk.map.txt b/libs/binder/ndk/libbinder_ndk.map.txt index a63716522e..d4eb8c7579 100644 --- a/libs/binder/ndk/libbinder_ndk.map.txt +++ b/libs/binder/ndk/libbinder_ndk.map.txt @@ -229,6 +229,7 @@ LIBBINDER_NDK_PLATFORM { AIBinder_fromPlatformBinder*; AIBinder_toPlatformBinder*; AParcel_viewPlatformParcel*; + ABinderProcess_disableBackgroundScheduling; }; local: *; diff --git a/libs/binder/ndk/process.cpp b/libs/binder/ndk/process.cpp index 0072ac3d3e..bcdb9594fa 100644 --- a/libs/binder/ndk/process.cpp +++ b/libs/binder/ndk/process.cpp @@ -36,6 +36,10 @@ void ABinderProcess_joinThreadPool(void) { IPCThreadState::self()->joinThreadPool(); } +void ABinderProcess_disableBackgroundScheduling(bool disable) { + IPCThreadState::disableBackgroundScheduling(disable); +} + binder_status_t ABinderProcess_setupPolling(int* fd) { return IPCThreadState::self()->setupPolling(fd); } |