Lines Matching defs:env

68 MotionEvent* android_view_MotionEvent_getNativePtr(JNIEnv* env, jobject eventObj) {
73 env->GetLongField(eventObj, gMotionEventClassInfo.mNativePtr));
76 static void android_view_MotionEvent_setNativePtr(JNIEnv* env, jobject eventObj,
78 env->SetLongField(eventObj, gMotionEventClassInfo.mNativePtr,
82 jobject android_view_MotionEvent_obtainAsCopy(JNIEnv* env, const MotionEvent* event) {
83 jobject eventObj = env->CallStaticObjectMethod(gMotionEventClassInfo.clazz,
85 if (env->ExceptionCheck() || !eventObj) {
87 LOGE_EX(env);
88 env->ExceptionClear();
92 MotionEvent* destEvent = android_view_MotionEvent_getNativePtr(env, eventObj);
95 android_view_MotionEvent_setNativePtr(env, eventObj, destEvent);
102 status_t android_view_MotionEvent_recycle(JNIEnv* env, jobject eventObj) {
103 env->CallVoidMethod(eventObj, gMotionEventClassInfo.recycle);
104 if (env->ExceptionCheck()) {
106 LOGW_EX(env);
107 env->ExceptionClear();
117 static bool validatePointerCount(JNIEnv* env, jint pointerCount) {
119 jniThrowException(env, "java/lang/IllegalArgumentException",
126 static bool validatePointerPropertiesArray(JNIEnv* env, jobjectArray pointerPropertiesObjArray,
129 jniThrowException(env, "java/lang/IllegalArgumentException",
133 size_t length = size_t(env->GetArrayLength(pointerPropertiesObjArray));
135 jniThrowException(env, "java/lang/IllegalArgumentException",
142 static bool validatePointerCoordsObjArray(JNIEnv* env, jobjectArray pointerCoordsObjArray,
145 jniThrowException(env, "java/lang/IllegalArgumentException",
149 size_t length = size_t(env->GetArrayLength(pointerCoordsObjArray));
151 jniThrowException(env, "java/lang/IllegalArgumentException",
158 static bool validatePointerIndex(JNIEnv* env, jint pointerIndex, size_t pointerCount) {
160 jniThrowException(env, "java/lang/IllegalArgumentException",
167 static bool validateHistoryPos(JNIEnv* env, jint historyPos, size_t historySize) {
169 jniThrowException(env, "java/lang/IllegalArgumentException",
176 static bool validatePointerCoords(JNIEnv* env, jobject pointerCoordsObj) {
178 jniThrowException(env, "java/lang/IllegalArgumentException",
185 static bool validatePointerProperties(JNIEnv* env, jobject pointerPropertiesObj) {
187 jniThrowException(env, "java/lang/IllegalArgumentException",
194 static void pointerCoordsToNative(JNIEnv* env, jobject pointerCoordsObj,
198 env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.x) - xOffset);
200 env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.y) - yOffset);
202 env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.pressure));
204 env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.size));
206 env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.touchMajor));
208 env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.touchMinor));
210 env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.toolMajor));
212 env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.toolMinor));
214 env->GetFloatField(pointerCoordsObj, gPointerCoordsClassInfo.orientation));
217 BitSet64(env->GetLongField(pointerCoordsObj, gPointerCoordsClassInfo.mPackedAxisBits));
219 jfloatArray valuesArray = jfloatArray(env->GetObjectField(pointerCoordsObj,
223 env->GetPrimitiveArrayCritical(valuesArray, NULL));
231 env->ReleasePrimitiveArrayCritical(valuesArray, values, JNI_ABORT);
232 env->DeleteLocalRef(valuesArray);
237 static jfloatArray obtainPackedAxisValuesArray(JNIEnv* env, uint32_t minSize,
239 jfloatArray outValuesArray = jfloatArray(env->GetObjectField(outPointerCoordsObj,
242 uint32_t size = env->GetArrayLength(outValuesArray);
246 env->DeleteLocalRef(outValuesArray);
252 outValuesArray = env->NewFloatArray(size);
253 env->SetObjectField(outPointerCoordsObj,
258 static void pointerCoordsFromNative(JNIEnv* env, const PointerCoords* rawPointerCoords,
260 env->SetFloatField(outPointerCoordsObj, gPointerCoordsClassInfo.x,
262 env->SetFloatField(outPointerCoordsObj, gPointerCoordsClassInfo.y,
264 env->SetFloatField(outPointerCoordsObj, gPointerCoordsClassInfo.pressure,
266 env->SetFloatField(outPointerCoordsObj, gPointerCoordsClassInfo.size,
268 env->SetFloatField(outPointerCoordsObj, gPointerCoordsClassInfo.touchMajor,
270 env->SetFloatField(outPointerCoordsObj, gPointerCoordsClassInfo.touchMinor,
272 env->SetFloatField(outPointerCoordsObj, gPointerCoordsClassInfo.toolMajor,
274 env->SetFloatField(outPointerCoordsObj, gPointerCoordsClassInfo.toolMinor,
276 env->SetFloatField(outPointerCoordsObj, gPointerCoordsClassInfo.orientation,
292 jfloatArray outValuesArray = obtainPackedAxisValuesArray(env, packedAxesCount,
298 jfloat* outValues = static_cast<jfloat*>(env->GetPrimitiveArrayCritical(
308 env->ReleasePrimitiveArrayCritical(outValuesArray, outValues, 0);
309 env->DeleteLocalRef(outValuesArray);
311 env->SetLongField(outPointerCoordsObj, gPointerCoordsClassInfo.mPackedAxisBits, outBits);
314 static void pointerPropertiesToNative(JNIEnv* env, jobject pointerPropertiesObj,
317 outPointerProperties->id = env->GetIntField(pointerPropertiesObj,
319 outPointerProperties->toolType = env->GetIntField(pointerPropertiesObj,
323 static void pointerPropertiesFromNative(JNIEnv* env, const PointerProperties* pointerProperties,
325 env->SetIntField(outPointerPropertiesObj, gPointerPropertiesClassInfo.id,
327 env->SetIntField(outPointerPropertiesObj, gPointerPropertiesClassInfo.toolType,
334 static jlong android_view_MotionEvent_nativeInitialize(JNIEnv* env, jclass clazz,
342 if (!validatePointerCount(env, pointerCount)
343 || !validatePointerPropertiesArray(env, pointerPropertiesObjArray, pointerCount)
344 || !validatePointerCoordsObjArray(env, pointerCoordsObjArray, pointerCount)) {
357 jobject pointerPropertiesObj = env->GetObjectArrayElement(pointerPropertiesObjArray, i);
361 pointerPropertiesToNative(env, pointerPropertiesObj, &pointerProperties[i]);
362 env->DeleteLocalRef(pointerPropertiesObj);
364 jobject pointerCoordsObj = env->GetObjectArrayElement(pointerCoordsObjArray, i);
366 jniThrowNullPointerException(env, "pointerCoords");
369 pointerCoordsToNative(env, pointerCoordsObj, xOffset, yOffset, &rawPointerCoords[i]);
370 env->DeleteLocalRef(pointerCoordsObj);
386 static jlong android_view_MotionEvent_nativeCopy(JNIEnv* env, jclass clazz,
397 static void android_view_MotionEvent_nativeDispose(JNIEnv* env, jclass clazz,
403 static void android_view_MotionEvent_nativeAddBatch(JNIEnv* env, jclass clazz,
408 if (!validatePointerCoordsObjArray(env, pointerCoordsObjArray, pointerCount)) {
415 jobject pointerCoordsObj = env->GetObjectArrayElement(pointerCoordsObjArray, i);
417 jniThrowNullPointerException(env, "pointerCoords");
420 pointerCoordsToNative(env, pointerCoordsObj,
422 env->DeleteLocalRef(pointerCoordsObj);
429 static jint android_view_MotionEvent_nativeGetDeviceId(JNIEnv* env, jclass clazz,
435 static jint android_view_MotionEvent_nativeGetSource(JNIEnv* env, jclass clazz,
441 static void android_view_MotionEvent_nativeSetSource(JNIEnv* env, jclass clazz,
447 static jint android_view_MotionEvent_nativeGetAction(JNIEnv* env, jclass clazz,
453 static void android_view_MotionEvent_nativeSetAction(JNIEnv* env, jclass clazz,
459 static int android_view_MotionEvent_nativeGetActionButton(JNIEnv* env, jclass clazz,
465 static void android_view_MotionEvent_nativeSetActionButton(JNIEnv* env, jclass clazz,
471 static jboolean android_view_MotionEvent_nativeIsTouchEvent(JNIEnv* env, jclass clazz,
477 static jint android_view_MotionEvent_nativeGetFlags(JNIEnv* env, jclass clazz,
483 static void android_view_MotionEvent_nativeSetFlags(JNIEnv* env, jclass clazz,
489 static jint android_view_MotionEvent_nativeGetEdgeFlags(JNIEnv* env, jclass clazz,
495 static void android_view_MotionEvent_nativeSetEdgeFlags(JNIEnv* env, jclass clazz,
501 static jint android_view_MotionEvent_nativeGetMetaState(JNIEnv* env, jclass clazz,
507 static jint android_view_MotionEvent_nativeGetButtonState(JNIEnv* env, jclass clazz,
513 static void android_view_MotionEvent_nativeSetButtonState(JNIEnv* env, jclass clazz,
519 static void android_view_MotionEvent_nativeOffsetLocation(JNIEnv* env, jclass clazz,
525 static jfloat android_view_MotionEvent_nativeGetXOffset(JNIEnv* env, jclass clazz,
531 static jfloat android_view_MotionEvent_nativeGetYOffset(JNIEnv* env, jclass clazz,
537 static jfloat android_view_MotionEvent_nativeGetXPrecision(JNIEnv* env, jclass clazz,
543 static jfloat android_view_MotionEvent_nativeGetYPrecision(JNIEnv* env, jclass clazz,
549 static jlong android_view_MotionEvent_nativeGetDownTimeNanos(JNIEnv* env, jclass clazz,
555 static void android_view_MotionEvent_nativeSetDownTimeNanos(JNIEnv* env, jclass clazz,
561 static jint android_view_MotionEvent_nativeGetPointerCount(JNIEnv* env, jclass clazz,
567 static jint android_view_MotionEvent_nativeGetPointerId(JNIEnv* env, jclass clazz,
571 if (!validatePointerIndex(env, pointerIndex, pointerCount)) {
577 static jint android_view_MotionEvent_nativeGetToolType(JNIEnv* env, jclass clazz,
581 if (!validatePointerIndex(env, pointerIndex, pointerCount)) {
587 static jint android_view_MotionEvent_nativeFindPointerIndex(JNIEnv* env, jclass clazz,
593 static jint android_view_MotionEvent_nativeGetHistorySize(JNIEnv* env, jclass clazz,
599 static jlong android_view_MotionEvent_nativeGetEventTimeNanos(JNIEnv* env, jclass clazz,
606 if (!validateHistoryPos(env, historyPos, historySize)) {
613 static jfloat android_view_MotionEvent_nativeGetRawAxisValue(JNIEnv* env, jclass clazz,
617 if (!validatePointerIndex(env, pointerIndex, pointerCount)) {
625 if (!validateHistoryPos(env, historyPos, historySize)) {
632 static jfloat android_view_MotionEvent_nativeGetAxisValue(JNIEnv* env, jclass clazz,
636 if (!validatePointerIndex(env, pointerIndex, pointerCount)) {
644 if (!validateHistoryPos(env, historyPos, historySize)) {
651 static void android_view_MotionEvent_nativeGetPointerCoords(JNIEnv* env, jclass clazz,
655 if (!validatePointerIndex(env, pointerIndex, pointerCount)
656 || !validatePointerCoords(env, outPointerCoordsObj)) {
665 if (!validateHistoryPos(env, historyPos, historySize)) {
670 pointerCoordsFromNative(env, rawPointerCoords, event->getXOffset(), event->getYOffset(),
674 static void android_view_MotionEvent_nativeGetPointerProperties(JNIEnv* env, jclass clazz,
678 if (!validatePointerIndex(env, pointerIndex, pointerCount)
679 || !validatePointerProperties(env, outPointerPropertiesObj)) {
684 pointerPropertiesFromNative(env, pointerProperties, outPointerPropertiesObj);
687 static void android_view_MotionEvent_nativeScale(JNIEnv* env, jclass clazz,
693 static void android_view_MotionEvent_nativeTransform(JNIEnv* env, jclass clazz,
695 SkMatrix* matrix = android_graphics_Matrix_getSkMatrix(env, matrixObj);
711 static jlong android_view_MotionEvent_nativeReadFromParcel(JNIEnv* env, jclass clazz,
718 Parcel* parcel = parcelForJavaObject(env, parcelObj);
725 jniThrowRuntimeException(env, "Failed to read MotionEvent parcel.");
731 static void android_view_MotionEvent_nativeWriteToParcel(JNIEnv* env, jclass clazz,
734 Parcel* parcel = parcelForJavaObject(env, parcelObj);
738 jniThrowRuntimeException(env, "Failed to write MotionEvent parcel.");
742 static jstring android_view_MotionEvent_nativeAxisToString(JNIEnv* env, jclass clazz,
744 return env->NewStringUTF(MotionEvent::getLabel(static_cast<int32_t>(axis)));
747 static jint android_view_MotionEvent_nativeAxisFromString(JNIEnv* env, jclass clazz,
749 ScopedUtfChars axisLabel(env, label);
884 int register_android_view_MotionEvent(JNIEnv* env) {
885 int res = RegisterMethodsOrDie(env, "android/view/MotionEvent", gMotionEventMethods,
888 gMotionEventClassInfo.clazz = FindClassOrDie(env, "android/view/MotionEvent");
889 gMotionEventClassInfo.clazz = MakeGlobalRefOrDie(env, gMotionEventClassInfo.clazz);
891 gMotionEventClassInfo.obtain = GetStaticMethodIDOrDie(env, gMotionEventClassInfo.clazz,
893 gMotionEventClassInfo.recycle = GetMethodIDOrDie(env, gMotionEventClassInfo.clazz,
895 gMotionEventClassInfo.mNativePtr = GetFieldIDOrDie(env, gMotionEventClassInfo.clazz,
898 jclass clazz = FindClassOrDie(env, "android/view/MotionEvent$PointerCoords");
900 gPointerCoordsClassInfo.mPackedAxisBits = GetFieldIDOrDie(env, clazz, "mPackedAxisBits", "J");
901 gPointerCoordsClassInfo.mPackedAxisValues = GetFieldIDOrDie(env, clazz, "mPackedAxisValues",
903 gPointerCoordsClassInfo.x = GetFieldIDOrDie(env, clazz, "x", "F");
904 gPointerCoordsClassInfo.y = GetFieldIDOrDie(env, clazz, "y", "F");
905 gPointerCoordsClassInfo.pressure = GetFieldIDOrDie(env, clazz, "pressure", "F");
906 gPointerCoordsClassInfo.size = GetFieldIDOrDie(env, clazz, "size", "F");
907 gPointerCoordsClassInfo.touchMajor = GetFieldIDOrDie(env, clazz, "touchMajor", "F");
908 gPointerCoordsClassInfo.touchMinor = GetFieldIDOrDie(env, clazz, "touchMinor", "F");
909 gPointerCoordsClassInfo.toolMajor = GetFieldIDOrDie(env, clazz, "toolMajor", "F");
910 gPointerCoordsClassInfo.toolMinor = GetFieldIDOrDie(env, clazz, "toolMinor", "F");
911 gPointerCoordsClassInfo.orientation = GetFieldIDOrDie(env, clazz, "orientation", "F");
913 clazz = FindClassOrDie(env, "android/view/MotionEvent$PointerProperties");
915 gPointerPropertiesClassInfo.id = GetFieldIDOrDie(env, clazz, "id", "I");
916 gPointerPropertiesClassInfo.toolType = GetFieldIDOrDie(env, clazz, "toolType", "I");