QMatrix4x4 AndroidSurfaceTexture::getTransformMatrix() { QMatrix4x4 matrix; if (!m_surfaceTexture.isValid()) return matrix; QJNIEnvironmentPrivate env; jfloatArray array = env->NewFloatArray(16); m_surfaceTexture.callMethod<void>("getTransformMatrix", "([F)V", array); env->GetFloatArrayRegion(array, 0, 16, matrix.data()); env->DeleteLocalRef(array); return matrix; }
QList<QByteArray> QAndroidTimeZonePrivate::availableTimeZoneIds() const { QList<QByteArray> availableTimeZoneIdList; QJNIObjectPrivate androidAvailableIdList = QJNIObjectPrivate::callStaticObjectMethod("java.util.TimeZone", "getAvailableIDs", "()[Ljava/lang/String;"); QJNIEnvironmentPrivate jniEnv; int androidTZcount = jniEnv->GetArrayLength( static_cast<jarray>(androidAvailableIdList.object()) ); // need separate jobject and QAndroidJniObject here so that we can delete (DeleteLocalRef) the reference to the jobject // (or else the JNI reference table fills after 512 entries from GetObjectArrayElement) jobject androidTZobject; QJNIObjectPrivate androidTZ; for (int i=0; i<androidTZcount; i++ ) { androidTZobject = jniEnv->GetObjectArrayElement( static_cast<jobjectArray>( androidAvailableIdList.object() ), i ); androidTZ = androidTZobject; availableTimeZoneIdList.append( androidTZ.toString().toUtf8() ); jniEnv->DeleteLocalRef(androidTZobject); } return availableTimeZoneIdList; }
QList<AndroidNetworkInfo> AndroidConnectivityManager::getAllNetworkInfo() const { QJNIEnvironmentPrivate env; QJNIObjectPrivate objArray = m_connectivityManager.callObjectMethod("getAllNetworkInfo", "()[Landroid/net/NetworkInfo;"); QList<AndroidNetworkInfo> list; if (!objArray.isValid()) return list; const jsize length = env->GetArrayLength(static_cast<jarray>(objArray.object())); if (exceptionCheckAndClear(env)) return list; for (int i = 0; i != length; ++i) { jobject lref = env->GetObjectArrayElement(static_cast<jobjectArray>(objArray.object()), i); if (exceptionCheckAndClear(env)) break; list << AndroidNetworkInfo(lref); env->DeleteLocalRef(lref); } return list; }