summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Martijn Coenen <maco@google.com> 2017-05-06 04:46:45 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-05-06 04:46:47 +0000
commitfc93a4bd893cfc71ecea0f9e155b67b592e17a0a (patch)
tree4f17b1ace9efe9fe1fc3155e8dc0f377288dd3c7
parent4b567487b7372d6bc4bb3c697723f7f5d464966b (diff)
parent2b6317436d2035ce98331906aaaca87e6026c9c8 (diff)
Merge "Correctly set minimum priority on nodes." into oc-dev
-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.