Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit efe59d3e authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "libbinder: compile some Linux code conditionally" am: 0292d80f am:...

Merge "libbinder: compile some Linux code conditionally" am: 0292d80f am: d5a68b47 am: 3c104520 am: 5c767257

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/2081787



Change-Id: Iecde4b4d3151e7fa725e3ed64463594e628a8348
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4a5dff07 5c767257
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -32,9 +32,12 @@
#include <utils/misc.h>

#include <inttypes.h>
#include <linux/sched.h>
#include <stdio.h>

#ifdef __linux__
#include <linux/sched.h>
#endif

#include "RpcState.h"

namespace android {
@@ -234,11 +237,13 @@ class BBinder::Extras
{
public:
    // unlocked objects
    bool mRequestingSid = false;
    bool mInheritRt = false;
    sp<IBinder> mExtension;
#ifdef __linux__
    int mPolicy = SCHED_NORMAL;
    int mPriority = 0;
#endif
    bool mRequestingSid = false;
    bool mInheritRt = false;

    // for below objects
    Mutex mLock;
@@ -407,6 +412,7 @@ sp<IBinder> BBinder::getExtension() {
    return e->mExtension;
}

#ifdef __linux__
void BBinder::setMinSchedulerPolicy(int policy, int priority) {
    LOG_ALWAYS_FATAL_IF(mParceled,
                        "setMinSchedulerPolicy() should not be called after a binder object "
@@ -451,6 +457,7 @@ int BBinder::getMinSchedulerPriority() {
    if (e == nullptr) return 0;
    return e->mPriority;
}
#endif // __linux__

bool BBinder::isInheritRt() {
    Extras* e = mExtras.load(std::memory_order_acquire);
@@ -478,7 +485,12 @@ void BBinder::setInheritRt(bool inheritRt) {
}

pid_t BBinder::getDebugPid() {
#ifdef __linux__
    return getpid();
#else
    // TODO: handle other OSes
    return 0;
#endif // __linux__
}

void BBinder::setExtension(const sp<IBinder>& extension) {