本文整理汇总了C++中Parcel::writeString16方法的典型用法代码示例。如果您正苦于以下问题:C++ Parcel::writeString16方法的具体用法?C++ Parcel::writeString16怎么用?C++ Parcel::writeString16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Parcel
的用法示例。
在下文中一共展示了Parcel::writeString16方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeStringToParcel
static void writeStringToParcel(Parcel& parcel, const char* str)
{
if (str) {
parcel.writeString16(String16(str));
} else {
parcel.writeString16(NULL, 0);
}
}
示例2: android_os_Parcel_writeString
static void android_os_Parcel_writeString(JNIEnv* env, jclass clazz, jint nativePtr, jstring val)
{
Parcel* parcel = reinterpret_cast<Parcel*>(nativePtr);
if (parcel != NULL) {
status_t err = NO_MEMORY;
if (val) {
const jchar* str = env->GetStringCritical(val, 0);
if (str) {
err = parcel->writeString16((uint16_t*)str, env->GetStringLength(val));
env->ReleaseStringCritical(val, str);
}
} else {
err = parcel->writeString16(NULL, 0);
}
if (err != NO_ERROR) {
signalExceptionForError(env, clazz, err);
}
}
}
示例3: dump
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;
}
示例4: shellCommand
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);
}
示例5: receiveSolicited
void PhoneMachine::receiveSolicited(const Parcel& data)
{
int serial = data.readInt32();
int result = data.readInt32();
RILRequest *request = getPending(serial);
if (!request) {
SLOGW("receiveSolicited: not requested serial=%d result=%d\n", serial, result);
return;
}
SLOGV("<<< Solicited message=%s [%d] serial=%d result=%d\n", rilMessageStr(request->message()),
request->message(), serial, result);
int token = request->token();
int message = request->message();
int ivalue = 0;
Parcel extra;
switch (message) {
case RIL_REQUEST_GET_SIM_STATUS:
ivalue = data.readInt32(); // Store the card state
break;
case RIL_REQUEST_GET_CURRENT_CALLS: {
// We retrieve audio information for the client.
// We also update the AudioFlinger audio state appropriately based
// on the current call state
ivalue = data.readInt32(); // How many calls there are
audio_mode_t audio_mode = AUDIO_MODE_NORMAL;
for (int i = 0 ; i < ivalue ; i++) {
RILCall call(data);
CallState call_state(call.state, call.index,
call.number, call.numberPresentation,
call.name, call.namePresentation);
call_state.writeToParcel(&extra);
if (call.state == RIL_CALL_INCOMING)
audio_mode = AUDIO_MODE_RINGTONE;
else if (call.state == RIL_CALL_ACTIVE || call.state == RIL_CALL_DIALING || call.state == RIL_CALL_ALERTING)
audio_mode = AUDIO_MODE_IN_CALL;
}
SLOGV(" %d calls, audio_mode=%d\n", ivalue, audio_mode);
updateAudioMode(audio_mode);
break;
}
case RIL_REQUEST_DIAL:
case RIL_REQUEST_HANGUP:
case RIL_REQUEST_ANSWER:
case RIL_REQUEST_UDUB:
case RIL_REQUEST_SET_MUTE:
break;
case RIL_REQUEST_GET_MUTE:
ivalue = data.readInt32();
break;
case RIL_REQUEST_SIGNAL_STRENGTH:
// In actuality, we should probably read all 12 signal strengths
ivalue = data.readInt32();
break;
#if defined(SHORT_PLATFORM_VERSION) && (SHORT_PLATFORM_VERSION == 23)
#else
case RIL_REQUEST_VOICE_REGISTRATION_STATE:
ivalue = data.readInt32(); // Starts with the number of strings
for (int i = 0 ; i < ivalue ; i++)
extra.writeString16(data.readString16());
break;
#endif
case RIL_REQUEST_OPERATOR: {
ivalue = data.readInt32();
assert(ivalue == 3);
extra.writeString16(data.readString16());
extra.writeString16(data.readString16());
extra.writeString16(data.readString16());
break;
}
case RIL_REQUEST_RADIO_POWER:
SLOGV(" RIL Radio Power\n");
// No response....
break;
default:
SLOGV("Unhandled RIL request %d\n", message);
break;
}
if (request->client() != NULL) {
SLOGV(" Passing solicited message to client token=%d message=%d result=%d ivalue=%d...\n",
token, message, result, ivalue);
request->client()->Response( token, message, result, ivalue, extra );
}
delete request;
}