Loading libs/binder/Binder.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -141,7 +141,7 @@ public: // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- BBinder::BBinder() : mExtras(nullptr) BBinder::BBinder() : mExtras(nullptr), mStability(0) { { } } Loading libs/binder/BpBinder.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -138,6 +138,7 @@ BpBinder* BpBinder::create(int32_t handle) { BpBinder::BpBinder(int32_t handle, int32_t trackedUid) BpBinder::BpBinder(int32_t handle, int32_t trackedUid) : mHandle(handle) : mHandle(handle) , mStability(0) , mAlive(1) , mAlive(1) , mObitsSent(0) , mObitsSent(0) , mObituaries(nullptr) , mObituaries(nullptr) Loading libs/binder/Stability.cpp +15 −7 Original line number Original line Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ */ #include <binder/Stability.h> #include <binder/Stability.h> #include <binder/BpBinder.h> #include <binder/Binder.h> namespace android { namespace android { namespace internal { namespace internal { Loading Loading @@ -78,11 +81,12 @@ status_t Stability::set(IBinder* binder, int32_t stability, bool log) { if (currentStability == stability) return OK; if (currentStability == stability) return OK; binder->attachObject( BBinder* local = binder->localBinder(); reinterpret_cast<void*>(&Stability::get), if (local != nullptr) { reinterpret_cast<void*>(stability), local->mStability = static_cast<int32_t>(stability); nullptr /*cleanupCookie*/, } else { nullptr /*cleanup function*/); binder->remoteBinder()->mStability = static_cast<int32_t>(stability); } return OK; return OK; } } Loading @@ -90,8 +94,12 @@ status_t Stability::set(IBinder* binder, int32_t stability, bool log) { Stability::Level Stability::get(IBinder* binder) { Stability::Level Stability::get(IBinder* binder) { if (binder == nullptr) return UNDECLARED; if (binder == nullptr) return UNDECLARED; return static_cast<Level>(reinterpret_cast<intptr_t>( BBinder* local = binder->localBinder(); binder->findObject(reinterpret_cast<void*>(&Stability::get)))); if (local != nullptr) { return static_cast<Stability::Level>(local->mStability); } return static_cast<Stability::Level>(binder->remoteBinder()->mStability); } } bool Stability::check(int32_t provided, Level required) { bool Stability::check(int32_t provided, Level required) { Loading libs/binder/include/binder/Binder.h +10 −1 Original line number Original line Diff line number Diff line Loading @@ -24,6 +24,10 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- namespace android { namespace android { namespace internal { class Stability; } class BBinder : public IBinder class BBinder : public IBinder { { public: public: Loading Loading @@ -88,8 +92,13 @@ private: Extras* getOrCreateExtras(); Extras* getOrCreateExtras(); std::atomic<Extras*> mExtras; std::atomic<Extras*> mExtras; friend ::android::internal::Stability; union { int32_t mStability; void* mReserved0; void* mReserved0; }; }; }; // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- Loading libs/binder/include/binder/BpBinder.h +7 −0 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,10 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- namespace android { namespace android { namespace internal { class Stability; }; using binder_proxy_limit_callback = void(*)(int); using binder_proxy_limit_callback = void(*)(int); class BpBinder : public IBinder class BpBinder : public IBinder Loading Loading @@ -116,6 +120,9 @@ protected: private: private: const int32_t mHandle; const int32_t mHandle; friend ::android::internal::Stability; int32_t mStability; struct Obituary { struct Obituary { wp<DeathRecipient> recipient; wp<DeathRecipient> recipient; void* cookie; void* cookie; Loading Loading
libs/binder/Binder.cpp +1 −1 Original line number Original line Diff line number Diff line Loading @@ -141,7 +141,7 @@ public: // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- BBinder::BBinder() : mExtras(nullptr) BBinder::BBinder() : mExtras(nullptr), mStability(0) { { } } Loading
libs/binder/BpBinder.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -138,6 +138,7 @@ BpBinder* BpBinder::create(int32_t handle) { BpBinder::BpBinder(int32_t handle, int32_t trackedUid) BpBinder::BpBinder(int32_t handle, int32_t trackedUid) : mHandle(handle) : mHandle(handle) , mStability(0) , mAlive(1) , mAlive(1) , mObitsSent(0) , mObitsSent(0) , mObituaries(nullptr) , mObituaries(nullptr) Loading
libs/binder/Stability.cpp +15 −7 Original line number Original line Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ */ #include <binder/Stability.h> #include <binder/Stability.h> #include <binder/BpBinder.h> #include <binder/Binder.h> namespace android { namespace android { namespace internal { namespace internal { Loading Loading @@ -78,11 +81,12 @@ status_t Stability::set(IBinder* binder, int32_t stability, bool log) { if (currentStability == stability) return OK; if (currentStability == stability) return OK; binder->attachObject( BBinder* local = binder->localBinder(); reinterpret_cast<void*>(&Stability::get), if (local != nullptr) { reinterpret_cast<void*>(stability), local->mStability = static_cast<int32_t>(stability); nullptr /*cleanupCookie*/, } else { nullptr /*cleanup function*/); binder->remoteBinder()->mStability = static_cast<int32_t>(stability); } return OK; return OK; } } Loading @@ -90,8 +94,12 @@ status_t Stability::set(IBinder* binder, int32_t stability, bool log) { Stability::Level Stability::get(IBinder* binder) { Stability::Level Stability::get(IBinder* binder) { if (binder == nullptr) return UNDECLARED; if (binder == nullptr) return UNDECLARED; return static_cast<Level>(reinterpret_cast<intptr_t>( BBinder* local = binder->localBinder(); binder->findObject(reinterpret_cast<void*>(&Stability::get)))); if (local != nullptr) { return static_cast<Stability::Level>(local->mStability); } return static_cast<Stability::Level>(binder->remoteBinder()->mStability); } } bool Stability::check(int32_t provided, Level required) { bool Stability::check(int32_t provided, Level required) { Loading
libs/binder/include/binder/Binder.h +10 −1 Original line number Original line Diff line number Diff line Loading @@ -24,6 +24,10 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- namespace android { namespace android { namespace internal { class Stability; } class BBinder : public IBinder class BBinder : public IBinder { { public: public: Loading Loading @@ -88,8 +92,13 @@ private: Extras* getOrCreateExtras(); Extras* getOrCreateExtras(); std::atomic<Extras*> mExtras; std::atomic<Extras*> mExtras; friend ::android::internal::Stability; union { int32_t mStability; void* mReserved0; void* mReserved0; }; }; }; // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- Loading
libs/binder/include/binder/BpBinder.h +7 −0 Original line number Original line Diff line number Diff line Loading @@ -27,6 +27,10 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- namespace android { namespace android { namespace internal { class Stability; }; using binder_proxy_limit_callback = void(*)(int); using binder_proxy_limit_callback = void(*)(int); class BpBinder : public IBinder class BpBinder : public IBinder Loading Loading @@ -116,6 +120,9 @@ protected: private: private: const int32_t mHandle; const int32_t mHandle; friend ::android::internal::Stability; int32_t mStability; struct Obituary { struct Obituary { wp<DeathRecipient> recipient; wp<DeathRecipient> recipient; void* cookie; void* cookie; Loading