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
diff --git a/Binder.cpp b/Binder.cpp
index 5d850e3..94b2074 100644
--- a/Binder.cpp
+++ b/Binder.cpp
@@ -40,11 +40,6 @@
 
 // ---------------------------------------------------------------------------
 
-sp<IInterface>  IBinder::queryLocalInterface(const String16& /*descriptor*/)
-{
-    return NULL;
-}
-
 BHwBinder* IBinder::localBinder()
 {
     return NULL;
@@ -75,25 +70,6 @@
 {
 }
 
-bool BHwBinder::isBinderAlive() const
-{
-    return true;
-}
-
-status_t BHwBinder::pingBinder()
-{
-    return NO_ERROR;
-}
-
-const String16& BHwBinder::getInterfaceDescriptor() const
-{
-    // This is a local static rather than a global static,
-    // to avoid static initializer ordering issues.
-    static String16 sEmptyDescriptor;
-    ALOGW("reached BHwBinder::getInterfaceDescriptor (this=%p)", this);
-    return sEmptyDescriptor;
-}
-
 status_t BHwBinder::transact(
     uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags, TransactCallback callback)
 {
@@ -101,13 +77,6 @@
 
     status_t err = NO_ERROR;
     switch (code) {
-        case PING_TRANSACTION:
-            reply->writeInt32(pingBinder());
-            reply->setDataPosition(0);
-            if (callback != NULL) {
-                callback(*reply);
-            }
-            break;
         default:
             err = onTransact(code, data, reply, flags,
                     [&](auto &replyParcel) {
@@ -136,11 +105,6 @@
     return INVALID_OPERATION;
 }
 
-status_t BHwBinder::dump(int /*fd*/, const Vector<String16>& /*args*/)
-{
-    return NO_ERROR;
-}
-
 void BHwBinder::attachObject(
     const void* objectID, void* object, void* cleanupCookie,
     object_cleanup_func func)
@@ -194,34 +158,10 @@
 
 
 status_t BHwBinder::onTransact(
-    uint32_t code, const Parcel& data, Parcel* reply, uint32_t /*flags*/, TransactCallback callback)
+    uint32_t /*code*/, const Parcel& /*data*/, Parcel* /*reply*/, uint32_t /*flags*/,
+    TransactCallback /*callback*/)
 {
-    switch (code) {
-        case INTERFACE_TRANSACTION:
-            reply->writeString16(getInterfaceDescriptor());
-            if (callback != NULL) {
-                callback(*reply);
-            }
-            return NO_ERROR;
-
-        case DUMP_TRANSACTION: {
-            int fd = data.readFileDescriptor();
-            int argc = data.readInt32();
-            Vector<String16> args;
-            for (int i = 0; i < argc && data.dataAvail() > 0; i++) {
-               args.add(data.readString16());
-            }
-            return dump(fd, args);
-        }
-
-        case SYSPROPS_TRANSACTION: {
-            report_sysprop_change();
-            return NO_ERROR;
-        }
-
-        default:
-            return UNKNOWN_TRANSACTION;
-    }
+    return UNKNOWN_TRANSACTION;
 }
 
 // ---------------------------------------------------------------------------
diff --git a/BpHwBinder.cpp b/BpHwBinder.cpp
index c6d6fcf..762d048 100644
--- a/BpHwBinder.cpp
+++ b/BpHwBinder.cpp
@@ -99,64 +99,6 @@
     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*/)
 {
diff --git a/Parcel.cpp b/Parcel.cpp
index edfe2d9..81f97e3 100644
--- a/Parcel.cpp
+++ b/Parcel.cpp
@@ -93,27 +93,8 @@
 
 static size_t gMaxFds = 0;
 
-// Maximum size of a blob to transfer in-place.
-static const size_t BLOB_INPLACE_LIMIT = 16 * 1024;
 static const size_t PARCEL_REF_CAP = 1024;
 
-enum {
-    BLOB_INPLACE = 0,
-    BLOB_ASHMEM_IMMUTABLE = 1,
-    BLOB_ASHMEM_MUTABLE = 2,
-};
-
-void acquire_fd_object(const binder_fd_object& obj, size_t* outAshmemSize)
-{
-    if ((obj.cookie != 0) && (outAshmemSize != NULL) && ashmem_valid(obj.fd)) {
-        // If we own an ashmem fd, keep track of how much memory it refers to.
-        int size = ashmem_get_size_region(obj.fd);
-        if (size > 0) {
-            *outAshmemSize += size;
-        }
-    }
-}
-
 void acquire_binder_object(const sp<ProcessState>& proc,
     const flat_binder_object& obj, const void* who)
 {
@@ -147,7 +128,7 @@
 }
 
 void acquire_object(const sp<ProcessState>& proc, const binder_object_header& obj,
-        const void *who, size_t* outAshmemSize) {
+        const void *who) {
     switch (obj.type) {
         case BINDER_TYPE_BINDER:
         case BINDER_TYPE_WEAK_BINDER:
@@ -157,16 +138,11 @@
             acquire_binder_object(proc, fbo, who);
             break;
         }
-        case BINDER_TYPE_FD: {
-            const binder_fd_object& fdo = reinterpret_cast<const binder_fd_object&>(obj);
-            acquire_fd_object(fdo, outAshmemSize);
-            break;
-        }
     }
 }
 
-static void release_object(const sp<ProcessState>& proc,
-    const flat_binder_object& obj, const void* who, size_t* outAshmemSize)
+void release_object(const sp<ProcessState>& proc,
+    const flat_binder_object& obj, const void* who)
 {
     switch (obj.type) {
         case BINDER_TYPE_BINDER:
@@ -194,13 +170,6 @@
         }
         case BINDER_TYPE_FD: {
             if (obj.cookie != 0) { // owned
-                if ((outAshmemSize != NULL) && ashmem_valid(obj.handle)) {
-                    int size = ashmem_get_size_region(obj.handle);
-                    if (size > 0) {
-                        *outAshmemSize -= size;
-                    }
-                }
-
                 close(obj.handle);
             }
             return;
@@ -210,7 +179,7 @@
             return;
         }
         case BINDER_TYPE_FDA: {
-            // TODO free fdas
+            // The enclosed file descriptors are closed in the kernel
             return;
         }
     }
@@ -218,12 +187,6 @@
     ALOGE("Invalid object type 0x%08x", obj.type);
 }
 
-void release_object(const sp<ProcessState>& proc,
-    const flat_binder_object& obj, const void* who)
-{
-    release_object(proc, obj, who, NULL);
-}
-
 inline static status_t finish_flatten_binder(
     const sp<IBinder>& /*binder*/, const flat_binder_object& flat, Parcel* out)
 {
@@ -492,155 +455,15 @@
     return err;
 }
 
-status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len)
-{
-    const sp<ProcessState> proc(ProcessState::self());
-    status_t err;
-    const uint8_t *data = parcel->mData;
-    const binder_size_t *objects = parcel->mObjects;
-    size_t size = parcel->mObjectsSize;
-    int startPos = mDataPos;
-    int firstIndex = -1, lastIndex = -2;
-
-    if (len == 0) {
-        return NO_ERROR;
-    }
-
-    if (len > INT32_MAX) {
-        // don't accept size_t values which may have come from an
-        // inadvertent conversion from a negative int.
-        return BAD_VALUE;
-    }
-
-    // range checks against the source parcel size
-    if ((offset > parcel->mDataSize)
-            || (len > parcel->mDataSize)
-            || (offset + len > parcel->mDataSize)) {
-        return BAD_VALUE;
-    }
-
-    // Count objects in range
-    for (int i = 0; i < (int) size; i++) {
-        size_t off = objects[i];
-        if ((off >= offset) && (off + sizeof(flat_binder_object) <= offset + len)) {
-            if (firstIndex == -1) {
-                firstIndex = i;
-            }
-            lastIndex = i;
-        }
-    }
-    int numObjects = lastIndex - firstIndex + 1;
-
-    if ((mDataSize+len) > mDataCapacity) {
-        // grow data
-        err = growData(len);
-        if (err != NO_ERROR) {
-            return err;
-        }
-    }
-
-    // append data
-    memcpy(mData + mDataPos, data + offset, len);
-    mDataPos += len;
-    mDataSize += len;
-
-    err = NO_ERROR;
-
-    if (numObjects > 0) {
-        // grow objects
-        if (mObjectsCapacity < mObjectsSize + numObjects) {
-            size_t newSize = ((mObjectsSize + numObjects)*3)/2;
-            if (newSize < mObjectsSize) return NO_MEMORY;   // overflow
-            binder_size_t *objects =
-                (binder_size_t*)realloc(mObjects, newSize*sizeof(binder_size_t));
-            if (objects == (binder_size_t*)0) {
-                return NO_MEMORY;
-            }
-            mObjects = objects;
-            mObjectsCapacity = newSize;
-        }
-
-        // append and acquire objects
-        int idx = mObjectsSize;
-        for (int i = firstIndex; i <= lastIndex; i++) {
-            size_t off = objects[i] - offset + startPos;
-            mObjects[idx++] = off;
-            mObjectsSize++;
-
-            binder_object_header* hdr = reinterpret_cast<binder_object_header*>(mData + off);
-            acquire_object(proc, *hdr, this, &mOpenAshmemSize);
-
-            if (hdr->type == BINDER_TYPE_FD) {
-                binder_fd_object *fdo = reinterpret_cast<binder_fd_object*>(hdr);
-                // If this is a file descriptor, we need to dup it so the
-                // new Parcel now owns its own fd, and can declare that we
-                // officially know we have fds.
-                fdo->fd = dup(fdo->fd);
-                fdo->cookie = 1;
-                mHasFds = mFdsKnown = true;
-                if (!mAllowFds) {
-                    err = FDS_NOT_ALLOWED;
-                }
-            }
-        }
-    }
-
-    return err;
-}
-
-bool Parcel::allowFds() const
-{
-    return mAllowFds;
-}
-
-bool Parcel::pushAllowFds(bool allowFds)
-{
-    const bool origValue = mAllowFds;
-    if (!allowFds) {
-        mAllowFds = false;
-    }
-    return origValue;
-}
-
-void Parcel::restoreAllowFds(bool lastValue)
-{
-    mAllowFds = lastValue;
-}
-
-bool Parcel::hasFileDescriptors() const
-{
-    if (!mFdsKnown) {
-        scanForFds();
-    }
-    return mHasFds;
-}
-
 // Write RPC headers.  (previously just the interface token)
 status_t Parcel::writeInterfaceToken(const char* interface)
 {
-    writeInt32(IPCThreadState::self()->getStrictModePolicy() |
-               STRICT_MODE_PENALTY_GATHER);
     // currently the interface identification token is just its name as a string
     return writeCString(interface);
 }
 
