summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/binder/IPCThreadState.cpp5
-rw-r--r--libs/binder/Parcel.cpp9
-rw-r--r--libs/binder/include/binder/IPCThreadState.h1
3 files changed, 14 insertions, 1 deletions
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index d0cd8f2f22..e8329613ab 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -338,6 +338,11 @@ void IPCThreadState::disableBackgroundScheduling(bool disable)
gDisableBackgroundScheduling = disable;
}
+bool IPCThreadState::backgroundSchedulingDisabled()
+{
+ return gDisableBackgroundScheduling;
+}
+
sp<ProcessState> IPCThreadState::process()
{
return mProcess;
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 39bb078fd1..aec8f107a3 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -211,7 +211,14 @@ status_t flatten_binder(const sp<ProcessState>& /*proc*/,
{
flat_binder_object obj;
- obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS;
+ if (IPCThreadState::self()->backgroundSchedulingDisabled()) {
+ /* minimum priority for all nodes is nice 0 */
+ obj.flags = FLAT_BINDER_FLAG_ACCEPTS_FDS;
+ } else {
+ /* minimum priority for all nodes is MAX_NICE(19) */
+ obj.flags = 0x13 | FLAT_BINDER_FLAG_ACCEPTS_FDS;
+ }
+
if (binder != NULL) {
IBinder *local = binder->localBinder();
if (!local) {
diff --git a/libs/binder/include/binder/IPCThreadState.h b/libs/binder/include/binder/IPCThreadState.h
index 7b826d6dcd..245607e74e 100644
--- a/libs/binder/include/binder/IPCThreadState.h
+++ b/libs/binder/include/binder/IPCThreadState.h
@@ -83,6 +83,7 @@ public:
// in to it but doesn't want to acquire locks in its services while in
// the background.
static void disableBackgroundScheduling(bool disable);
+ bool backgroundSchedulingDisabled();
// Call blocks until the number of executing binder threads is less than
// the maximum number of binder threads threads allowed for this process.