本文整理汇总了C++中Parcel::readBool方法的典型用法代码示例。如果您正苦于以下问题:C++ Parcel::readBool方法的具体用法?C++ Parcel::readBool怎么用?C++ Parcel::readBool使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parcel
的用法示例。
在下文中一共展示了Parcel::readBool方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onTransact
status_t BnMediaAnalyticsService::onTransact(
uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags)
{
// get calling pid/tid
IPCThreadState *ipc = IPCThreadState::self();
int clientPid = ipc->getCallingPid();
// permission checking
if(DEBUGGING_FLOW) {
ALOGD("running in service, code %d, pid %d; called from pid %d",
code, getpid(), clientPid);
}
switch (code) {
case GENERATE_UNIQUE_SESSIONID: {
CHECK_INTERFACE(IMediaAnalyticsService, data, reply);
MediaAnalyticsItem::SessionID_t sessionid = generateUniqueSessionID();
reply->writeInt64(sessionid);
return NO_ERROR;
} break;
case SUBMIT_ITEM: {
CHECK_INTERFACE(IMediaAnalyticsService, data, reply);
bool forcenew;
MediaAnalyticsItem *item = new MediaAnalyticsItem;
data.readBool(&forcenew);
item->readFromParcel(data);
item->setPid(clientPid);
// submit() takes over ownership of 'item'
MediaAnalyticsItem::SessionID_t sessionid = submit(item, forcenew);
reply->writeInt64(sessionid);
return NO_ERROR;
} break;
default:
return BBinder::onTransact(code, data, reply, flags);
}
}
示例2: onTransact
//.........这里部分代码省略.........
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
uint32_t width = data.readUint32();
uint32_t height = data.readUint32();
status_t result = setDefaultBufferSize(width, height);
reply->writeInt32(result);
return NO_ERROR;
}
case SET_MAX_BUFFER_COUNT: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
int bufferCount = data.readInt32();
status_t result = setMaxBufferCount(bufferCount);
reply->writeInt32(result);
return NO_ERROR;
}
case SET_MAX_ACQUIRED_BUFFER_COUNT: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
int maxAcquiredBuffers = data.readInt32();
status_t result = setMaxAcquiredBufferCount(maxAcquiredBuffers);
reply->writeInt32(result);
return NO_ERROR;
}
case SET_CONSUMER_NAME: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
setConsumerName( data.readString8() );
return NO_ERROR;
}
case SET_DEFAULT_BUFFER_FORMAT: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
PixelFormat defaultFormat = static_cast<PixelFormat>(data.readInt32());
status_t result = setDefaultBufferFormat(defaultFormat);
reply->writeInt32(result);
return NO_ERROR;
}
case SET_DEFAULT_BUFFER_DATA_SPACE: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
android_dataspace defaultDataSpace =
static_cast<android_dataspace>(data.readInt32());
status_t result = setDefaultBufferDataSpace(defaultDataSpace);
reply->writeInt32(result);
return NO_ERROR;
}
case SET_CONSUMER_USAGE_BITS: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
uint32_t usage = data.readUint32();
status_t result = setConsumerUsageBits(usage);
reply->writeInt32(result);
return NO_ERROR;
}
case SET_TRANSFORM_HINT: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
uint32_t hint = data.readUint32();
status_t result = setTransformHint(hint);
reply->writeInt32(result);
return NO_ERROR;
}
case GET_SIDEBAND_STREAM: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
sp<NativeHandle> stream = getSidebandStream();
reply->writeInt32(static_cast<int32_t>(stream != NULL));
if (stream != NULL) {
reply->writeNativeHandle(stream->handle());
}
return NO_ERROR;
}
case GET_OCCUPANCY_HISTORY: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
bool forceFlush = false;
status_t error = data.readBool(&forceFlush);
if (error != NO_ERROR) {
return error;
}
std::vector<OccupancyTracker::Segment> history;
status_t result = getOccupancyHistory(forceFlush, &history);
error = reply->writeParcelableVector(history);
if (error != NO_ERROR) {
return error;
}
error = reply->writeInt32(result);
if (error != NO_ERROR) {
return error;
}
return NO_ERROR;
}
case DISCARD_FREE_BUFFERS: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
status_t result = discardFreeBuffers();
status_t error = reply->writeInt32(result);
return error;
}
case DUMP: {
CHECK_INTERFACE(IGraphicBufferConsumer, data, reply);
String8 result = data.readString8();
String8 prefix = data.readString8();
static_cast<IGraphicBufferConsumer*>(this)->dumpState(result, prefix);
reply->writeString8(result);
return NO_ERROR;
}
}
return BBinder::onTransact(code, data, reply, flags);
}