-bool Parcel::enforceInterface(const char* interface,
-                              IPCThreadState* threadState) const
+bool Parcel::enforceInterface(const char* interface) const
 {
-    int32_t strictPolicy = readInt32();
-    if (threadState == NULL) {
-        threadState = IPCThreadState::self();
-    }
-    if ((threadState->getLastTransactionBinderFlags() &
-         IBinder::FLAG_ONEWAY) != 0) {
-      // For one-way calls, the callee is running entirely
-      // disconnected from the caller, so disable StrictMode entirely.
-      // Not only does disk/network usage not impact the caller, but
-      // there's no way to commuicate back any violations anyway.
-      threadState->setStrictModePolicy(0);
-    } else {
-      threadState->setStrictModePolicy(strictPolicy);
-    }
     const char* str = readCString();
     if (strcmp(str, interface) == 0) {
         return true;
@@ -777,174 +600,6 @@
     return NULL;
 }
 
-status_t Parcel::writeUtf8AsUtf16(const std::string& str) {
-    const uint8_t* strData = (uint8_t*)str.data();
-    const size_t strLen= str.length();
-    const ssize_t utf16Len = utf8_to_utf16_length(strData, strLen);
-    if (utf16Len < 0 || utf16Len> std::numeric_limits<int32_t>::max()) {
-        return BAD_VALUE;
-    }
-
-    status_t err = writeInt32(utf16Len);
-    if (err) {
-        return err;
-    }
-
-    // Allocate enough bytes to hold our converted string and its terminating NULL.
-    void* dst = writeInplace((utf16Len + 1) * sizeof(char16_t));
-    if (!dst) {
-        return NO_MEMORY;
-    }
-
-    utf8_to_utf16(strData, strLen, (char16_t*)dst, static_cast<size_t>(utf16Len) + 1);
-
-    return NO_ERROR;
-}
-
-status_t Parcel::writeUtf8AsUtf16(const std::unique_ptr<std::string>& str) {
-  if (!str) {
-    return writeInt32(-1);
-  }
-  return writeUtf8AsUtf16(*str);
-}
-
-namespace {
-
-template<typename T>
-status_t writeByteVectorInternal(Parcel* parcel, const std::vector<T>& val)
-{
-    status_t status;
-    if (val.size() > std::numeric_limits<int32_t>::max()) {
-        status = BAD_VALUE;
-        return status;
-    }
-
-    status = parcel->writeInt32(val.size());
-    if (status != OK) {
-        return status;
-    }
-
-    void* data = parcel->writeInplace(val.size());
-    if (!data) {
-        status = BAD_VALUE;
-        return status;
-    }
-
-    memcpy(data, val.data(), val.size());
-    return status;
-}
-
-template<typename T>
-status_t writeByteVectorInternalPtr(Parcel* parcel,
-                                    const std::unique_ptr<std::vector<T>>& val)
-{
-    if (!val) {
-        return parcel->writeInt32(-1);
-    }
-
-    return writeByteVectorInternal(parcel, *val);
-}
-
-}  // namespace
-
-status_t Parcel::writeByteVector(const std::vector<int8_t>& val) {
-    return writeByteVectorInternal(this, val);
-}
-
-status_t Parcel::writeByteVector(const std::unique_ptr<std::vector<int8_t>>& val)
-{
-    return writeByteVectorInternalPtr(this, val);
-}
-
-status_t Parcel::writeByteVector(const std::vector<uint8_t>& val) {
-    return writeByteVectorInternal(this, val);
-}
-
-status_t Parcel::writeByteVector(const std::unique_ptr<std::vector<uint8_t>>& val)
-{
-    return writeByteVectorInternalPtr(this, val);
-}
-
-status_t Parcel::writeInt32Vector(const std::vector<int32_t>& val)
-{
-    return writeTypedVector(val, &Parcel::writeInt32);
-}
-
-status_t Parcel::writeInt32Vector(const std::unique_ptr<std::vector<int32_t>>& val)
-{
-    return writeNullableTypedVector(val, &Parcel::writeInt32);
-}
-
-status_t Parcel::writeInt64Vector(const std::vector<int64_t>& val)
-{
-    return writeTypedVector(val, &Parcel::writeInt64);
-}
-
-status_t Parcel::writeInt64Vector(const std::unique_ptr<std::vector<int64_t>>& val)
-{
-    return writeNullableTypedVector(val, &Parcel::writeInt64);
-}
-
-status_t Parcel::writeFloatVector(const std::vector<float>& val)
-{
-    return writeTypedVector(val, &Parcel::writeFloat);
-}
-
-status_t Parcel::writeFloatVector(const std::unique_ptr<std::vector<float>>& val)
-{
-    return writeNullableTypedVector(val, &Parcel::writeFloat);
-}
-
-status_t Parcel::writeDoubleVector(const std::vector<double>& val)
-{
-    return writeTypedVector(val, &Parcel::writeDouble);
-}
-
-status_t Parcel::writeDoubleVector(const std::unique_ptr<std::vector<double>>& val)
-{
-    return writeNullableTypedVector(val, &Parcel::writeDouble);
-}
-
-status_t Parcel::writeBoolVector(const std::vector<bool>& val)
-{
-    return writeTypedVector(val, &Parcel::writeBool);
-}
-
-status_t Parcel::writeBoolVector(const std::unique_ptr<std::vector<bool>>& val)
-{
-    return writeNullableTypedVector(val, &Parcel::writeBool);
-}
-
-status_t Parcel::writeCharVector(const std::vector<char16_t>& val)
-{
-    return writeTypedVector(val, &Parcel::writeChar);
-}
-
-status_t Parcel::writeCharVector(const std::unique_ptr<std::vector<char16_t>>& val)
-{
-    return writeNullableTypedVector(val, &Parcel::writeChar);
-}
-
-status_t Parcel::writeString16Vector(const std::vector<String16>& val)
-{
-    return writeTypedVector(val, &Parcel::writeString16);
-}
-
-status_t Parcel::writeString16Vector(
-        const std::unique_ptr<std::vector<std::unique_ptr<String16>>>& val)
-{
-    return writeNullableTypedVector(val, &Parcel::writeString16);
-}
-
-status_t Parcel::writeUtf8VectorAsUtf16Vector(
-                        const std::unique_ptr<std::vector<std::unique_ptr<std::string>>>& val) {
-    return writeNullableTypedVector(val, &Parcel::writeUtf8AsUtf16);
-}
-
-status_t Parcel::writeUtf8VectorAsUtf16Vector(const std::vector<std::string>& val) {
-    return writeTypedVector(val, &Parcel::writeUtf8AsUtf16);
-}
-
 status_t Parcel::writeInt8(int8_t val)
 {
     return write(&val, sizeof(val));
@@ -975,54 +630,10 @@
     return writeAligned(val);
 }
 
-status_t Parcel::writeInt32Array(size_t len, const int32_t *val) {
-    if (len > INT32_MAX) {
-        // don't accept size_t values which may have come from an
-        // inadvertent conversion from a negative int.
-        return BAD_VALUE;
-    }
-
-    if (!val) {
-        return writeInt32(-1);
-    }
-    status_t ret = writeInt32(static_cast<uint32_t>(len));
-    if (ret == NO_ERROR) {
-        ret = write(val, len * sizeof(*val));
-    }
-    return ret;
-}
-status_t Parcel::writeByteArray(size_t len, const uint8_t *val) {
-    if (len > INT32_MAX) {
-        // don't accept size_t values which may have come from an
-        // inadvertent conversion from a negative int.
-        return BAD_VALUE;
-    }
-
-    if (!val) {
-        return writeInt32(-1);
-    }
-    status_t ret = writeInt32(static_cast<uint32_t>(len));
-    if (ret == NO_ERROR) {
-        ret = write(val, len * sizeof(*val));
-    }
-    return ret;
-}
-
 status_t Parcel::writeBool(bool val)
 {
     return writeInt8(int8_t(val));
 }
-
-status_t Parcel::writeChar(char16_t val)
-{
-    return writeInt32(int32_t(val));
-}
-
-status_t Parcel::writeByte(int8_t val)
-{
-    return writeInt32(int32_t(val));
-}
-
 status_t Parcel::writeInt64(int64_t val)
 {
     return writeAligned(val);
@@ -1068,19 +679,6 @@
 {
     return write(str, strlen(str)+1);
 }
-
-status_t Parcel::writeString8(const String8& str)
-{
-    status_t err = writeInt32(str.bytes());
-    // only write string if its length is more than zero characters,
-    // as readString8 will only read if the length field is non-zero.
-    // this is slightly different from how writeString16 works.
-    if (str.bytes() > 0 && err == NO_ERROR) {
-        err = write(str.string(), str.bytes()+1);
-    }
-    return err;
-}
-
 status_t Parcel::writeString16(const std::unique_ptr<String16>& str)
 {
     if (!str) {
@@ -1112,162 +710,16 @@
     }
     return err;
 }
-
 status_t Parcel::writeStrongBinder(const sp<IBinder>& val)
 {
     return flatten_binder(ProcessState::self(), val, this);
 }
 
-status_t Parcel::writeStrongBinderVector(const std::vector<sp<IBinder>>& val)
-{
-    return writeTypedVector(val, &Parcel::writeStrongBinder);
-}
-
-status_t Parcel::writeStrongBinderVector(const std::unique_ptr<std::vector<sp<IBinder>>>& val)
-{
-    return writeNullableTypedVector(val, &Parcel::writeStrongBinder);
-}
-
-status_t Parcel::readStrongBinderVector(std::unique_ptr<std::vector<sp<IBinder>>>* val) const {
-    return readNullableTypedVector(val, &Parcel::readNullableStrongBinder);
-}
-
-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::writeNativeHandle(const native_handle* handle)
-{
-    if (handle == nullptr) {
-        return BAD_VALUE;
-    }
-
-    if (handle->version != sizeof(native_handle))
-        return BAD_TYPE;
-
-    status_t err;
-    err = writeInt32(handle->numFds);
-    if (err != NO_ERROR) return err;
-
-    err = writeInt32(handle->numInts);
-    if (err != NO_ERROR) return err;
-
-    for (int i=0 ; err==NO_ERROR && i<handle->numFds ; i++)
-        err = writeDupFileDescriptor(handle->data[i]);
-
-    if (err != NO_ERROR) {
-        ALOGD("write native handle, write dup fd failed");
-        return err;
-    }
-    err = write(handle->data + handle->numFds, sizeof(int)*handle->numInts);
-    return err;
-}
-
-status_t Parcel::writeFileDescriptor(int fd, bool takeOwnership)
-{
-    binder_fd_object obj;
-    obj.hdr.type = BINDER_TYPE_FD;
-    obj.pad_flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS;
-    obj.pad_binder = 0;
-    obj.fd = fd;
-    obj.cookie = takeOwnership ? 1 : 0;
-    return writeObject(obj);
-}
-
-status_t Parcel::writeDupFileDescriptor(int fd)
-{
-    int dupFd = dup(fd);
-    if (dupFd < 0) {
-        return -errno;
-    }
-    status_t err = writeFileDescriptor(dupFd, true /*takeOwnership*/);
-    if (err != OK) {
-        close(dupFd);
-    }
-    return err;
-}
-
-status_t Parcel::writeUniqueFileDescriptor(const base::unique_fd& fd) {
-    return writeDupFileDescriptor(fd.get());
-}
-
-status_t Parcel::writeUniqueFileDescriptorVector(const std::vector<base::unique_fd>& val) {
-    return writeTypedVector(val, &Parcel::writeUniqueFileDescriptor);
-}
-
-status_t Parcel::writeUniqueFileDescriptorVector(const std::unique_ptr<std::vector<base::unique_fd>>& val) {
-    return writeNullableTypedVector(val, &Parcel::writeUniqueFileDescriptor);
-}
-
-status_t Parcel::writeBlob(size_t len, bool mutableCopy, WritableBlob* outBlob)
-{
-    if (len > INT32_MAX) {
-        // don't accept size_t values which may have come from an
-        // inadvertent conversion from a negative int.
-        return BAD_VALUE;
-    }
-
-    status_t status;
-    if (!mAllowFds || len <= BLOB_INPLACE_LIMIT) {
-        ALOGV("writeBlob: write in place");
-        status = writeInt32(BLOB_INPLACE);
-        if (status) return status;
-
-        void* ptr = writeInplace(len);
-        if (!ptr) return NO_MEMORY;
-
-        outBlob->init(-1, ptr, len, false);
-        return NO_ERROR;
-    }
-
-    ALOGV("writeBlob: write to ashmem");
-    int fd = ashmem_create_region("Parcel Blob", len);
-    if (fd < 0) return NO_MEMORY;
-
-    int result = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE);
-    if (result < 0) {
-        status = result;
-    } else {
-        void* ptr = ::mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-        if (ptr == MAP_FAILED) {
-            status = -errno;
-        } else {
-            if (!mutableCopy) {
-                result = ashmem_set_prot_region(fd, PROT_READ);
-            }
-            if (result < 0) {
-                status = result;
-            } else {
-                status = writeInt32(mutableCopy ? BLOB_ASHMEM_MUTABLE : BLOB_ASHMEM_IMMUTABLE);
-                if (!status) {
-                    status = writeFileDescriptor(fd, true /*takeOwnership*/);
-                    if (!status) {
-                        outBlob->init(fd, ptr, len, mutableCopy);
-                        return NO_ERROR;
-                    }
-                }
-            }
-        }
-        ::munmap(ptr, len);
-    }
-    ::close(fd);
-    return status;
-}
-
-status_t Parcel::writeDupImmutableBlobFileDescriptor(int fd)
-{
-    // Must match up with what's done in writeBlob.
-    if (!mAllowFds) return FDS_NOT_ALLOWED;
-    status_t status = writeInt32(BLOB_ASHMEM_IMMUTABLE);
-    if (status) return status;
-    return writeDupFileDescriptor(fd);
-}
-
 template <typename T>
 status_t Parcel::writeObject(const T& val)
 {
@@ -1299,7 +751,6 @@
                 }
                 mHasFds = mFdsKnown = true;
                 mObjects[mObjectsSize++] = mDataPos;
-                acquire_fd_object(*fd_obj, &mOpenAshmemSize);
                 break;
             }
             case BINDER_TYPE_FDA:
