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

Commit 747c0bb8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "libbinder: Replace ScopedFd with base::unique_fd"

parents a7ba9d0a b12c5a67
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
#include <vector>

#include <cutils/native_handle.h>
#include <nativehelper/ScopedFd.h>
#include <android-base/unique_fd.h>
#include <utils/Errors.h>
#include <utils/RefBase.h>
#include <utils/String16.h>
@@ -186,14 +186,14 @@ public:
    // semantics of the smart file descriptor. A new descriptor will be
    // created, and will be closed when the parcel is destroyed.
    status_t            writeUniqueFileDescriptor(
                            const ScopedFd& fd);
                            const base::unique_fd& fd);

    // Place a vector of file desciptors into the parcel. Each descriptor is
    // dup'd as in writeDupFileDescriptor
    status_t            writeUniqueFileDescriptorVector(
                            const std::unique_ptr<std::vector<ScopedFd>>& val);
                            const std::unique_ptr<std::vector<base::unique_fd>>& val);
    status_t            writeUniqueFileDescriptorVector(
                            const std::vector<ScopedFd>& val);
                            const std::vector<base::unique_fd>& val);

    // Writes a blob to the parcel.
    // If the blob is small, then it is stored in-place, otherwise it is
@@ -324,14 +324,14 @@ public:

    // Retrieve a smart file descriptor from the parcel.
    status_t            readUniqueFileDescriptor(
                            ScopedFd* val) const;
                            base::unique_fd* val) const;


    // Retrieve a vector of smart file descriptors from the parcel.
    status_t            readUniqueFileDescriptorVector(
                            std::unique_ptr<std::vector<ScopedFd>>* val) const;
                            std::unique_ptr<std::vector<base::unique_fd>>* val) const;
    status_t            readUniqueFileDescriptorVector(
                            std::vector<ScopedFd>* val) const;
                            std::vector<base::unique_fd>* val) const;

    // Reads a blob from the parcel.
    // The caller should call release() on the blob after reading its contents.
+4 −2
Original line number Diff line number Diff line
@@ -44,7 +44,8 @@ LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := libbinder
LOCAL_SHARED_LIBRARIES := liblog libcutils libutils
LOCAL_SHARED_LIBRARIES := libbase liblog libcutils libutils
LOCAL_EXPORT_SHARED_LIBRARY_HEADERS := libbase libutils

LOCAL_CLANG := true
LOCAL_SANITIZE := integer
@@ -59,7 +60,8 @@ include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := libbinder
LOCAL_STATIC_LIBRARIES += libutils
LOCAL_STATIC_LIBRARIES := libbase libutils
LOCAL_EXPORT_STATIC_LIBRARY_HEADERS := libbase libutils
LOCAL_SRC_FILES := $(sources)
ifneq ($(TARGET_USES_64_BIT_BINDER),true)
ifneq ($(TARGET_IS_64_BIT),true)
+6 −6
Original line number Diff line number Diff line
@@ -1184,15 +1184,15 @@ status_t Parcel::writeDupFileDescriptor(int fd)
    return err;
}

status_t Parcel::writeUniqueFileDescriptor(const ScopedFd& fd) {
status_t Parcel::writeUniqueFileDescriptor(const base::unique_fd& fd) {
    return writeDupFileDescriptor(fd.get());
}

status_t Parcel::writeUniqueFileDescriptorVector(const std::vector<ScopedFd>& val) {
status_t Parcel::writeUniqueFileDescriptorVector(const std::vector<base::unique_fd>& val) {
    return writeTypedVector(val, &Parcel::writeUniqueFileDescriptor);
}

status_t Parcel::writeUniqueFileDescriptorVector(const std::unique_ptr<std::vector<ScopedFd>>& val) {
status_t Parcel::writeUniqueFileDescriptorVector(const std::unique_ptr<std::vector<base::unique_fd>>& val) {
    return writeNullableTypedVector(val, &Parcel::writeUniqueFileDescriptor);
}

@@ -1992,7 +1992,7 @@ int Parcel::readFileDescriptor() const
    return BAD_TYPE;
}

status_t Parcel::readUniqueFileDescriptor(ScopedFd* val) const
status_t Parcel::readUniqueFileDescriptor(base::unique_fd* val) const
{
    int got = readFileDescriptor();

@@ -2010,11 +2010,11 @@ status_t Parcel::readUniqueFileDescriptor(ScopedFd* val) const
}


status_t Parcel::readUniqueFileDescriptorVector(std::unique_ptr<std::vector<ScopedFd>>* val) const {
status_t Parcel::readUniqueFileDescriptorVector(std::unique_ptr<std::vector<base::unique_fd>>* val) const {
    return readNullableTypedVector(val, &Parcel::readUniqueFileDescriptor);
}

status_t Parcel::readUniqueFileDescriptorVector(std::vector<ScopedFd>* val) const {
status_t Parcel::readUniqueFileDescriptorVector(std::vector<base::unique_fd>* val) const {
    return readTypedVector(val, &Parcel::readUniqueFileDescriptor);
}