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

Commit fcfe0409 authored by Kevin Lindkvist's avatar Kevin Lindkvist Committed by Automerger Merge Worker
Browse files

Merge "Enable compilation of libbinder on Fuchsia" into main am: 7317ccbb

parents 4fc5a2be 7317ccbb
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -38,6 +38,10 @@
#include "Utils.h"
#include "binder_module.h"

#if (defined(__ANDROID__) || defined(__Fuchsia__)) && !defined(BINDER_WITH_KERNEL_IPC)
#error Android and Fuchsia are expected to have BINDER_WITH_KERNEL_IPC
#endif

#if LOG_NDEBUG

#define IF_LOG_TRANSACTIONS() if (false)
@@ -1215,7 +1219,7 @@ status_t IPCThreadState::talkWithDriver(bool doReceive)
            std::string message = logStream.str();
            ALOGI("%s", message.c_str());
        }
#if defined(__ANDROID__)
#if defined(BINDER_WITH_KERNEL_IPC)
        if (ioctl(mProcess->mDriverFD, BINDER_WRITE_READ, &bwr) >= 0)
            err = NO_ERROR;
        else
@@ -1604,7 +1608,7 @@ void IPCThreadState::threadDestructor(void *st)
        IPCThreadState* const self = static_cast<IPCThreadState*>(st);
        if (self) {
                self->flushCommands();
#if defined(__ANDROID__)
#if defined(BINDER_WITH_KERNEL_IPC)
        if (self->mProcess->mDriverFD >= 0) {
            ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0);
        }
@@ -1620,7 +1624,7 @@ status_t IPCThreadState::getProcessFreezeInfo(pid_t pid, uint32_t *sync_received
    binder_frozen_status_info info = {};
    info.pid = pid;

#if defined(__ANDROID__)
#if defined(BINDER_WITH_KERNEL_IPC)
    if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_FROZEN_INFO, &info) < 0)
        ret = -errno;
#endif
@@ -1639,7 +1643,7 @@ status_t IPCThreadState::freeze(pid_t pid, bool enable, uint32_t timeout_ms) {
    info.timeout_ms = timeout_ms;


#if defined(__ANDROID__)
#if defined(BINDER_WITH_KERNEL_IPC)
    if (ioctl(self()->mProcess->mDriverFD, BINDER_FREEZE, &info) < 0)
        ret = -errno;
#endif
@@ -1657,7 +1661,7 @@ void IPCThreadState::logExtendedError() {
    if (!ProcessState::isDriverFeatureEnabled(ProcessState::DriverFeature::EXTENDED_ERROR))
        return;

#if defined(__ANDROID__)
#if defined(BINDER_WITH_KERNEL_IPC)
    if (ioctl(self()->mProcess->mDriverFD, BINDER_GET_EXTENDED_ERROR, &ee) < 0) {
        ALOGE("Failed to get extended error: %s", strerror(errno));
        return;
+6 −2
Original line number Diff line number Diff line
@@ -43,7 +43,11 @@
#include <binder/IPermissionController.h>
#endif

#ifdef __ANDROID__
#if !(defined(__ANDROID__) || defined(__FUCHSIA))
#define BINDER_SERVICEMANAGEMENT_DELEGATION_SUPPORT
#endif

#if !defined(BINDER_SERVICEMANAGEMENT_DELEGATION_SUPPORT)
#include <cutils/properties.h>
#else
#include "ServiceManagerHost.h"
@@ -902,7 +906,7 @@ std::vector<IServiceManager::ServiceDebugInfo> CppBackendShim::getServiceDebugIn
    return ret;
}

#ifndef __ANDROID__
#if defined(BINDER_SERVICEMANAGEMENT_DELEGATION_SUPPORT)
// CppBackendShim for host. Implements the old libbinder android::IServiceManager API.
// The internal implementation of the AIDL interface android::os::IServiceManager calls into
// on-device service manager.
+5 −0
Original line number Diff line number Diff line
@@ -299,8 +299,13 @@ status_t Parcel::flattenBinder(const sp<IBinder>& binder) {
            obj.handle = handle;
            obj.cookie = 0;
        } else {
#if __linux__
            int policy = local->getMinSchedulerPolicy();
            int priority = local->getMinSchedulerPriority();
#else
            int policy = 0;
            int priority = 0;
#endif

            if (policy != 0 || priority != 0) {
                // override value, since it is set explicitly
+5 −1
Original line number Diff line number Diff line
@@ -48,6 +48,10 @@
#define DEFAULT_MAX_BINDER_THREADS 15
#define DEFAULT_ENABLE_ONEWAY_SPAM_DETECTION 1

#if defined(__ANDROID__) || defined(__Fuchsia__)
#define EXPECT_BINDER_OPEN_SUCCESS
#endif

#ifdef __ANDROID_VNDK__
const char* kDefaultDriver = "/dev/vndbinder";
#else
@@ -613,7 +617,7 @@ ProcessState::ProcessState(const char* driver)
        }
    }

#ifdef __ANDROID__
#if defined(EXPECT_BINDER_OPEN_SUCCESS)
    LOG_ALWAYS_FATAL_IF(!opened.ok(),
                        "Binder driver '%s' could not be opened. Error: %s. Terminating.",
                        driver, error.c_str());