@@ -1720,193 +1171,6 @@
     return err;
 }
 
-namespace {
-
-template<typename T>
-status_t readByteVectorInternal(const Parcel* parcel,
-                                std::vector<T>* val) {
-    val->clear();
-
-    int32_t size;
-    status_t status = parcel->readInt32(&size);
-
-    if (status != OK) {
-        return status;
-    }
-
-    if (size < 0) {
-        status = UNEXPECTED_NULL;
-        return status;
-    }
-    if (size_t(size) > parcel->dataAvail()) {
-        status = BAD_VALUE;
-        return status;
-    }
-
-    const void* data = parcel->readInplace(size);
-    if (!data) {
-        status = BAD_VALUE;
-        return status;
-    }
-    val->resize(size);
-    memcpy(val->data(), data, size);
-
-    return status;
-}
-
-template<typename T>
-status_t readByteVectorInternalPtr(
-        const Parcel* parcel,
-        std::unique_ptr<std::vector<T>>* val) {
-    const int32_t start = parcel->dataPosition();
-    int32_t size;
-    status_t status = parcel->readInt32(&size);
-    val->reset();
-
-    if (status != OK || size < 0) {
-        return status;
-    }
-
-    parcel->setDataPosition(start);
-    val->reset(new (std::nothrow) std::vector<T>());
-
-    status = readByteVectorInternal(parcel, val->get());
-
-    if (status != OK) {
-        val->reset();
-    }
-
-    return status;
-}
-
-}  // namespace
-
-status_t Parcel::readByteVector(std::vector<int8_t>* val) const {
-    return readByteVectorInternal(this, val);
-}
-
-status_t Parcel::readByteVector(std::vector<uint8_t>* val) const {
-    return readByteVectorInternal(this, val);
-}
-
-status_t Parcel::readByteVector(std::unique_ptr<std::vector<int8_t>>* val) const {
-    return readByteVectorInternalPtr(this, val);
-}
-
-status_t Parcel::readByteVector(std::unique_ptr<std::vector<uint8_t>>* val) const {
-    return readByteVectorInternalPtr(this, val);
-}
-
-status_t Parcel::readInt32Vector(std::unique_ptr<std::vector<int32_t>>* val) const {
-    return readNullableTypedVector(val, &Parcel::readInt32);
-}
-
-status_t Parcel::readInt32Vector(std::vector<int32_t>* val) const {
-    return readTypedVector(val, &Parcel::readInt32);
-}
-
-status_t Parcel::readInt64Vector(std::unique_ptr<std::vector<int64_t>>* val) const {
-    return readNullableTypedVector(val, &Parcel::readInt64);
-}
-
-status_t Parcel::readInt64Vector(std::vector<int64_t>* val) const {
-    return readTypedVector(val, &Parcel::readInt64);
-}
-
-status_t Parcel::readFloatVector(std::unique_ptr<std::vector<float>>* val) const {
-    return readNullableTypedVector(val, &Parcel::readFloat);
-}
-
-status_t Parcel::readFloatVector(std::vector<float>* val) const {
-    return readTypedVector(val, &Parcel::readFloat);
-}
-
-status_t Parcel::readDoubleVector(std::unique_ptr<std::vector<double>>* val) const {
-    return readNullableTypedVector(val, &Parcel::readDouble);
-}
-
-status_t Parcel::readDoubleVector(std::vector<double>* val) const {
-    return readTypedVector(val, &Parcel::readDouble);
-}
-
-status_t Parcel::readBoolVector(std::unique_ptr<std::vector<bool>>* val) const {
-    const int32_t start = dataPosition();
-    int32_t size;
-    status_t status = readInt32(&size);
-    val->reset();
-
-    if (status != OK || size < 0) {
-        return status;
-    }
-
-    setDataPosition(start);
-    val->reset(new (std::nothrow) std::vector<bool>());
-
-    status = readBoolVector(val->get());
-
-    if (status != OK) {
-        val->reset();
-    }
-
-    return status;
-}
-
-status_t Parcel::readBoolVector(std::vector<bool>* val) const {
-    int32_t size;
-    status_t status = readInt32(&size);
-
-    if (status != OK) {
-        return status;
-    }
-
-    if (size < 0) {
-        return UNEXPECTED_NULL;
-    }
-
-    val->resize(size);
-
-    /* C++ bool handling means a vector of bools isn't necessarily addressable
-     * (we might use individual bits)
-     */
-    bool data;
-    for (int32_t i = 0; i < size; ++i) {
-        status = readBool(&data);
-        (*val)[i] = data;
-
-        if (status != OK) {
-            return status;
-        }
-    }
-
-    return OK;
-}
-
-status_t Parcel::readCharVector(std::unique_ptr<std::vector<char16_t>>* val) const {
-    return readNullableTypedVector(val, &Parcel::readChar);
-}
-
-status_t Parcel::readCharVector(std::vector<char16_t>* val) const {
-    return readTypedVector(val, &Parcel::readChar);
-}
-
-status_t Parcel::readString16Vector(
-        std::unique_ptr<std::vector<std::unique_ptr<String16>>>* val) const {
-    return readNullableTypedVector(val, &Parcel::readString16);
-}
-
-status_t Parcel::readString16Vector(std::vector<String16>* val) const {
-    return readTypedVector(val, &Parcel::readString16);
-}
-
-status_t Parcel::readUtf8VectorFromUtf16Vector(
-        std::unique_ptr<std::vector<std::unique_ptr<std::string>>>* val) const {
-    return readNullableTypedVector(val, &Parcel::readUtf8FromUtf16);
-}
-
-status_t Parcel::readUtf8VectorFromUtf16Vector(std::vector<std::string>* val) const {
-    return readTypedVector(val, &Parcel::readUtf8FromUtf16);
-}
-
 status_t Parcel::readInt8(int8_t *pArg) const
 {
     return read(pArg, sizeof(*pArg));
@@ -1952,7 +1216,6 @@
     return readAligned(pArg);
 }
 
