status_t IBinder::shellCommand(const sp<IBinder>& target, int in, int out, int err, Vector<String16>& args, const sp<IResultReceiver>& resultReceiver) { Parcel send; Parcel reply; send.writeFileDescriptor(in); send.writeFileDescriptor(out); send.writeFileDescriptor(err); const size_t numArgs = args.size(); send.writeInt32(numArgs); for (size_t i = 0; i < numArgs; i++) { send.writeString16(args[i]); } send.writeStrongBinder(resultReceiver != NULL ? IInterface::asBinder(resultReceiver) : NULL); return target->transact(SHELL_COMMAND_TRANSACTION, send, &reply); }
status_t BpBinder::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; }
void WriteMemoryToParcel(Parcel &parcel, allocator_memory_t *memory) { int32_t p, n; parcel.writeInt32(memory->memtype); parcel.writeInt32(memory->nptrs); parcel.writeInt32(memory->ndims); for (p = 0; p < memory->nptrs; p++) { for(n = 0; n < memory->ndims; n++) { parcel.writeInt32(memory->dims[p].dims[n]); } } for (p = 0; p < memory->nptrs; p++) { for(n = 0; n < memory->ndims; n++) { parcel.writeInt32(memory->strides[p].dims[n]); } } for (p = 0; p < memory->nptrs; p++) { if (memory->memtype == ALLOCATOR_MEMORY_TYPE_TILED_1D_CACHED || memory->memtype == ALLOCATOR_MEMORY_TYPE_TILED_1D_UNCACHED) parcel.writeFileDescriptor(memory->fds[p]); else if (memory->memtype == ALLOCATOR_MEMORY_TYPE_VIRTUAL_SHARED) parcel.writeInt32(memory->fds[p]); } }