diff options
author | Martijn Coenen <maco@google.com> | 2017-01-18 15:33:31 +0100 |
---|---|---|
committer | Martijn Coenen <maco@google.com> | 2017-01-19 16:05:26 +0100 |
commit | 5c6fe25870c611f1b0c36f034414037f91201b6d (patch) | |
tree | 93b1eaaf98fb086179276cb50980a59e10997ba0 /BpHwBinder.cpp | |
parent | 865da06f1c9933b533f21f8fd86896faea4520e8 (diff) | |
download | libhwbinder-5c6fe25870c611f1b0c36f034414037f91201b6d.tar.gz |
Reduce libhwbinder API surface (1/?).
Removed in this round:
- All Vector'ed read/write methods
- Reading/writing dup native_handles
- Blob/ashmem support
- Special binder transactions (ping, dump, interface)
- Various unused helpers.
Obvious remaining items that require more work:
- writeString16()/writeCString() and read variants
- writeInterface() / enforceInterface()
Test: hidl_test
Change-Id: Ica2bbbdee469f12c797d9f3feff6046b2337de6a
Diffstat (limited to 'BpHwBinder.cpp')
-rw-r--r-- | BpHwBinder.cpp | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/BpHwBinder.cpp b/BpHwBinder.cpp index c6d6fcf..762d048 100644 --- a/BpHwBinder.cpp +++ b/BpHwBinder.cpp @@ -99,64 +99,6 @@ BpHwBinder::BpHwBinder(int32_t handle) IPCThreadState::self()->incWeakHandle(handle); } -bool BpHwBinder::isDescriptorCached() const { - Mutex::Autolock _l(mLock); - return mDescriptorCache.size() ? true : false; -} - -const String16& BpHwBinder::getInterfaceDescriptor() const -{ - if (isDescriptorCached() == false) { - Parcel send, reply; - // do the IPC without a lock held. - status_t err = const_cast<BpHwBinder*>(this)->transact( - INTERFACE_TRANSACTION, send, &reply); - if (err == NO_ERROR) { - String16 res(reply.readString16()); - Mutex::Autolock _l(mLock); - // mDescriptorCache could have been assigned while the lock was - // released. - if (mDescriptorCache.size() == 0) - mDescriptorCache = res; - } - } - - // we're returning a reference to a non-static object here. Usually this - // is not something smart to do, however, with binder objects it is - // (usually) safe because they are reference-counted. - - return mDescriptorCache; -} - -bool BpHwBinder::isBinderAlive() const -{ - return mAlive != 0; -} - -status_t BpHwBinder::pingBinder() -{ - Parcel send; - Parcel reply; - status_t err = transact(PING_TRANSACTION, send, &reply); - if (err != NO_ERROR) return err; - if (reply.dataSize() < sizeof(status_t)) return NOT_ENOUGH_DATA; - return (status_t)reply.readInt32(); -} - -status_t BpHwBinder::dump(int fd, const Vector<String16>& args) -{ - Parcel send; - Parcel reply; - send.writeFileDescriptor(fd); - const size_t numArgs = args.size(); - send.writeInt32(numArgs); - for (size_t i = 0; i < numArgs; i++) { - send.writeString16(args[i]); - } - status_t err = transact(DUMP_TRANSACTION, send, &reply); - return err; -} - status_t BpHwBinder::transact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags, TransactCallback /*callback*/) { |