-
 int64_t Parcel::readInt64() const
 {
     return readAligned<int64_t>();
@@ -2034,17 +1297,6 @@
 
 #endif
 
-status_t Parcel::readIntPtr(intptr_t *pArg) const
-{
-    return readAligned(pArg);
-}
-
-
-intptr_t Parcel::readIntPtr() const
-{
-    return readAligned<intptr_t>();
-}
-
 status_t Parcel::readBool(bool *pArg) const
 {
     int8_t tmp;
@@ -2065,74 +1317,6 @@
     return tmp != 0;
 }
 
-status_t Parcel::readChar(char16_t *pArg) const
-{
-    int32_t tmp;
-    status_t ret = readInt32(&tmp);
-    *pArg = char16_t(tmp);
-    return ret;
-}
-
-char16_t Parcel::readChar() const
-{
-    return char16_t(readInt32());
-}
-
-status_t Parcel::readByte(int8_t *pArg) const
-{
-    int32_t tmp;
-    status_t ret = readInt32(&tmp);
-    *pArg = int8_t(tmp);
-    return ret;
-}
-
-int8_t Parcel::readByte() const
-{
-    return int8_t(readInt32());
-}
-
-status_t Parcel::readUtf8FromUtf16(std::string* str) const {
-    size_t utf16Size = 0;
-    const char16_t* src = readString16Inplace(&utf16Size);
-    if (!src) {
-        return UNEXPECTED_NULL;
-    }
-
-    // Save ourselves the trouble, we're done.
-    if (utf16Size == 0u) {
-        str->clear();
-       return NO_ERROR;
-    }
-
-    // Allow for closing '\0'
-    ssize_t utf8Size = utf16_to_utf8_length(src, utf16Size) + 1;
-    if (utf8Size < 1) {
-        return BAD_VALUE;
-    }
-    // Note that while it is probably safe to assume string::resize keeps a
-    // spare byte around for the trailing null, we still pass the size including
-    // the trailing null
-    str->resize(utf8Size);
-    utf16_to_utf8(src, utf16Size, &((*str)[0]), utf8Size);
-    str->resize(utf8Size - 1);
-    return NO_ERROR;
-}
-
-status_t Parcel::readUtf8FromUtf16(std::unique_ptr<std::string>* str) const {
-    const int32_t start = dataPosition();
-    int32_t size;
-    status_t status = readInt32(&size);
-    str->reset();
-
-    if (status != OK || size < 0) {
-        return status;
-    }
-
-    setDataPosition(start);
-    str->reset(new (std::nothrow) std::string());
-    return readUtf8FromUtf16(str->get());
-}
-
 const char* Parcel::readCString() const
 {
     const size_t avail = mDataSize-mDataPos;
@@ -2149,18 +1333,6 @@
     }
     return NULL;
 }
