Loading cmds/servicemanager/ServiceManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -494,7 +494,7 @@ ssize_t ServiceManager::Service::getNodeStrongRefCount() { sp<BpBinder> bpBinder = binder->remoteBinder(); if (bpBinder == nullptr) return -1; return ProcessState::self()->getStrongRefCountForNodeByHandle(bpBinder->handle()); return ProcessState::self()->getStrongRefCountForNode(bpBinder); } void ServiceManager::handleClientCallbacks() { Loading libs/binder/Parcel.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -206,7 +206,7 @@ status_t Parcel::flattenBinder(const sp<IBinder>& binder) if (proxy == nullptr) { ALOGE("null proxy"); } const int32_t handle = proxy ? proxy->handle() : 0; const int32_t handle = proxy ? proxy->getPrivateAccessorForHandle().handle() : 0; obj.hdr.type = BINDER_TYPE_HANDLE; obj.binder = 0; /* Don't pass uninitialized stack data to a remote process */ obj.handle = handle; Loading libs/binder/ProcessState.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -204,11 +204,11 @@ ssize_t ProcessState::getKernelReferences(size_t buf_count, uintptr_t* buf) // that the handle points to. Can only be used by the servicemanager. // // Returns -1 in case of failure, otherwise the strong reference count. ssize_t ProcessState::getStrongRefCountForNodeByHandle(int32_t handle) { ssize_t ProcessState::getStrongRefCountForNode(const sp<BpBinder>& binder) { binder_node_info_for_ref info; memset(&info, 0, sizeof(binder_node_info_for_ref)); info.handle = handle; info.handle = binder->getPrivateAccessorForHandle().handle(); status_t result = ioctl(mDriverFD, BINDER_GET_NODE_INFO_FOR_REF, &info); Loading libs/binder/include/binder/BpBinder.h +17 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ namespace android { namespace internal { class Stability; } class ProcessState; using binder_proxy_limit_callback = void(*)(int); Loading @@ -37,8 +38,6 @@ class BpBinder : public IBinder public: static BpBinder* create(int32_t handle); int32_t handle() const; virtual const String16& getInterfaceDescriptor() const; virtual bool isBinderAlive() const; virtual status_t pingBinder(); Loading Loading @@ -109,7 +108,23 @@ public: KeyedVector<const void*, entry_t> mObjects; }; class PrivateAccessorForHandle { private: friend BpBinder; friend ::android::Parcel; friend ::android::ProcessState; explicit PrivateAccessorForHandle(const BpBinder* binder) : mBinder(binder) {} int32_t handle() const { return mBinder->handle(); } const BpBinder* mBinder; }; const PrivateAccessorForHandle getPrivateAccessorForHandle() const { return PrivateAccessorForHandle(this); } private: friend PrivateAccessorForHandle; int32_t handle() const; BpBinder(int32_t handle,int32_t trackedUid); virtual ~BpBinder(); virtual void onFirstRef(); Loading libs/binder/include/binder/ProcessState.h +1 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ public: // 2. Temporary strong references held by the kernel during a // transaction on the node. // It does NOT include local strong references to the node ssize_t getStrongRefCountForNodeByHandle(int32_t handle); ssize_t getStrongRefCountForNode(const sp<BpBinder>& binder); enum class CallRestriction { // all calls okay Loading Loading
cmds/servicemanager/ServiceManager.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -494,7 +494,7 @@ ssize_t ServiceManager::Service::getNodeStrongRefCount() { sp<BpBinder> bpBinder = binder->remoteBinder(); if (bpBinder == nullptr) return -1; return ProcessState::self()->getStrongRefCountForNodeByHandle(bpBinder->handle()); return ProcessState::self()->getStrongRefCountForNode(bpBinder); } void ServiceManager::handleClientCallbacks() { Loading
libs/binder/Parcel.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -206,7 +206,7 @@ status_t Parcel::flattenBinder(const sp<IBinder>& binder) if (proxy == nullptr) { ALOGE("null proxy"); } const int32_t handle = proxy ? proxy->handle() : 0; const int32_t handle = proxy ? proxy->getPrivateAccessorForHandle().handle() : 0; obj.hdr.type = BINDER_TYPE_HANDLE; obj.binder = 0; /* Don't pass uninitialized stack data to a remote process */ obj.handle = handle; Loading
libs/binder/ProcessState.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -204,11 +204,11 @@ ssize_t ProcessState::getKernelReferences(size_t buf_count, uintptr_t* buf) // that the handle points to. Can only be used by the servicemanager. // // Returns -1 in case of failure, otherwise the strong reference count. ssize_t ProcessState::getStrongRefCountForNodeByHandle(int32_t handle) { ssize_t ProcessState::getStrongRefCountForNode(const sp<BpBinder>& binder) { binder_node_info_for_ref info; memset(&info, 0, sizeof(binder_node_info_for_ref)); info.handle = handle; info.handle = binder->getPrivateAccessorForHandle().handle(); status_t result = ioctl(mDriverFD, BINDER_GET_NODE_INFO_FOR_REF, &info); Loading
libs/binder/include/binder/BpBinder.h +17 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ namespace android { namespace internal { class Stability; } class ProcessState; using binder_proxy_limit_callback = void(*)(int); Loading @@ -37,8 +38,6 @@ class BpBinder : public IBinder public: static BpBinder* create(int32_t handle); int32_t handle() const; virtual const String16& getInterfaceDescriptor() const; virtual bool isBinderAlive() const; virtual status_t pingBinder(); Loading Loading @@ -109,7 +108,23 @@ public: KeyedVector<const void*, entry_t> mObjects; }; class PrivateAccessorForHandle { private: friend BpBinder; friend ::android::Parcel; friend ::android::ProcessState; explicit PrivateAccessorForHandle(const BpBinder* binder) : mBinder(binder) {} int32_t handle() const { return mBinder->handle(); } const BpBinder* mBinder; }; const PrivateAccessorForHandle getPrivateAccessorForHandle() const { return PrivateAccessorForHandle(this); } private: friend PrivateAccessorForHandle; int32_t handle() const; BpBinder(int32_t handle,int32_t trackedUid); virtual ~BpBinder(); virtual void onFirstRef(); Loading
libs/binder/include/binder/ProcessState.h +1 −1 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ public: // 2. Temporary strong references held by the kernel during a // transaction on the node. // It does NOT include local strong references to the node ssize_t getStrongRefCountForNodeByHandle(int32_t handle); ssize_t getStrongRefCountForNode(const sp<BpBinder>& binder); enum class CallRestriction { // all calls okay Loading