Loading libs/binder/Android.bp +16 −0 Original line number Diff line number Diff line Loading @@ -374,6 +374,22 @@ cc_library_static { ], } cc_library_static { name: "libbinder_rpc_no_native_handle", vendor_available: true, defaults: [ "libbinder_common_defaults", "libbinder_android_defaults", "libbinder_kernel_defaults", ], cflags: [ "-DBINDER_DISABLE_NATIVE_HANDLE", ], visibility: [ ":__subpackages__", ], } cc_library_static { name: "libbinder_rpc_single_threaded", defaults: [ Loading libs/binder/Parcel.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -1436,6 +1436,7 @@ status_t Parcel::writeRawNullableParcelable(const Parcelable* parcelable) { return writeParcelable(*parcelable); } #ifndef BINDER_DISABLE_NATIVE_HANDLE status_t Parcel::writeNativeHandle(const native_handle* handle) { if (!handle || handle->version != sizeof(native_handle)) Loading @@ -1458,6 +1459,7 @@ status_t Parcel::writeNativeHandle(const native_handle* handle) err = write(handle->data + handle->numFds, sizeof(int)*handle->numInts); return err; } #endif status_t Parcel::writeFileDescriptor(int fd, bool takeOwnership) { if (auto* rpcFields = maybeRpcFields()) { Loading Loading @@ -2239,6 +2241,7 @@ int32_t Parcel::readExceptionCode() const return status.exceptionCode(); } #ifndef BINDER_DISABLE_NATIVE_HANDLE native_handle* Parcel::readNativeHandle() const { int numFds, numInts; Loading Loading @@ -2271,6 +2274,7 @@ native_handle* Parcel::readNativeHandle() const } return h; } #endif int Parcel::readFileDescriptor() const { if (const auto* rpcFields = maybeRpcFields()) { Loading libs/binder/include/binder/Parcel.h +7 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,9 @@ #include <vector> #include <android-base/unique_fd.h> #ifndef BINDER_DISABLE_NATIVE_HANDLE #include <cutils/native_handle.h> #endif #include <utils/Errors.h> #include <utils/RefBase.h> #include <utils/String16.h> Loading Loading @@ -324,11 +326,13 @@ public: template<typename T> status_t writeVectorSize(const std::unique_ptr<std::vector<T>>& val) __attribute__((deprecated("use std::optional version instead"))); #ifndef BINDER_DISABLE_NATIVE_HANDLE // Place a native_handle into the parcel (the native_handle's file- // descriptors are dup'ed, so it is safe to delete the native_handle // when this function returns). // Doesn't take ownership of the native_handle. status_t writeNativeHandle(const native_handle* handle); #endif // Place a file descriptor into the parcel. The given fd must remain // valid for the lifetime of the parcel. Loading Loading @@ -559,12 +563,13 @@ public: // response headers rather than doing it by hand. int32_t readExceptionCode() const; #ifndef BINDER_DISABLE_NATIVE_HANDLE // Retrieve native_handle from the parcel. This returns a copy of the // parcel's native_handle (the caller takes ownership). The caller // must free the native_handle with native_handle_close() and // native_handle_delete(). native_handle* readNativeHandle() const; #endif // Retrieve a file descriptor from the parcel. This returns the raw fd // in the parcel, which you do not own -- use dup() to get your own copy. Loading Loading
libs/binder/Android.bp +16 −0 Original line number Diff line number Diff line Loading @@ -374,6 +374,22 @@ cc_library_static { ], } cc_library_static { name: "libbinder_rpc_no_native_handle", vendor_available: true, defaults: [ "libbinder_common_defaults", "libbinder_android_defaults", "libbinder_kernel_defaults", ], cflags: [ "-DBINDER_DISABLE_NATIVE_HANDLE", ], visibility: [ ":__subpackages__", ], } cc_library_static { name: "libbinder_rpc_single_threaded", defaults: [ Loading
libs/binder/Parcel.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -1436,6 +1436,7 @@ status_t Parcel::writeRawNullableParcelable(const Parcelable* parcelable) { return writeParcelable(*parcelable); } #ifndef BINDER_DISABLE_NATIVE_HANDLE status_t Parcel::writeNativeHandle(const native_handle* handle) { if (!handle || handle->version != sizeof(native_handle)) Loading @@ -1458,6 +1459,7 @@ status_t Parcel::writeNativeHandle(const native_handle* handle) err = write(handle->data + handle->numFds, sizeof(int)*handle->numInts); return err; } #endif status_t Parcel::writeFileDescriptor(int fd, bool takeOwnership) { if (auto* rpcFields = maybeRpcFields()) { Loading Loading @@ -2239,6 +2241,7 @@ int32_t Parcel::readExceptionCode() const return status.exceptionCode(); } #ifndef BINDER_DISABLE_NATIVE_HANDLE native_handle* Parcel::readNativeHandle() const { int numFds, numInts; Loading Loading @@ -2271,6 +2274,7 @@ native_handle* Parcel::readNativeHandle() const } return h; } #endif int Parcel::readFileDescriptor() const { if (const auto* rpcFields = maybeRpcFields()) { Loading
libs/binder/include/binder/Parcel.h +7 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,9 @@ #include <vector> #include <android-base/unique_fd.h> #ifndef BINDER_DISABLE_NATIVE_HANDLE #include <cutils/native_handle.h> #endif #include <utils/Errors.h> #include <utils/RefBase.h> #include <utils/String16.h> Loading Loading @@ -324,11 +326,13 @@ public: template<typename T> status_t writeVectorSize(const std::unique_ptr<std::vector<T>>& val) __attribute__((deprecated("use std::optional version instead"))); #ifndef BINDER_DISABLE_NATIVE_HANDLE // Place a native_handle into the parcel (the native_handle's file- // descriptors are dup'ed, so it is safe to delete the native_handle // when this function returns). // Doesn't take ownership of the native_handle. status_t writeNativeHandle(const native_handle* handle); #endif // Place a file descriptor into the parcel. The given fd must remain // valid for the lifetime of the parcel. Loading Loading @@ -559,12 +563,13 @@ public: // response headers rather than doing it by hand. int32_t readExceptionCode() const; #ifndef BINDER_DISABLE_NATIVE_HANDLE // Retrieve native_handle from the parcel. This returns a copy of the // parcel's native_handle (the caller takes ownership). The caller // must free the native_handle with native_handle_close() and // native_handle_delete(). native_handle* readNativeHandle() const; #endif // Retrieve a file descriptor from the parcel. This returns the raw fd // in the parcel, which you do not own -- use dup() to get your own copy. Loading