-
-String8 Parcel::readString8() const
-{
-    int32_t size = readInt32();
-    // watch for potential int overflow adding 1 for trailing NUL
-    if (size > 0 && size < INT32_MAX) {
-        const char* str = (const char*)readInplace(size+1);
-        if (str) return String8(str, size);
-    }
-    return String8();
-}
-
 String16 Parcel::readString16() const
 {
     size_t len;
@@ -2220,7 +1392,6 @@
     *outLen = 0;
     return NULL;
 }
-
 status_t Parcel::readStrongBinder(sp<IBinder>* val) const
 {
     status_t status = readNullableStrongBinder(val);
@@ -2252,98 +1423,6 @@
     return val;
 }
 
-native_handle* Parcel::readNativeHandle() const
-{
-    int numFds, numInts;
-    status_t err;
-    err = readInt32(&numFds);
-    if (err != NO_ERROR) return 0;
-    err = readInt32(&numInts);
-    if (err != NO_ERROR) return 0;
-
-    native_handle* h = native_handle_create(numFds, numInts);
-    if (!h) {
-        return 0;
-    }
-
-    for (int i=0 ; err==NO_ERROR && i<numFds ; i++) {
-        h->data[i] = dup(readFileDescriptor());
-        if (h->data[i] < 0) err = BAD_VALUE;
-    }
-    err = read(h->data + numFds, sizeof(int)*numInts);
-    if (err != NO_ERROR) {
-        native_handle_close(h);
-        native_handle_delete(h);
-        h = 0;
-    }
-    return h;
-}
-
-int Parcel::readFileDescriptor() const
-{
-    const binder_fd_object* fdo = readObject<binder_fd_object>();
-
-    if (fdo && fdo->hdr.type == BINDER_TYPE_FD) {
-        return fdo->fd;
-    }
-
-    return BAD_TYPE;
-}
-
-status_t Parcel::readUniqueFileDescriptor(base::unique_fd* val) const
-{
-    int got = readFileDescriptor();
-
-    if (got == BAD_TYPE) {
-        return BAD_TYPE;
-    }
-
-    val->reset(dup(got));
-
-    if (val->get() < 0) {
-        return BAD_VALUE;
-    }
-
-    return OK;
-}
-
-
-status_t Parcel::readUniqueFileDescriptorVector(std::unique_ptr<std::vector<base::unique_fd>>* val) const {
-    return readNullableTypedVector(val, &Parcel::readUniqueFileDescriptor);
-}
-
-status_t Parcel::readUniqueFileDescriptorVector(std::vector<base::unique_fd>* val) const {
-    return readTypedVector(val, &Parcel::readUniqueFileDescriptor);
-}
-
-status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const
-{
-    int32_t blobType;
-    status_t status = readInt32(&blobType);
-    if (status) return status;
-
-    if (blobType == BLOB_INPLACE) {
-        ALOGV("readBlob: read in place");
-        const void* ptr = readInplace(len);
-        if (!ptr) return BAD_VALUE;
-
-        outBlob->init(-1, const_cast<void*>(ptr), len, false);
-        return NO_ERROR;
-    }
-
-    ALOGV("readBlob: read from ashmem");
-    bool isMutable = (blobType == BLOB_ASHMEM_MUTABLE);
-    int fd = readFileDescriptor();
-    if (fd == int(BAD_TYPE)) return BAD_VALUE;
-
-    void* ptr = ::mmap(NULL, len, isMutable ? PROT_READ | PROT_WRITE : PROT_READ,
-            MAP_SHARED, fd, 0);
-    if (ptr == MAP_FAILED) return NO_MEMORY;
-
-    outBlob->init(fd, ptr, len, isMutable);
-    return NO_ERROR;
-}
-
 template<typename T>
 const T* Parcel::readObject() const
 {
@@ -2716,7 +1795,7 @@
         i--;
         const flat_binder_object* flat
             = reinterpret_cast<flat_binder_object*>(data+objects[i]);
-        release_object(proc, *flat, this, &mOpenAshmemSize);
+        release_object(proc, *flat, this);
     }
 }
 
@@ -2730,7 +1809,7 @@
         i--;
         const binder_object_header* flat
             = reinterpret_cast<binder_object_header*>(data+objects[i]);
-        acquire_object(proc, *flat, this, &mOpenAshmemSize);
+        acquire_object(proc, *flat, this);
     }
 }
 
@@ -2924,7 +2003,7 @@
                     // will need to rescan because we may have lopped off the only FDs
                     mFdsKnown = false;
                 }
-                release_object(proc, *flat, this, &mOpenAshmemSize);
+                release_object(proc, *flat, this);
             }
             binder_size_t* objects =
                 (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t));
@@ -3011,7 +2090,6 @@
     mFdsKnown = true;
     mAllowFds = true;
     mOwner = NULL;
-    mOpenAshmemSize = 0;
     clearCache();
     mNumRef = 0;
 
