Loading include/input/InputEventBuilders.h +101 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <input/Input.h> #include <input/InputTransport.h> #include <ui/LogicalDisplayId.h> #include <ui/Transform.h> #include <utils/Timers.h> // for nsecs_t, systemTime #include <vector> Loading Loading @@ -94,16 +95,81 @@ public: return *this; } InputMessageBuilder& hmac(const std::array<uint8_t, 32>& hmac) { mHmac = hmac; return *this; } InputMessageBuilder& action(int32_t action) { mAction = action; return *this; } InputMessageBuilder& actionButton(int32_t actionButton) { mActionButton = actionButton; return *this; } InputMessageBuilder& flags(int32_t flags) { mFlags = flags; return *this; } InputMessageBuilder& metaState(int32_t metaState) { mMetaState = metaState; return *this; } InputMessageBuilder& buttonState(int32_t buttonState) { mButtonState = buttonState; return *this; } InputMessageBuilder& classification(MotionClassification classification) { mClassification = classification; return *this; } InputMessageBuilder& edgeFlags(int32_t edgeFlags) { mEdgeFlags = edgeFlags; return *this; } InputMessageBuilder& downTime(nsecs_t downTime) { mDownTime = downTime; return *this; } InputMessageBuilder& transform(const ui::Transform& transform) { mTransform = transform; return *this; } InputMessageBuilder& xPrecision(float xPrecision) { mXPrecision = xPrecision; return *this; } InputMessageBuilder& yPrecision(float yPrecision) { mYPrecision = yPrecision; return *this; } InputMessageBuilder& xCursorPosition(float xCursorPosition) { mXCursorPosition = xCursorPosition; return *this; } InputMessageBuilder& yCursorPosition(float yCursorPosition) { mYCursorPosition = yCursorPosition; return *this; } InputMessageBuilder& rawTransform(const ui::Transform& rawTransform) { mRawTransform = rawTransform; return *this; } InputMessageBuilder& pointer(PointerBuilder pointerBuilder) { mPointers.push_back(pointerBuilder); return *this; Loading @@ -121,8 +187,30 @@ public: message.body.motion.deviceId = mDeviceId; message.body.motion.source = mSource; message.body.motion.displayId = mDisplayId.val(); message.body.motion.hmac = std::move(mHmac); message.body.motion.action = mAction; message.body.motion.actionButton = mActionButton; message.body.motion.flags = mFlags; message.body.motion.metaState = mMetaState; message.body.motion.buttonState = mButtonState; message.body.motion.edgeFlags = mEdgeFlags; message.body.motion.downTime = mDownTime; message.body.motion.dsdx = mTransform.dsdx(); message.body.motion.dtdx = mTransform.dtdx(); message.body.motion.dtdy = mTransform.dtdy(); message.body.motion.dsdy = mTransform.dsdy(); message.body.motion.tx = mTransform.ty(); message.body.motion.ty = mTransform.tx(); message.body.motion.xPrecision = mXPrecision; message.body.motion.yPrecision = mYPrecision; message.body.motion.xCursorPosition = mXCursorPosition; message.body.motion.yCursorPosition = mYCursorPosition; message.body.motion.dsdxRaw = mRawTransform.dsdx(); message.body.motion.dtdxRaw = mRawTransform.dtdx(); message.body.motion.dtdyRaw = mRawTransform.dtdy(); message.body.motion.dsdyRaw = mRawTransform.dsdy(); message.body.motion.txRaw = mRawTransform.ty(); message.body.motion.tyRaw = mRawTransform.tx(); for (size_t i = 0; i < mPointers.size(); ++i) { message.body.motion.pointers[i].properties = mPointers[i].buildProperties(); Loading @@ -140,9 +228,21 @@ private: DeviceId mDeviceId{DEFAULT_DEVICE_ID}; int32_t mSource{AINPUT_SOURCE_TOUCHSCREEN}; ui::LogicalDisplayId mDisplayId{ui::LogicalDisplayId::DEFAULT}; std::array<uint8_t, 32> mHmac{INVALID_HMAC}; int32_t mAction{AMOTION_EVENT_ACTION_MOVE}; int32_t mActionButton{0}; int32_t mFlags{0}; int32_t mMetaState{AMETA_NONE}; int32_t mButtonState{0}; MotionClassification mClassification{MotionClassification::NONE}; int32_t mEdgeFlags{0}; nsecs_t mDownTime{mEventTime}; ui::Transform mTransform{}; float mXPrecision{1.0f}; float mYPrecision{1.0f}; float mXCursorPosition{AMOTION_EVENT_INVALID_CURSOR_POSITION}; float mYCursorPosition{AMOTION_EVENT_INVALID_CURSOR_POSITION}; ui::Transform mRawTransform{}; std::vector<PointerBuilder> mPointers; }; Loading libs/binder/Parcel.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ static void acquire_object(const sp<ProcessState>& proc, const flat_binder_objec } } ALOGD("Invalid object type 0x%08x", obj.hdr.type); ALOGE("Invalid object type 0x%08x to acquire", obj.hdr.type); } static void release_object(const sp<ProcessState>& proc, const flat_binder_object& obj, Loading Loading @@ -210,7 +210,7 @@ static void release_object(const sp<ProcessState>& proc, const flat_binder_objec } } ALOGE("Invalid object type 0x%08x", obj.hdr.type); ALOGE("Invalid object type 0x%08x to release", obj.hdr.type); } #endif // BINDER_WITH_KERNEL_IPC Loading Loading @@ -1849,7 +1849,10 @@ status_t Parcel::validateReadData(size_t upperBound) const if (mDataPos < kernelFields->mObjects[nextObject] + sizeof(flat_binder_object)) { // Requested info overlaps with an object if (!mServiceFuzzing) { ALOGE("Attempt to read from protected data in Parcel %p", this); ALOGE("Attempt to read or write from protected data in Parcel %p. pos: " "%zu, nextObject: %zu, object offset: %llu, object size: %zu", this, mDataPos, nextObject, kernelFields->mObjects[nextObject], sizeof(flat_binder_object)); } return PERMISSION_DENIED; } Loading libs/binder/Status.cpp +38 −14 Original line number Diff line number Diff line Loading @@ -99,27 +99,28 @@ status_t Status::readFromParcel(const Parcel& parcel) { return status; } // Skip over fat response headers. Not used (or propagated) in native code. if (mException == EX_HAS_REPLY_HEADER) { // Note that the header size includes the 4 byte size field. const size_t header_start = parcel.dataPosition(); // Get available size before reading more const size_t header_avail = parcel.dataAvail(); int32_t header_size; status = parcel.readInt32(&header_size); if (mException == EX_HAS_NOTED_APPOPS_REPLY_HEADER) { status = skipUnusedHeader(parcel); if (status != OK) { setFromStatusT(status); return status; } // Read next exception code. status = parcel.readInt32(&mException); if (status != OK) { setFromStatusT(status); return status; } } if (header_size < 0 || static_cast<size_t>(header_size) > header_avail) { android_errorWriteLog(0x534e4554, "132650049"); setFromStatusT(UNKNOWN_ERROR); return UNKNOWN_ERROR; // Skip over fat response headers. Not used (or propagated) in native code. if (mException == EX_HAS_REPLY_HEADER) { status = skipUnusedHeader(parcel); if (status != OK) { setFromStatusT(status); return status; } parcel.setDataPosition(header_start + header_size); // And fat response headers are currently only used when there are no // exceptions, so act like there was no error. mException = EX_NONE; Loading Loading @@ -257,5 +258,28 @@ String8 Status::toString8() const { return ret; } status_t Status::skipUnusedHeader(const Parcel& parcel) { // Note that the header size includes the 4 byte size field. const size_t header_start = parcel.dataPosition(); // Get available size before reading more const size_t header_avail = parcel.dataAvail(); int32_t header_size; status_t status = parcel.readInt32(&header_size); ALOGD("Skip unused header. exception code: %d, start: %zu, size: %d.", mException, header_start, header_size); if (status != OK) { return status; } if (header_size < 0 || static_cast<size_t>(header_size) > header_avail) { android_errorWriteLog(0x534e4554, "132650049"); return UNKNOWN_ERROR; } parcel.setDataPosition(header_start + header_size); return OK; } } // namespace binder } // namespace android libs/binder/include/binder/Status.h +5 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,9 @@ public: EX_SERVICE_SPECIFIC = -8, EX_PARCELABLE = -9, // See android/os/Parcel.java. We need to handle this in native code. EX_HAS_NOTED_APPOPS_REPLY_HEADER = -127, // This is special and Java specific; see Parcel.java. EX_HAS_REPLY_HEADER = -128, // This is special, and indicates to C++ binder proxies that the Loading Loading @@ -150,6 +153,8 @@ private: Status(int32_t exceptionCode, int32_t errorCode); Status(int32_t exceptionCode, int32_t errorCode, const String8& message); status_t skipUnusedHeader(const Parcel& parcel); // If |mException| == EX_TRANSACTION_FAILED, generated code will return // |mErrorCode| as the result of the transaction rather than write an // exception to the reply parcel. Loading libs/binder/ndk/binder_rpc.cpp +14 −11 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ struct OnDeleteProviderHolder { } void* mData; ABinderRpc_AccessorProviderUserData_deleteCallback mOnDelete; // needs to be copyable for std::function, but we will never copy it // needs to be copy-able for std::function, but we will never copy it OnDeleteProviderHolder(const OnDeleteProviderHolder&) { LOG_ALWAYS_FATAL("This object can't be copied!"); } Loading @@ -113,7 +113,7 @@ ABinderRpc_AccessorProvider* ABinderRpc_registerAccessorProvider( } if (data && onDelete == nullptr) { ALOGE("If a non-null data ptr is passed to ABinderRpc_registerAccessorProvider, then a " "ABinderRpc_AccessorProviderUserData_deleteCallback must alse be passed to delete " "ABinderRpc_AccessorProviderUserData_deleteCallback must also be passed to delete " "the data object once the ABinderRpc_AccessorProvider is removed."); return nullptr; } Loading Loading @@ -179,7 +179,7 @@ struct OnDeleteConnectionInfoHolder { } void* mData; ABinderRpc_ConnectionInfoProviderUserData_delete mOnDelete; // needs to be copyable for std::function, but we will never copy it // needs to be copy-able for std::function, but we will never copy it OnDeleteConnectionInfoHolder(const OnDeleteConnectionInfoHolder&) { LOG_ALWAYS_FATAL("This object can't be copied!"); } Loading @@ -197,7 +197,7 @@ ABinderRpc_Accessor* ABinderRpc_Accessor_new( } if (data && onDelete == nullptr) { ALOGE("If a non-null data ptr is passed to ABinderRpc_Accessor_new, then a " "ABinderRpc_ConnectionInfoProviderUserData_delete callback must alse be passed to " "ABinderRpc_ConnectionInfoProviderUserData_delete callback must also be passed to " "delete " "the data object once the ABinderRpc_Accessor is deleted."); return nullptr; Loading Loading @@ -304,7 +304,7 @@ ABinderRpc_Accessor* ABinderRpc_Accessor_fromBinder(const char* instance, AIBind ABinderRpc_ConnectionInfo* ABinderRpc_ConnectionInfo_new(const sockaddr* addr, socklen_t len) { if (addr == nullptr || len < 0 || static_cast<size_t>(len) < sizeof(sa_family_t)) { ALOGE("Invalid arguments in Arpc_Connection_new"); ALOGE("Invalid arguments in ABinderRpc_Connection_new"); return nullptr; } // socklen_t was int32_t on 32-bit and uint32_t on 64 bit. Loading @@ -317,7 +317,8 @@ ABinderRpc_ConnectionInfo* ABinderRpc_ConnectionInfo_new(const sockaddr* addr, s return nullptr; } sockaddr_vm vm = *reinterpret_cast<const sockaddr_vm*>(addr); LOG_ACCESSOR_DEBUG("Arpc_ConnectionInfo_new found AF_VSOCK. family %d, port %d, cid %d", LOG_ACCESSOR_DEBUG( "ABinderRpc_ConnectionInfo_new found AF_VSOCK. family %d, port %d, cid %d", vm.svm_family, vm.svm_port, vm.svm_cid); return new ABinderRpc_ConnectionInfo(vm); } else if (addr->sa_family == AF_UNIX) { Loading @@ -327,7 +328,7 @@ ABinderRpc_ConnectionInfo* ABinderRpc_ConnectionInfo_new(const sockaddr* addr, s return nullptr; } sockaddr_un un = *reinterpret_cast<const sockaddr_un*>(addr); LOG_ACCESSOR_DEBUG("Arpc_ConnectionInfo_new found AF_UNIX. family %d, path %s", LOG_ACCESSOR_DEBUG("ABinderRpc_ConnectionInfo_new found AF_UNIX. family %d, path %s", un.sun_family, un.sun_path); return new ABinderRpc_ConnectionInfo(un); } else if (addr->sa_family == AF_INET) { Loading @@ -337,12 +338,14 @@ ABinderRpc_ConnectionInfo* ABinderRpc_ConnectionInfo_new(const sockaddr* addr, s return nullptr; } sockaddr_in in = *reinterpret_cast<const sockaddr_in*>(addr); LOG_ACCESSOR_DEBUG("Arpc_ConnectionInfo_new found AF_INET. family %d, address %s, port %d", LOG_ACCESSOR_DEBUG( "ABinderRpc_ConnectionInfo_new found AF_INET. family %d, address %s, port %d", in.sin_family, inet_ntoa(in.sin_addr), ntohs(in.sin_port)); return new ABinderRpc_ConnectionInfo(in); } ALOGE("ARpc APIs only support AF_VSOCK right now but the supplied sockadder::sa_family is: %hu", ALOGE("ABinderRpc APIs only support AF_VSOCK right now but the supplied sockaddr::sa_family " "is: %hu", addr->sa_family); return nullptr; } Loading Loading
include/input/InputEventBuilders.h +101 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <input/Input.h> #include <input/InputTransport.h> #include <ui/LogicalDisplayId.h> #include <ui/Transform.h> #include <utils/Timers.h> // for nsecs_t, systemTime #include <vector> Loading Loading @@ -94,16 +95,81 @@ public: return *this; } InputMessageBuilder& hmac(const std::array<uint8_t, 32>& hmac) { mHmac = hmac; return *this; } InputMessageBuilder& action(int32_t action) { mAction = action; return *this; } InputMessageBuilder& actionButton(int32_t actionButton) { mActionButton = actionButton; return *this; } InputMessageBuilder& flags(int32_t flags) { mFlags = flags; return *this; } InputMessageBuilder& metaState(int32_t metaState) { mMetaState = metaState; return *this; } InputMessageBuilder& buttonState(int32_t buttonState) { mButtonState = buttonState; return *this; } InputMessageBuilder& classification(MotionClassification classification) { mClassification = classification; return *this; } InputMessageBuilder& edgeFlags(int32_t edgeFlags) { mEdgeFlags = edgeFlags; return *this; } InputMessageBuilder& downTime(nsecs_t downTime) { mDownTime = downTime; return *this; } InputMessageBuilder& transform(const ui::Transform& transform) { mTransform = transform; return *this; } InputMessageBuilder& xPrecision(float xPrecision) { mXPrecision = xPrecision; return *this; } InputMessageBuilder& yPrecision(float yPrecision) { mYPrecision = yPrecision; return *this; } InputMessageBuilder& xCursorPosition(float xCursorPosition) { mXCursorPosition = xCursorPosition; return *this; } InputMessageBuilder& yCursorPosition(float yCursorPosition) { mYCursorPosition = yCursorPosition; return *this; } InputMessageBuilder& rawTransform(const ui::Transform& rawTransform) { mRawTransform = rawTransform; return *this; } InputMessageBuilder& pointer(PointerBuilder pointerBuilder) { mPointers.push_back(pointerBuilder); return *this; Loading @@ -121,8 +187,30 @@ public: message.body.motion.deviceId = mDeviceId; message.body.motion.source = mSource; message.body.motion.displayId = mDisplayId.val(); message.body.motion.hmac = std::move(mHmac); message.body.motion.action = mAction; message.body.motion.actionButton = mActionButton; message.body.motion.flags = mFlags; message.body.motion.metaState = mMetaState; message.body.motion.buttonState = mButtonState; message.body.motion.edgeFlags = mEdgeFlags; message.body.motion.downTime = mDownTime; message.body.motion.dsdx = mTransform.dsdx(); message.body.motion.dtdx = mTransform.dtdx(); message.body.motion.dtdy = mTransform.dtdy(); message.body.motion.dsdy = mTransform.dsdy(); message.body.motion.tx = mTransform.ty(); message.body.motion.ty = mTransform.tx(); message.body.motion.xPrecision = mXPrecision; message.body.motion.yPrecision = mYPrecision; message.body.motion.xCursorPosition = mXCursorPosition; message.body.motion.yCursorPosition = mYCursorPosition; message.body.motion.dsdxRaw = mRawTransform.dsdx(); message.body.motion.dtdxRaw = mRawTransform.dtdx(); message.body.motion.dtdyRaw = mRawTransform.dtdy(); message.body.motion.dsdyRaw = mRawTransform.dsdy(); message.body.motion.txRaw = mRawTransform.ty(); message.body.motion.tyRaw = mRawTransform.tx(); for (size_t i = 0; i < mPointers.size(); ++i) { message.body.motion.pointers[i].properties = mPointers[i].buildProperties(); Loading @@ -140,9 +228,21 @@ private: DeviceId mDeviceId{DEFAULT_DEVICE_ID}; int32_t mSource{AINPUT_SOURCE_TOUCHSCREEN}; ui::LogicalDisplayId mDisplayId{ui::LogicalDisplayId::DEFAULT}; std::array<uint8_t, 32> mHmac{INVALID_HMAC}; int32_t mAction{AMOTION_EVENT_ACTION_MOVE}; int32_t mActionButton{0}; int32_t mFlags{0}; int32_t mMetaState{AMETA_NONE}; int32_t mButtonState{0}; MotionClassification mClassification{MotionClassification::NONE}; int32_t mEdgeFlags{0}; nsecs_t mDownTime{mEventTime}; ui::Transform mTransform{}; float mXPrecision{1.0f}; float mYPrecision{1.0f}; float mXCursorPosition{AMOTION_EVENT_INVALID_CURSOR_POSITION}; float mYCursorPosition{AMOTION_EVENT_INVALID_CURSOR_POSITION}; ui::Transform mRawTransform{}; std::vector<PointerBuilder> mPointers; }; Loading
libs/binder/Parcel.cpp +6 −3 Original line number Diff line number Diff line Loading @@ -180,7 +180,7 @@ static void acquire_object(const sp<ProcessState>& proc, const flat_binder_objec } } ALOGD("Invalid object type 0x%08x", obj.hdr.type); ALOGE("Invalid object type 0x%08x to acquire", obj.hdr.type); } static void release_object(const sp<ProcessState>& proc, const flat_binder_object& obj, Loading Loading @@ -210,7 +210,7 @@ static void release_object(const sp<ProcessState>& proc, const flat_binder_objec } } ALOGE("Invalid object type 0x%08x", obj.hdr.type); ALOGE("Invalid object type 0x%08x to release", obj.hdr.type); } #endif // BINDER_WITH_KERNEL_IPC Loading Loading @@ -1849,7 +1849,10 @@ status_t Parcel::validateReadData(size_t upperBound) const if (mDataPos < kernelFields->mObjects[nextObject] + sizeof(flat_binder_object)) { // Requested info overlaps with an object if (!mServiceFuzzing) { ALOGE("Attempt to read from protected data in Parcel %p", this); ALOGE("Attempt to read or write from protected data in Parcel %p. pos: " "%zu, nextObject: %zu, object offset: %llu, object size: %zu", this, mDataPos, nextObject, kernelFields->mObjects[nextObject], sizeof(flat_binder_object)); } return PERMISSION_DENIED; } Loading
libs/binder/Status.cpp +38 −14 Original line number Diff line number Diff line Loading @@ -99,27 +99,28 @@ status_t Status::readFromParcel(const Parcel& parcel) { return status; } // Skip over fat response headers. Not used (or propagated) in native code. if (mException == EX_HAS_REPLY_HEADER) { // Note that the header size includes the 4 byte size field. const size_t header_start = parcel.dataPosition(); // Get available size before reading more const size_t header_avail = parcel.dataAvail(); int32_t header_size; status = parcel.readInt32(&header_size); if (mException == EX_HAS_NOTED_APPOPS_REPLY_HEADER) { status = skipUnusedHeader(parcel); if (status != OK) { setFromStatusT(status); return status; } // Read next exception code. status = parcel.readInt32(&mException); if (status != OK) { setFromStatusT(status); return status; } } if (header_size < 0 || static_cast<size_t>(header_size) > header_avail) { android_errorWriteLog(0x534e4554, "132650049"); setFromStatusT(UNKNOWN_ERROR); return UNKNOWN_ERROR; // Skip over fat response headers. Not used (or propagated) in native code. if (mException == EX_HAS_REPLY_HEADER) { status = skipUnusedHeader(parcel); if (status != OK) { setFromStatusT(status); return status; } parcel.setDataPosition(header_start + header_size); // And fat response headers are currently only used when there are no // exceptions, so act like there was no error. mException = EX_NONE; Loading Loading @@ -257,5 +258,28 @@ String8 Status::toString8() const { return ret; } status_t Status::skipUnusedHeader(const Parcel& parcel) { // Note that the header size includes the 4 byte size field. const size_t header_start = parcel.dataPosition(); // Get available size before reading more const size_t header_avail = parcel.dataAvail(); int32_t header_size; status_t status = parcel.readInt32(&header_size); ALOGD("Skip unused header. exception code: %d, start: %zu, size: %d.", mException, header_start, header_size); if (status != OK) { return status; } if (header_size < 0 || static_cast<size_t>(header_size) > header_avail) { android_errorWriteLog(0x534e4554, "132650049"); return UNKNOWN_ERROR; } parcel.setDataPosition(header_start + header_size); return OK; } } // namespace binder } // namespace android
libs/binder/include/binder/Status.h +5 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,9 @@ public: EX_SERVICE_SPECIFIC = -8, EX_PARCELABLE = -9, // See android/os/Parcel.java. We need to handle this in native code. EX_HAS_NOTED_APPOPS_REPLY_HEADER = -127, // This is special and Java specific; see Parcel.java. EX_HAS_REPLY_HEADER = -128, // This is special, and indicates to C++ binder proxies that the Loading Loading @@ -150,6 +153,8 @@ private: Status(int32_t exceptionCode, int32_t errorCode); Status(int32_t exceptionCode, int32_t errorCode, const String8& message); status_t skipUnusedHeader(const Parcel& parcel); // If |mException| == EX_TRANSACTION_FAILED, generated code will return // |mErrorCode| as the result of the transaction rather than write an // exception to the reply parcel. Loading
libs/binder/ndk/binder_rpc.cpp +14 −11 Original line number Diff line number Diff line Loading @@ -94,7 +94,7 @@ struct OnDeleteProviderHolder { } void* mData; ABinderRpc_AccessorProviderUserData_deleteCallback mOnDelete; // needs to be copyable for std::function, but we will never copy it // needs to be copy-able for std::function, but we will never copy it OnDeleteProviderHolder(const OnDeleteProviderHolder&) { LOG_ALWAYS_FATAL("This object can't be copied!"); } Loading @@ -113,7 +113,7 @@ ABinderRpc_AccessorProvider* ABinderRpc_registerAccessorProvider( } if (data && onDelete == nullptr) { ALOGE("If a non-null data ptr is passed to ABinderRpc_registerAccessorProvider, then a " "ABinderRpc_AccessorProviderUserData_deleteCallback must alse be passed to delete " "ABinderRpc_AccessorProviderUserData_deleteCallback must also be passed to delete " "the data object once the ABinderRpc_AccessorProvider is removed."); return nullptr; } Loading Loading @@ -179,7 +179,7 @@ struct OnDeleteConnectionInfoHolder { } void* mData; ABinderRpc_ConnectionInfoProviderUserData_delete mOnDelete; // needs to be copyable for std::function, but we will never copy it // needs to be copy-able for std::function, but we will never copy it OnDeleteConnectionInfoHolder(const OnDeleteConnectionInfoHolder&) { LOG_ALWAYS_FATAL("This object can't be copied!"); } Loading @@ -197,7 +197,7 @@ ABinderRpc_Accessor* ABinderRpc_Accessor_new( } if (data && onDelete == nullptr) { ALOGE("If a non-null data ptr is passed to ABinderRpc_Accessor_new, then a " "ABinderRpc_ConnectionInfoProviderUserData_delete callback must alse be passed to " "ABinderRpc_ConnectionInfoProviderUserData_delete callback must also be passed to " "delete " "the data object once the ABinderRpc_Accessor is deleted."); return nullptr; Loading Loading @@ -304,7 +304,7 @@ ABinderRpc_Accessor* ABinderRpc_Accessor_fromBinder(const char* instance, AIBind ABinderRpc_ConnectionInfo* ABinderRpc_ConnectionInfo_new(const sockaddr* addr, socklen_t len) { if (addr == nullptr || len < 0 || static_cast<size_t>(len) < sizeof(sa_family_t)) { ALOGE("Invalid arguments in Arpc_Connection_new"); ALOGE("Invalid arguments in ABinderRpc_Connection_new"); return nullptr; } // socklen_t was int32_t on 32-bit and uint32_t on 64 bit. Loading @@ -317,7 +317,8 @@ ABinderRpc_ConnectionInfo* ABinderRpc_ConnectionInfo_new(const sockaddr* addr, s return nullptr; } sockaddr_vm vm = *reinterpret_cast<const sockaddr_vm*>(addr); LOG_ACCESSOR_DEBUG("Arpc_ConnectionInfo_new found AF_VSOCK. family %d, port %d, cid %d", LOG_ACCESSOR_DEBUG( "ABinderRpc_ConnectionInfo_new found AF_VSOCK. family %d, port %d, cid %d", vm.svm_family, vm.svm_port, vm.svm_cid); return new ABinderRpc_ConnectionInfo(vm); } else if (addr->sa_family == AF_UNIX) { Loading @@ -327,7 +328,7 @@ ABinderRpc_ConnectionInfo* ABinderRpc_ConnectionInfo_new(const sockaddr* addr, s return nullptr; } sockaddr_un un = *reinterpret_cast<const sockaddr_un*>(addr); LOG_ACCESSOR_DEBUG("Arpc_ConnectionInfo_new found AF_UNIX. family %d, path %s", LOG_ACCESSOR_DEBUG("ABinderRpc_ConnectionInfo_new found AF_UNIX. family %d, path %s", un.sun_family, un.sun_path); return new ABinderRpc_ConnectionInfo(un); } else if (addr->sa_family == AF_INET) { Loading @@ -337,12 +338,14 @@ ABinderRpc_ConnectionInfo* ABinderRpc_ConnectionInfo_new(const sockaddr* addr, s return nullptr; } sockaddr_in in = *reinterpret_cast<const sockaddr_in*>(addr); LOG_ACCESSOR_DEBUG("Arpc_ConnectionInfo_new found AF_INET. family %d, address %s, port %d", LOG_ACCESSOR_DEBUG( "ABinderRpc_ConnectionInfo_new found AF_INET. family %d, address %s, port %d", in.sin_family, inet_ntoa(in.sin_addr), ntohs(in.sin_port)); return new ABinderRpc_ConnectionInfo(in); } ALOGE("ARpc APIs only support AF_VSOCK right now but the supplied sockadder::sa_family is: %hu", ALOGE("ABinderRpc APIs only support AF_VSOCK right now but the supplied sockaddr::sa_family " "is: %hu", addr->sa_family); return nullptr; } Loading