From ae7f1806da64cf37e9e72e3149b52286112da101 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Wed, 17 Jul 2019 14:49:00 -0700 Subject: Remove read/writeWeakBinder. Unused/not fully implemented. Bug: N/A Test: N/A Change-Id: I48fb9121175c8bf4296e12482c69551a696aebe2 --- Parcel.cpp | 90 -------------------------------------------------------------- 1 file changed, 90 deletions(-) (limited to 'Parcel.cpp') diff --git a/Parcel.cpp b/Parcel.cpp index 5142143..c29dd37 100644 --- a/Parcel.cpp +++ b/Parcel.cpp @@ -225,55 +225,6 @@ status_t flatten_binder(const sp& /*proc*/, return finish_flatten_binder(binder, obj, out); } -status_t flatten_binder(const sp& /*proc*/, - const wp& binder, Parcel* out) -{ - flat_binder_object obj = {}; - - obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS; - if (binder != nullptr) { - sp real = binder.promote(); - if (real != nullptr) { - IBinder *local = real->localBinder(); - if (!local) { - BpHwBinder *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(binder.get_refs()); - obj.cookie = reinterpret_cast(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( BpHwBinder* /*proxy*/, const flat_binder_object& /*flat*/, const Parcel& /*in*/) @@ -300,35 +251,6 @@ status_t unflatten_binder(const sp& proc, return BAD_TYPE; } -status_t unflatten_binder(const sp& proc, - const Parcel& in, wp* out) -{ - const flat_binder_object* flat = in.readObject(); - - if (flat) { - switch (flat->hdr.type) { - case BINDER_TYPE_BINDER: - *out = reinterpret_cast(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(flat->cookie), - reinterpret_cast(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(out->unsafe_get()), *flat, in); - } - } - return BAD_TYPE; -} - // --------------------------------------------------------------------------- Parcel::Parcel() @@ -704,11 +626,6 @@ status_t Parcel::writeStrongBinder(const sp& val) return flatten_binder(ProcessState::self(), val, this); } -status_t Parcel::writeWeakBinder(const wp& val) -{ - return flatten_binder(ProcessState::self(), val, this); -} - template status_t Parcel::writeObject(const T& val) { @@ -1300,13 +1217,6 @@ sp Parcel::readStrongBinder() const return val; } -wp Parcel::readWeakBinder() const -{ - wp val; - unflatten_binder(ProcessState::self(), *this, &val); - return val; -} - template const T* Parcel::readObject(size_t *objects_offset) const { -- cgit v1.2.3