androiddeployqt: Add OpenGL dependency to manifest if necessary
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Wed, 4 Dec 2013 09:05:04 +0000 (10:05 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 4 Dec 2013 15:01:45 +0000 (16:01 +0100)
In order to filter out devices that do not support OpenGLES 2 in
Google Play, we need to report that we depend on it when using
Qt Quick or Qt OpenGL. It would have been more generic to add the
information to the meta-data in the module, but since we already
have the information there, just in the form of forcing the
use of the GL plugin, we might as well use that and not complicate
the dependency XMLs any further.

Task-number: QTBUG-32491
Change-Id: I2af044be010fcd0a8076906de6385701041b9c01
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
src/androiddeployqt/main.cpp

index e6def62..9d3cf50 100644 (file)
@@ -850,6 +850,14 @@ bool updateAndroidManifest(Options &options)
             fprintf(stdout, "  -- Using platform plugin %s\n", qPrintable(plugin));
     }
 
+    bool usesGL = false;
+    foreach (QString localLib, localLibs) {
+        if (localLib.endsWith(QLatin1String("libqtforandroidGL.so"))) {
+            usesGL = true;
+            break;
+        }
+    }
+
     QHash<QString, QString> replacements;
     replacements[QLatin1String("-- %%INSERT_APP_LIB_NAME%% --")] = QFileInfo(options.applicationBinary).baseName().mid(sizeof("lib") - 1);
     replacements[QLatin1String("-- %%INSERT_LOCAL_LIBS%% --")] = localLibs.join(QLatin1Char(':'));
@@ -869,6 +877,9 @@ bool updateAndroidManifest(Options &options)
     QString features;
     foreach (QString feature, options.features)
         features += QString::fromLatin1("<uses-feature android:name=\"%1\" />\n").arg(feature);
+    if (usesGL)
+        features += QStringLiteral("<uses-feature android:glEsVersion=\"0x00020000\" android:required=\"true\" />");
+
     replacements[QLatin1String("<!-- %%INSERT_FEATURES -->")] = features;
 
     QString androidManifestPath = options.outputDirectory + QLatin1String("/AndroidManifest.xml");