char * unpackRILResponseFull(char *inRsp, size_t length, int32_t *out_ril_errno, int32_t *out_token) { Parcel p; int32_t type; int32_t token; status_t status; RIL_Errno e; p.setData((uint8_t *) inRsp, length); // status checked at end status = p.readInt32(&type); if (type == RESPONSE_UNSOLICITED) { status = p.readInt32(&token); LOGD("unpackRILResponse: Discard UNSOLICITED response:%d\n",token); return NULL; } status = p.readInt32(&token); if (out_token != NULL) { *out_token = token; } status = p.readInt32((int32_t *)&e); if ((NO_ERROR != status)) { LOGE("unpackRILResponse: Error!"); return NULL; } if (out_ril_errno != NULL) { *out_ril_errno = e; LOGD("unpackRILResponse: Return error cause: %d", e); } if (RIL_E_SUCCESS != e) { return NULL; } return unpackStrings(p); }
void JNIDrmListener::notify(DrmPlugin::EventType eventType, int extra, const Parcel *obj) { jint jeventType; // translate DrmPlugin event types into their java equivalents switch(eventType) { case DrmPlugin::kDrmPluginEventProvisionRequired: jeventType = gEventTypes.kEventProvisionRequired; break; case DrmPlugin::kDrmPluginEventKeyNeeded: jeventType = gEventTypes.kEventKeyRequired; break; case DrmPlugin::kDrmPluginEventKeyExpired: jeventType = gEventTypes.kEventKeyExpired; break; case DrmPlugin::kDrmPluginEventVendorDefined: jeventType = gEventTypes.kEventVendorDefined; break; default: ALOGE("Invalid event DrmPlugin::EventType %d, ignored", (int)eventType); return; } JNIEnv *env = AndroidRuntime::getJNIEnv(); if (obj && obj->dataSize() > 0) { jobject jParcel = createJavaParcelObject(env); if (jParcel != NULL) { Parcel* nativeParcel = parcelForJavaObject(env, jParcel); nativeParcel->setData(obj->data(), obj->dataSize()); env->CallStaticVoidMethod(mClass, gFields.post_event, mObject, jeventType, extra, jParcel); env->DeleteLocalRef(jParcel); } } if (env->ExceptionCheck()) { ALOGW("An exception occurred while notifying an event."); LOGW_EX(env); env->ExceptionClear(); } }
void JNIMediaPlayerListener::notify(int msg, int ext1, int ext2, const Parcel *obj) { JNIEnv *env = AndroidRuntime::getJNIEnv(); if (obj && obj->dataSize() > 0) { jobject jParcel = createJavaParcelObject(env); if (jParcel != NULL) { Parcel* nativeParcel = parcelForJavaObject(env, jParcel); nativeParcel->setData(obj->data(), obj->dataSize()); env->CallStaticVoidMethod(mClass, fields.post_event, mObject, msg, ext1, ext2, jParcel); } } else { env->CallStaticVoidMethod(mClass, fields.post_event, mObject, msg, ext1, ext2, NULL); } if (env->ExceptionCheck()) { ALOGW("An exception occurred while notifying an event."); LOGW_EX(env); env->ExceptionClear(); } }
static int processRxBuffer(RilClientPrv *prv, void *buffer, size_t buflen) { Parcel p; int32_t response_type; status_t status; int ret = RIL_CLIENT_ERR_SUCCESS; acquire_wake_lock(PARTIAL_WAKE_LOCK, RIL_CLIENT_WAKE_LOCK); p.setData((uint8_t *)buffer, buflen); status = p.readInt32(&response_type); if (DBG) ALOGD("%s: status %d response_type %d", __FUNCTION__, status, response_type); if (status != NO_ERROR) { ret = RIL_CLIENT_ERR_IO; goto EXIT; } // FOr unsolicited response. if (response_type == RESPONSE_UNSOLICITED) { ret = processUnsolicited(prv, p); } // For solicited response. else if (response_type == RESPONSE_SOLICITED) { ret = processSolicited(prv, p); if (ret != RIL_CLIENT_ERR_SUCCESS && prv->err_cb) { prv->err_cb(prv->err_cb_data, ret); } } else { ret = RIL_CLIENT_ERR_INVAL; } EXIT: release_wake_lock(RIL_CLIENT_WAKE_LOCK); return ret; }