Android: print a warning when using SurfaceTexture on Android 2.3.

SurfaceTexture is available since Android 3.0, print a warning when
camera preview or video playback is used on an older Android version.

Task-number: QTBUG-35075
Change-Id: Ie04c62df99048a25e8fd971e0708157d0d32c503
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
This commit is contained in:
Yoann Lopes
2013-11-27 16:05:19 +01:00
committed by The Qt Project
parent 041e75d1c0
commit fd3efc0163

View File

@@ -62,6 +62,8 @@ JSurfaceTexture::JSurfaceTexture(unsigned int texName)
{
if (isValid())
g_objectMap.insert(int(texName), this);
else // If the class is not available, it means the Android version is < 3.0
qWarning("Camera preview and video playback require Android 3.0 (API level 11) or later.");
}
JSurfaceTexture::~JSurfaceTexture()
@@ -94,6 +96,13 @@ static JNINativeMethod methods[] = {
bool JSurfaceTexture::initJNI(JNIEnv *env)
{
// SurfaceTexture is available since API 11, try to find it first before loading
// our custom class
jclass surfaceTextureClass = env->FindClass("android/graphics/SurfaceTexture");
if (env->ExceptionCheck())
env->ExceptionClear();
if (surfaceTextureClass) {
jclass clazz = env->FindClass("org/qtproject/qt5/android/multimedia/QtSurfaceTexture");
if (env->ExceptionCheck())
env->ExceptionClear();
@@ -106,6 +115,7 @@ bool JSurfaceTexture::initJNI(JNIEnv *env)
return false;
}
}
}
return true;
}