@@ -3043,49 +2121,5 @@
     mFdsKnown = true;
 }
 
-size_t Parcel::getBlobAshmemSize() const
-{
-    // This used to return the size of all blobs that were written to ashmem, now we're returning
-    // the ashmem currently referenced by this Parcel, which should be equivalent.
-    // TODO: Remove method once ABI can be changed.
-    return mOpenAshmemSize;
-}
-
-size_t Parcel::getOpenAshmemSize() const
-{
-    return mOpenAshmemSize;
-}
-
-// --- Parcel::Blob ---
-
-Parcel::Blob::Blob() :
-        mFd(-1), mData(NULL), mSize(0), mMutable(false) {
-}
-
-Parcel::Blob::~Blob() {
-    release();
-}
-
-void Parcel::Blob::release() {
-    if (mFd != -1 && mData) {
-        ::munmap(mData, mSize);
-    }
-    clear();
-}
-
-void Parcel::Blob::init(int fd, void* data, size_t size, bool isMutable) {
-    mFd = fd;
-    mData = data;
-    mSize = size;
-    mMutable = isMutable;
-}
-
-void Parcel::Blob::clear() {
-    mFd = -1;
-    mData = NULL;
-    mSize = 0;
-    mMutable = false;
-}
-
 }; // namespace hardware
 }; // namespace android
