summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java20
-rw-r--r--src/android/templates/AndroidManifest.xml3
2 files changed, 18 insertions, 5 deletions
diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
index fc3d7e04ce..7826527918 100644
--- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
+++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java
@@ -46,6 +46,7 @@ import android.content.ServiceConnection;
import android.content.pm.ComponentInfo;
import android.content.pm.PackageInfo;
import android.content.res.AssetManager;
+import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
@@ -651,15 +652,26 @@ public abstract class QtLoader {
String themePath = m_context.getApplicationInfo().dataDir + "/qt-reserved-files/android-style/";
String stylePath = themePath + m_displayDensity + "/";
- String extractOption = "full";
+ String extractOption = "default";
if (m_contextInfo.metaData.containsKey("android.app.extract_android_style")) {
extractOption = m_contextInfo.metaData.getString("android.app.extract_android_style");
- if (!extractOption.equals("full") && !extractOption.equals("minimal") && !extractOption.equals("none")) {
- Log.e(QtApplication.QtTAG, "Invalid extract_android_style option \"" + extractOption + "\", defaulting to full");
- extractOption = "full";
+ if (!extractOption.equals("default") && !extractOption.equals("full") && !extractOption.equals("minimal") && !extractOption.equals("none")) {
+ Log.e(QtApplication.QtTAG, "Invalid extract_android_style option \"" + extractOption + "\", defaulting to \"default\"");
+ extractOption = "default";
}
}
+ // QTBUG-69810: The extraction code will trigger compatibility warnings on Android SDK version >= 28
+ // when the target SDK version is set to something lower then 28, so default to "none" and issue a warning
+ // if that is the case.
+ if (extractOption.equals("default")) {
+ final int targetSdkVersion = m_context.getApplicationInfo().targetSdkVersion;
+ if (targetSdkVersion < 28 && Build.VERSION.SDK_INT >= 28) {
+ Log.e(QtApplication.QtTAG, "extract_android_style option set to \"none\" when targetSdkVersion is less then 28");
+ extractOption = "none";
+ }
+ }
+
if (!(new File(stylePath)).exists() && !extractOption.equals("none")) {
loaderParams.putString(EXTRACT_STYLE_KEY, stylePath);
loaderParams.putBoolean(EXTRACT_STYLE_MINIMAL_KEY, extractOption.equals("minimal"));
diff --git a/src/android/templates/AndroidManifest.xml b/src/android/templates/AndroidManifest.xml
index c9eff264c4..44c2b519cf 100644
--- a/src/android/templates/AndroidManifest.xml
+++ b/src/android/templates/AndroidManifest.xml
@@ -57,11 +57,12 @@
<!-- extract android style -->
<!-- available android:values :
+ * default - In most cases this will be the same as "full", but it can also be something else if needed, e.g., for compatibility reasons
* full - useful QWidget & Quick Controls 1 apps
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
* none - useful for apps that don't use any of the above Qt modules
-->
- <meta-data android:name="android.app.extract_android_style" android:value="full"/>
+ <meta-data android:name="android.app.extract_android_style" android:value="default"/>
<!-- extract android style -->
</activity>