diff options
| author | 2019-07-17 16:06:01 -0700 | |
|---|---|---|
| committer | 2019-07-30 09:10:28 -0700 | |
| commit | e171d62ed38b37a70f88cb3ee50e39f545dbe983 (patch) | |
| tree | 3282d3d7583a41ca86c3eb9ae7f30fd85bef4e3f /libs/binder/Parcel.cpp | |
| parent | e6c681454520def91f619cec1807d2f34457ad09 (diff) | |
Remove read/writeWeakBinder.
Because they are relatively unused and make certain changes too
complicated to make.
Fixes: 137785053
Test: TH
Change-Id: Idb3576d7c1a7b80d0e0502e4bd895a4c713c6e87
Diffstat (limited to 'libs/binder/Parcel.cpp')
| -rw-r--r-- | libs/binder/Parcel.cpp | 108 |
1 files changed, 0 insertions, 108 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index a1ddec8920..aa9d1882a8 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -102,10 +102,6 @@ static void acquire_object(const sp<ProcessState>& proc, reinterpret_cast<IBinder*>(obj.cookie)->incStrong(who); } return; - case BINDER_TYPE_WEAK_BINDER: - if (obj.binder) - reinterpret_cast<RefBase::weakref_type*>(obj.binder)->incWeak(who); - return; case BINDER_TYPE_HANDLE: { const sp<IBinder> b = proc->getStrongProxyForHandle(obj.handle); if (b != nullptr) { @@ -114,11 +110,6 @@ static void acquire_object(const sp<ProcessState>& proc, } return; } - case BINDER_TYPE_WEAK_HANDLE: { - const wp<IBinder> b = proc->getWeakProxyForHandle(obj.handle); - if (b != nullptr) b.get_refs()->incWeak(who); - return; - } case BINDER_TYPE_FD: { if ((obj.cookie != 0) && (outAshmemSize != nullptr) && ashmem_valid(obj.handle)) { // If we own an ashmem fd, keep track of how much memory it refers to. @@ -144,10 +135,6 @@ static void release_object(const sp<ProcessState>& proc, reinterpret_cast<IBinder*>(obj.cookie)->decStrong(who); } return; - case BINDER_TYPE_WEAK_BINDER: - if (obj.binder) - reinterpret_cast<RefBase::weakref_type*>(obj.binder)->decWeak(who); - return; case BINDER_TYPE_HANDLE: { const sp<IBinder> b = proc->getStrongProxyForHandle(obj.handle); if (b != nullptr) { @@ -156,11 +143,6 @@ static void release_object(const sp<ProcessState>& proc, } return; } - case BINDER_TYPE_WEAK_HANDLE: { - const wp<IBinder> b = proc->getWeakProxyForHandle(obj.handle); - if (b != nullptr) b.get_refs()->decWeak(who); - return; - } case BINDER_TYPE_FD: { if (obj.cookie != 0) { // owned if ((outAshmemSize != nullptr) && ashmem_valid(obj.handle)) { @@ -230,55 +212,6 @@ static status_t flatten_binder(const sp<ProcessState>& /*proc*/, return finish_flatten_binder(binder, obj, out); } -static status_t flatten_binder(const sp<ProcessState>& /*proc*/, - const wp<IBinder>& binder, Parcel* out) -{ - flat_binder_object obj; - - obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS; - if (binder != nullptr) { - sp<IBinder> real = binder.promote(); - if (real != nullptr) { - IBinder *local = real->localBinder(); - if (!local) { - BpBinder *proxy = real->remoteBinder(); - if (proxy == nullptr) { - ALOGE("null proxy"); - } - const int32_t handle = proxy ? proxy->handle() : 0; - obj.hdr.type = BINDER_TYPE_WEAK_HANDLE; - obj.binder = 0; /* Don't pass uninitialized stack data to a remote process */ - obj.handle = handle; - obj.cookie = 0; - } else { - obj.hdr.type = BINDER_TYPE_WEAK_BINDER; - obj.binder = reinterpret_cast<uintptr_t>(binder.get_refs()); - obj.cookie = reinterpret_cast<uintptr_t>(binder.unsafe_get()); - } - return finish_flatten_binder(real, obj, out); - } - - // XXX How to deal? In order to flatten the given binder, - // we need to probe it for information, which requires a primary - // reference... but we don't have one. - // - // The OpenBinder implementation uses a dynamic_cast<> here, - // but we can't do that with the different reference counting - // implementation we are using. - ALOGE("Unable to unflatten Binder weak reference!"); - obj.hdr.type = BINDER_TYPE_BINDER; - obj.binder = 0; - obj.cookie = 0; - return finish_flatten_binder(nullptr, obj, out); - - } else { - obj.hdr.type = BINDER_TYPE_BINDER; - obj.binder = 0; - obj.cookie = 0; - return finish_flatten_binder(nullptr, obj, out); - } -} - inline static status_t finish_unflatten_binder( BpBinder* /*proxy*/, const flat_binder_object& /*flat*/, const Parcel& /*in*/) @@ -305,35 +238,6 @@ static status_t unflatten_binder(const sp<ProcessState>& proc, return BAD_TYPE; } -static status_t unflatten_binder(const sp<ProcessState>& proc, - const Parcel& in, wp<IBinder>* out) -{ - const flat_binder_object* flat = in.readObject(false); - - if (flat) { - switch (flat->hdr.type) { - case BINDER_TYPE_BINDER: - *out = reinterpret_cast<IBinder*>(flat->cookie); - return finish_unflatten_binder(nullptr, *flat, in); - case BINDER_TYPE_WEAK_BINDER: - if (flat->binder != 0) { - out->set_object_and_refs( - reinterpret_cast<IBinder*>(flat->cookie), - reinterpret_cast<RefBase::weakref_type*>(flat->binder)); - } else { - *out = nullptr; - } - return finish_unflatten_binder(nullptr, *flat, in); - case BINDER_TYPE_HANDLE: - case BINDER_TYPE_WEAK_HANDLE: - *out = proc->getWeakProxyForHandle(flat->handle); - return finish_unflatten_binder( - static_cast<BpBinder*>(out->unsafe_get()), *flat, in); - } - } - return BAD_TYPE; -} - // --------------------------------------------------------------------------- Parcel::Parcel() @@ -1082,11 +986,6 @@ status_t Parcel::readStrongBinderVector(std::vector<sp<IBinder>>* val) const { return readTypedVector(val, &Parcel::readStrongBinder); } -status_t Parcel::writeWeakBinder(const wp<IBinder>& val) -{ - return flatten_binder(ProcessState::self(), val, this); -} - status_t Parcel::writeRawNullableParcelable(const Parcelable* parcelable) { if (!parcelable) { return writeInt32(0); @@ -2017,13 +1916,6 @@ sp<IBinder> Parcel::readStrongBinder() const return val; } -wp<IBinder> Parcel::readWeakBinder() const -{ - wp<IBinder> val; - unflatten_binder(ProcessState::self(), *this, &val); - return val; -} - status_t Parcel::readParcelable(Parcelable* parcelable) const { int32_t have_parcelable = 0; status_t status = readInt32(&have_parcelable); |