diff --git a/ProcessState.cpp b/ProcessState.cpp
index 3c369f7..21223fb 100644
--- a/ProcessState.cpp
+++ b/ProcessState.cpp
@@ -190,33 +190,6 @@
         // in getWeakProxyForHandle() for more info about this.
         IBinder* b = e->binder;
         if (b == NULL || !e->refs->attemptIncWeak(this)) {
-            if (handle == 0) {
-                // Special case for context manager...
-                // The context manager is the only object for which we create
-                // a BpHwBinder proxy without already holding a reference.
-                // Perform a dummy transaction to ensure the context manager
-                // is registered before we create the first local reference
-                // to it (which will occur when creating the BpHwBinder).
-                // If a local reference is created for the BpHwBinder when the
-                // context manager is not present, the driver will fail to
-                // provide a reference to the context manager, but the
-                // driver API does not return status.
-                //
-                // Note that this is not race-free if the context manager
-                // dies while this code runs.
-                //
-                // TODO: add a driver API to wait for context manager, or
-                // stop special casing handle 0 for context manager and add
-                // a driver API to get a handle to the context manager with
-                // proper reference counting.
-
-                Parcel data;
-                status_t status = IPCThreadState::self()->transact(
-                        0, IBinder::PING_TRANSACTION, data, NULL, 0);
-                if (status == DEAD_OBJECT)
-                   return NULL;
-            }
-
             b = new BpHwBinder(handle);
             e->binder = b;
             if (b) e->refs = b->getWeakRefs();
diff --git a/include/hwbinder/Binder.h b/include/hwbinder/Binder.h
index ddf17ff..5611cec 100644
--- a/include/hwbinder/Binder.h
+++ b/include/hwbinder/Binder.h
@@ -30,11 +30,6 @@
 public:
                         BHwBinder();
 
-    virtual const String16& getInterfaceDescriptor() const;
-    virtual bool        isBinderAlive() const;
-    virtual status_t    pingBinder();
-    virtual status_t    dump(int fd, const Vector<String16>& args);
-
     virtual status_t    transact(   uint32_t code,
                                     const Parcel& data,
                                     Parcel* reply,
diff --git a/include/hwbinder/BpHwBinder.h b/include/hwbinder/BpHwBinder.h
index a49f232..dc3073a 100644
--- a/include/hwbinder/BpHwBinder.h
+++ b/include/hwbinder/BpHwBinder.h
@@ -32,11 +32,6 @@
 
     inline  int32_t     handle() const { return mHandle; }
 
-    virtual const String16&    getInterfaceDescriptor() const;
-    virtual bool        isBinderAlive() const;
-    virtual status_t    pingBinder();
-    virtual status_t    dump(int fd, const Vector<String16>& args);
-
     virtual status_t    transact(   uint32_t code,
                                     const Parcel& data,
                                     Parcel* reply,
diff --git a/include/hwbinder/IBinder.h b/include/hwbinder/IBinder.h
index 28a2b52..3f4c1f6 100644
--- a/include/hwbinder/IBinder.h
+++ b/include/hwbinder/IBinder.h
@@ -62,36 +62,12 @@
         HIDL_DESCRIPTOR_CHAIN_TRANSACTION = FIRST_HIDL_TRANSACTION,
         LAST_HIDL_TRANSACTION   = 0x00ffffff,
 
-        /////////////////// other reserved transactions
-        PING_TRANSACTION        = B_PACK_CHARS('_','P','N','G'),
-        DUMP_TRANSACTION        = B_PACK_CHARS('_','D','M','P'),
-        SHELL_COMMAND_TRANSACTION = B_PACK_CHARS('_','C','M','D'),
-        INTERFACE_TRANSACTION   = B_PACK_CHARS('_', 'N', 'T', 'F'),
-        SYSPROPS_TRANSACTION    = B_PACK_CHARS('_', 'S', 'P', 'R'),
-
         // Corresponds to TF_ONE_WAY -- an asynchronous call.
         FLAG_ONEWAY             = 0x00000001
     };
 
                           IBinder();
 
-    /**
-     * Check if this IBinder implements the interface named by
-     * @a descriptor.  If it does, the base pointer to it is returned,
-     * which you can safely static_cast<> to the concrete C++ interface.
-     */
-    virtual sp<IInterface>  queryLocalInterface(const String16& descriptor);
-
-    /**
-     * Return the canonical name of the interface provided by this IBinder
-     * object.
-     */
-    virtual const String16& getInterfaceDescriptor() const = 0;
-
-    virtual bool            isBinderAlive() const = 0;
-    virtual status_t        pingBinder() = 0;
-    virtual status_t        dump(int fd, const Vector<String16>& args) = 0;
-
     virtual status_t        transact(   uint32_t code,
                                         const Parcel& data,
                                         Parcel* reply,
diff --git a/include/hwbinder/Parcel.h b/include/hwbinder/Parcel.h
index e0127dd..2a3874f 100644
--- a/include/hwbinder/Parcel.h
+++ b/include/hwbinder/Parcel.h
@@ -25,7 +25,6 @@
 #include <utils/Errors.h>
 #include <utils/RefBase.h>
 #include <utils/String16.h>
-#include <utils/Vector.h>
 
 #include <linux/android/binder.h>
 
@@ -33,7 +32,6 @@
 
 // ---------------------------------------------------------------------------
 namespace android {
-class String8;
 namespace hardware {
 
 class IBinder;
@@ -44,8 +42,6 @@
 class Parcel {
     friend class IPCThreadState;
 public:
-    class ReadableBlob;
-    class WritableBlob;
 
                         Parcel();
                         ~Parcel();
@@ -62,27 +58,12 @@
 
     status_t            setData(const uint8_t* buffer, size_t len);
 
-    status_t            appendFrom(const Parcel *parcel,
-                                   size_t start, size_t len);
-
-    bool                allowFds() const;
-    bool                pushAllowFds(bool allowFds);
-    void                restoreAllowFds(bool lastValue);
-
-    bool                hasFileDescriptors() const;
-
     // Writes the RPC header.
     status_t            writeInterfaceToken(const char* interface);
 
     // Parses the RPC header, returning true if the interface name
     // in the header matches the expected interface from the caller.
-    //
-    // Additionally, enforceInterface does part of the work of
-    // propagating the StrictMode policy mask, populating the current
-    // IPCThreadState, which as an optimization may optionally be
-    // passed in.
-    bool                enforceInterface(const char* interface,
-                                         IPCThreadState* threadState = NULL) const;
+    bool                enforceInterface(const char* interface) const;
     bool                checkInterface(IBinder*) const;
 
     void                freeData();
@@ -110,88 +91,12 @@
     status_t            writeFloat(float val);
     status_t            writeDouble(double val);
     status_t            writeCString(const char* str);
-    status_t            writeString8(const String8& str);
     status_t            writeString16(const String16& str);
     status_t            writeString16(const std::unique_ptr<String16>& str);
     status_t            writeString16(const char16_t* str, size_t len);
     status_t            writeStrongBinder(const sp<IBinder>& val);
     status_t            writeWeakBinder(const wp<IBinder>& val);
-    status_t            writeInt32Array(size_t len, const int32_t *val);
-    status_t            writeByteArray(size_t len, const uint8_t *val);
     status_t            writeBool(bool val);
-    status_t            writeChar(char16_t val);
-    status_t            writeByte(int8_t val);
-
-    // Take a UTF8 encoded string, convert to UTF16, write it to the parcel.
-    status_t            writeUtf8AsUtf16(const std::string& str);
-    status_t            writeUtf8AsUtf16(const std::unique_ptr<std::string>& str);
-
-    status_t            writeByteVector(const std::unique_ptr<std::vector<int8_t>>& val);
-    status_t            writeByteVector(const std::vector<int8_t>& val);
-    status_t            writeByteVector(const std::unique_ptr<std::vector<uint8_t>>& val);
-    status_t            writeByteVector(const std::vector<uint8_t>& val);
-    status_t            writeInt32Vector(const std::unique_ptr<std::vector<int32_t>>& val);
-    status_t            writeInt32Vector(const std::vector<int32_t>& val);
-    status_t            writeInt64Vector(const std::unique_ptr<std::vector<int64_t>>& val);
-    status_t            writeInt64Vector(const std::vector<int64_t>& val);
-    status_t            writeFloatVector(const std::unique_ptr<std::vector<float>>& val);
-    status_t            writeFloatVector(const std::vector<float>& val);
-    status_t            writeDoubleVector(const std::unique_ptr<std::vector<double>>& val);
-    status_t            writeDoubleVector(const std::vector<double>& val);
-    status_t            writeBoolVector(const std::unique_ptr<std::vector<bool>>& val);
-    status_t            writeBoolVector(const std::vector<bool>& val);
-    status_t            writeCharVector(const std::unique_ptr<std::vector<char16_t>>& val);
-    status_t            writeCharVector(const std::vector<char16_t>& val);
-    status_t            writeString16Vector(
-                            const std::unique_ptr<std::vector<std::unique_ptr<String16>>>& val);
-    status_t            writeString16Vector(const std::vector<String16>& val);
-    status_t            writeUtf8VectorAsUtf16Vector(
-                            const std::unique_ptr<std::vector<std::unique_ptr<std::string>>>& val);
-    status_t            writeUtf8VectorAsUtf16Vector(const std::vector<std::string>& val);
-
-    status_t            writeStrongBinderVector(const std::unique_ptr<std::vector<sp<IBinder>>>& val);
-    status_t            writeStrongBinderVector(const std::vector<sp<IBinder>>& val);
-
-    // Place a native_handle into the parcel (the native_handle's file-
-    // descriptors are dup'ed, so it is safe to delete the native_handle
-    // when this function returns).
-    // Doesn't take ownership of the native_handle.
-    status_t            writeNativeHandle(const native_handle* handle);
-
-    // Place a file descriptor into the parcel.  The given fd must remain
-    // valid for the lifetime of the parcel.
-    // The Parcel does not take ownership of the given fd unless you ask it to.
-    status_t            writeFileDescriptor(int fd, bool takeOwnership = false);
-
-    // Place a file descriptor into the parcel.  A dup of the fd is made, which
-    // will be closed once the parcel is destroyed.
-    status_t            writeDupFileDescriptor(int fd);
-
-    // Place a file descriptor into the parcel.  This will not affect the
-    // semantics of the smart file descriptor. A new descriptor will be
-    // created, and will be closed when the parcel is destroyed.
-    status_t            writeUniqueFileDescriptor(
-                            const base::unique_fd& fd);
-
-    // Place a vector of file desciptors into the parcel. Each descriptor is
-    // dup'd as in writeDupFileDescriptor
-    status_t            writeUniqueFileDescriptorVector(
-                            const std::unique_ptr<std::vector<base::unique_fd>>& val);
-    status_t            writeUniqueFileDescriptorVector(
-                            const std::vector<base::unique_fd>& val);
-
-    // Writes a blob to the parcel.
-    // If the blob is small, then it is stored in-place, otherwise it is
-    // transferred by way of an anonymous shared memory region.  Prefer sending
-    // immutable blobs if possible since they may be subsequently transferred between
-    // processes without further copying whereas mutable blobs always need to be copied.
-    // The caller should call release() on the blob after writing its contents.
-    status_t            writeBlob(size_t len, bool mutableCopy, WritableBlob* outBlob);
-
-    // Write an existing immutable blob file descriptor to the parcel.
-    // This allows the client to send the same blob to multiple processes
-    // as long as it keeps a dup of the blob file descriptor handy for later.
-    status_t            writeDupImmutableBlobFileDescriptor(int fd);
 
     template<typename T>
     status_t            writeObject(const T& val);
@@ -234,21 +139,10 @@
     status_t            readFloat(float *pArg) const;
     double              readDouble() const;
     status_t            readDouble(double *pArg) const;
-    intptr_t            readIntPtr() const;
-    status_t            readIntPtr(intptr_t *pArg) const;
+
     bool                readBool() const;
     status_t            readBool(bool *pArg) const;
-    char16_t            readChar() const;
-    status_t            readChar(char16_t *pArg) const;
-    int8_t              readByte() const;
-    status_t            readByte(int8_t *pArg) const;
-
-    // Read a UTF16 encoded string, convert to UTF8
-    status_t            readUtf8FromUtf16(std::string* str) const;
-    status_t            readUtf8FromUtf16(std::unique_ptr<std::string>* str) const;
-
     const char*         readCString() const;
-    String8             readString8() const;
     String16            readString16() const;
     status_t            readString16(String16* pArg) const;
     status_t            readString16(std::unique_ptr<String16>* pArg) const;
@@ -258,58 +152,6 @@
     status_t            readNullableStrongBinder(sp<IBinder>* val) const;
     wp<IBinder>         readWeakBinder() const;
 
-    status_t            readStrongBinderVector(std::unique_ptr<std::vector<sp<IBinder>>>* val) const;
-    status_t            readStrongBinderVector(std::vector<sp<IBinder>>* val) const;
-
-    status_t            readByteVector(std::unique_ptr<std::vector<int8_t>>* val) const;
-    status_t            readByteVector(std::vector<int8_t>* val) const;
-    status_t            readByteVector(std::unique_ptr<std::vector<uint8_t>>* val) const;
-    status_t            readByteVector(std::vector<uint8_t>* val) const;
-    status_t            readInt32Vector(std::unique_ptr<std::vector<int32_t>>* val) const;
-    status_t            readInt32Vector(std::vector<int32_t>* val) const;
-    status_t            readInt64Vector(std::unique_ptr<std::vector<int64_t>>* val) const;
-    status_t            readInt64Vector(std::vector<int64_t>* val) const;
-    status_t            readFloatVector(std::unique_ptr<std::vector<float>>* val) const;
-    status_t            readFloatVector(std::vector<float>* val) const;
-    status_t            readDoubleVector(std::unique_ptr<std::vector<double>>* val) const;
-    status_t            readDoubleVector(std::vector<double>* val) const;
-    status_t            readBoolVector(std::unique_ptr<std::vector<bool>>* val) const;
-    status_t            readBoolVector(std::vector<bool>* val) const;
-    status_t            readCharVector(std::unique_ptr<std::vector<char16_t>>* val) const;
-    status_t            readCharVector(std::vector<char16_t>* val) const;
-    status_t            readString16Vector(
-                            std::unique_ptr<std::vector<std::unique_ptr<String16>>>* val) const;
-    status_t            readString16Vector(std::vector<String16>* val) const;
-    status_t            readUtf8VectorFromUtf16Vector(
-                            std::unique_ptr<std::vector<std::unique_ptr<std::string>>>* val) const;
-    status_t            readUtf8VectorFromUtf16Vector(std::vector<std::string>* val) const;
-
-    // Retrieve native_handle from the parcel. This returns a copy of the
-    // parcel's native_handle (the caller takes ownership). The caller
-    // must free the native_handle with native_handle_close() and
-    // native_handle_delete().
-    native_handle*     readNativeHandle() const;
-
-
-    // Retrieve a file descriptor from the parcel.  This returns the raw fd
-    // in the parcel, which you do not own -- use dup() to get your own copy.
-    int                 readFileDescriptor() const;
-
-    // Retrieve a smart file descriptor from the parcel.
-    status_t            readUniqueFileDescriptor(
-                            base::unique_fd* val) const;
-
-
-    // Retrieve a vector of smart file descriptors from the parcel.
-    status_t            readUniqueFileDescriptorVector(
-                            std::unique_ptr<std::vector<base::unique_fd>>* val) const;
-    status_t            readUniqueFileDescriptorVector(
-                            std::vector<base::unique_fd>* val) const;
-
-    // Reads a blob from the parcel.
-    // The caller should call release() on the blob after reading its contents.
-    status_t            readBlob(size_t len, ReadableBlob* outBlob) const;
-
     template<typename T>
     const T*            readObject() const;
 
@@ -429,31 +271,6 @@
     template<class T>
     status_t            writeAligned(T val);
 
-    template<typename T, typename U>
-    status_t            unsafeReadTypedVector(std::vector<T>* val,
-                                              status_t(Parcel::*read_func)(U*) const) const;
-    template<typename T>
-    status_t            readNullableTypedVector(std::unique_ptr<std::vector<T>>* val,
-                                                status_t(Parcel::*read_func)(T*) const) const;
-    template<typename T>
-    status_t            readTypedVector(std::vector<T>* val,
-                                        status_t(Parcel::*read_func)(T*) const) const;
-    template<typename T, typename U>
-    status_t            unsafeWriteTypedVector(const std::vector<T>& val,
-                                               status_t(Parcel::*write_func)(U));
-    template<typename T>
-    status_t            writeNullableTypedVector(const std::unique_ptr<std::vector<T>>& val,
-                                                 status_t(Parcel::*write_func)(const T&));
-    template<typename T>
-    status_t            writeNullableTypedVector(const std::unique_ptr<std::vector<T>>& val,
-                                                 status_t(Parcel::*write_func)(T));
-    template<typename T>
-    status_t            writeTypedVector(const std::vector<T>& val,
-                                         status_t(Parcel::*write_func)(const T&));
-    template<typename T>
-    status_t            writeTypedVector(const std::vector<T>& val,
-                                         status_t(Parcel::*write_func)(T));
-
     status_t            mError;
     uint8_t*            mData;
     size_t              mDataSize;
@@ -471,166 +288,7 @@
 
     release_func        mOwner;
     void*               mOwnerCookie;
-
-    class Blob {
-    public:
-        Blob();
-        ~Blob();
-
-        void clear();
-        void release();
-        inline size_t size() const { return mSize; }
-        inline int fd() const { return mFd; }
-        inline bool isMutable() const { return mMutable; }
-
-    protected:
-        void init(int fd, void* data, size_t size, bool isMutable);
-
-        int mFd; // owned by parcel so not closed when released
-        void* mData;
-        size_t mSize;
-        bool mMutable;
-    };
-
-public:
-    class ReadableBlob : public Blob {
-        friend class Parcel;
-    public:
-        inline const void* data() const { return mData; }
-        inline void* mutableData() { return isMutable() ? mData : NULL; }
-    };
-
-    class WritableBlob : public Blob {
-        friend class Parcel;
-    public:
-        inline void* data() { return mData; }
-    };
-
-private:
-    size_t mOpenAshmemSize;
-
-public:
-    // TODO: Remove once ABI can be changed.
-    size_t getBlobAshmemSize() const;
-    size_t getOpenAshmemSize() const;
 };
-
-// ---------------------------------------------------------------------------
-
-template<typename T, typename U>
-status_t Parcel::unsafeReadTypedVector(
-        std::vector<T>* val,
-        status_t(Parcel::*read_func)(U*) const) const {
-    int32_t size;
-    status_t status = this->readInt32(&size);
-
-    if (status != OK) {
-        return status;
-    }
-
-    if (size < 0) {
-        return UNEXPECTED_NULL;
-    }
-
-    val->resize(size);
-
-    for (auto& v: *val) {
-        status = (this->*read_func)(&v);
-
-        if (status != OK) {
-            return status;
-        }
-    }
-
-    return OK;
-}
-
-template<typename T>
-status_t Parcel::readTypedVector(std::vector<T>* val,
-                                 status_t(Parcel::*read_func)(T*) const) const {
-    return unsafeReadTypedVector(val, read_func);
-}
-
-template<typename T>
-status_t Parcel::readNullableTypedVector(std::unique_ptr<std::vector<T>>* val,
-                                         status_t(Parcel::*read_func)(T*) const) const {
-    const size_t start = dataPosition();
-    int32_t size;
-    status_t status = readInt32(&size);
-    val->reset();
-
-    if (status != OK || size < 0) {
-        return status;
-    }
-
-    setDataPosition(start);
-    val->reset(new std::vector<T>());
-
-    status = unsafeReadTypedVector(val->get(), read_func);
-
-    if (status != OK) {
-        val->reset();
-    }
-
-    return status;
-}
-
-template<typename T, typename U>
-status_t Parcel::unsafeWriteTypedVector(const std::vector<T>& val,
-                                        status_t(Parcel::*write_func)(U)) {
-    if (val.size() > std::numeric_limits<int32_t>::max()) {
-        return BAD_VALUE;
-    }
-
-    status_t status = this->writeInt32(val.size());
-
-    if (status != OK) {
-        return status;
-    }
-
-    for (const auto& item : val) {
-        status = (this->*write_func)(item);
-
-        if (status != OK) {
-            return status;
-        }
-    }
-
-    return OK;
-}
-
-template<typename T>
-status_t Parcel::writeTypedVector(const std::vector<T>& val,
-                                  status_t(Parcel::*write_func)(const T&)) {
-    return unsafeWriteTypedVector(val, write_func);
-}
-
-template<typename T>
-status_t Parcel::writeTypedVector(const std::vector<T>& val,
-                                  status_t(Parcel::*write_func)(T)) {
-    return unsafeWriteTypedVector(val, write_func);
-}
-
-template<typename T>
-status_t Parcel::writeNullableTypedVector(const std::unique_ptr<std::vector<T>>& val,
-                                          status_t(Parcel::*write_func)(const T&)) {
-    if (val.get() == nullptr) {
-        return this->writeInt32(-1);
-    }
-
-    return unsafeWriteTypedVector(*val, write_func);
-}
-
-template<typename T>
-status_t Parcel::writeNullableTypedVector(const std::unique_ptr<std::vector<T>>& val,
-                                          status_t(Parcel::*write_func)(T)) {
-    if (val.get() == nullptr) {
-        return this->writeInt32(-1);
-    }
-
-    return unsafeWriteTypedVector(*val, write_func);
-}
-
 // ---------------------------------------------------------------------------
 
 inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel)