summaryrefslogtreecommitdiff
path: root/libs/binder/include/binder/BpBinder.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/binder/include/binder/BpBinder.h')
-rw-r--r--libs/binder/include/binder/BpBinder.h74
1 files changed, 14 insertions, 60 deletions
diff --git a/libs/binder/include/binder/BpBinder.h b/libs/binder/include/binder/BpBinder.h
index 61bf018e43..8e871b8214 100644
--- a/libs/binder/include/binder/BpBinder.h
+++ b/libs/binder/include/binder/BpBinder.h
@@ -14,41 +14,31 @@
* limitations under the License.
*/
-#pragma once
+#ifndef ANDROID_BPBINDER_H
+#define ANDROID_BPBINDER_H
#include <binder/IBinder.h>
-#include <binder/RpcAddress.h>
#include <utils/KeyedVector.h>
#include <utils/Mutex.h>
#include <utils/threads.h>
#include <unordered_map>
-#include <variant>
// ---------------------------------------------------------------------------
namespace android {
-class RpcSession;
-class RpcState;
namespace internal {
class Stability;
-}
-class ProcessState;
+};
using binder_proxy_limit_callback = void(*)(int);
class BpBinder : public IBinder
{
public:
- static sp<BpBinder> create(int32_t handle);
- static sp<BpBinder> create(const sp<RpcSession>& session, const RpcAddress& address);
+ static BpBinder* create(int32_t handle);
- /**
- * Return value:
- * true - this is associated with a socket RpcSession
- * false - (usual) binder over e.g. /dev/binder
- */
- bool isRpcBinder() const;
+ int32_t handle() const;
virtual const String16& getInterfaceDescriptor() const;
virtual bool isBinderAlive() const;
@@ -120,57 +110,18 @@ public:
KeyedVector<const void*, entry_t> mObjects;
};
- class PrivateAccessorForId {
- private:
- friend class BpBinder;
- friend class ::android::Parcel;
- friend class ::android::ProcessState;
- friend class ::android::RpcState;
- explicit PrivateAccessorForId(const BpBinder* binder) : mBinder(binder) {}
-
- // valid if !isRpcBinder
- int32_t binderHandle() const { return mBinder->binderHandle(); }
-
- // valid if isRpcBinder
- const RpcAddress& rpcAddress() const { return mBinder->rpcAddress(); }
- const sp<RpcSession>& rpcSession() const { return mBinder->rpcSession(); }
-
- const BpBinder* mBinder;
- };
- const PrivateAccessorForId getPrivateAccessorForId() const {
- return PrivateAccessorForId(this);
- }
-
-private:
- friend PrivateAccessorForId;
- friend class sp<BpBinder>;
-
- struct BinderHandle {
- int32_t handle;
- };
- struct RpcHandle {
- sp<RpcSession> session;
- RpcAddress address;
- };
- using Handle = std::variant<BinderHandle, RpcHandle>;
-
- int32_t binderHandle() const;
- const RpcAddress& rpcAddress() const;
- const sp<RpcSession>& rpcSession() const;
-
- explicit BpBinder(Handle&& handle);
- BpBinder(BinderHandle&& handle, int32_t trackedUid);
- explicit BpBinder(RpcHandle&& handle);
-
+protected:
+ BpBinder(int32_t handle,int32_t trackedUid);
virtual ~BpBinder();
virtual void onFirstRef();
virtual void onLastStrongRef(const void* id);
virtual bool onIncStrongAttempted(uint32_t flags, const void* id);
- friend ::android::internal::Stability;
+private:
+ const int32_t mHandle;
- int32_t mStability;
- Handle mHandle;
+ friend ::android::internal::Stability;
+ int32_t mStability;
struct Obituary {
wp<DeathRecipient> recipient;
@@ -186,6 +137,7 @@ private:
volatile int32_t mObitsSent;
Vector<Obituary>* mObituaries;
ObjectManager mObjects;
+ Parcel* mConstantData;
mutable String16 mDescriptorCache;
int32_t mTrackedUid;
@@ -202,3 +154,5 @@ private:
} // namespace android
// ---------------------------------------------------------------------------
+
+#endif // ANDROID_BPBINDER_H