Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt5: fix crash at launch on Android < 23 #23659

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions recipes/qt/5.x.x/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@
- "https://ftp.yz.yamagata-u.ac.jp/pub/qtproject/archive/qt/5.15/5.15.9/single/qt-everywhere-opensource-src-5.15.9.tar.xz"
sha256: "26d5f36134db03abe4a6db794c7570d729c92a3fc1b0bf9b1c8f86d0573cd02f"
patches:
"5.15.13":
- "base_path": "qt5/qtbase"
"patch_file": "patches/aa2a39dea5.diff"

Check warning on line 99 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 98)

Check warning on line 99 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 98)
- "base_path": "qt5/qtwebengine"
"patch_file": "patches/c72097e.diff"

Check warning on line 101 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine ^ (line: 100)

Check warning on line 101 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine ^ (line: 100)
- "base_path": "qt5/qttools"
"patch_file": "patches/fix-macdeployqt.diff"

Check warning on line 103 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qttools ^ (line: 102)

Check warning on line 103 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qttools ^ (line: 102)
- "base_path": "qt5/qtwebengine/src/3rdparty"
"patch_file": "patches/0001-Find-fontconfig-using-pkg-config.patch"

Check warning on line 105 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine/s ... ^ (line: 104)

Check warning on line 105 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine/s ... ^ (line: 104)
- "base_path": "qt5/qtbase"
"patch_file": "patches/android-backtrace.diff"

Check warning on line 107 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 106)

Check warning on line 107 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 106)
- "base_path": "qt5/qtbase"
"patch_file": "patches/android-openssl.diff"

Check warning on line 109 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 108)

Check warning on line 109 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 108)
- "base_path": "qt5/qtbase"
"patch_description": "Fix qmake build with apple-clang>=15"
"patch_file": "patches/5.15.8-fix-qmake-default-libdirs-apple-clang-15.patch"
Expand All @@ -117,16 +117,21 @@
"patch_file": "patches/5.15.12-fix-macos-cpp-lib-memory-resource.patch"
"patch_source": "https://codereview.qt-project.org/c/qt/qtbase/+/482392"
"patch_type": "portability"
- "base_path": "qt5/qtbase"
"patch_description": "Fix crash at launch on Android < 23"
"patch_file": "patches/5.15.13-android-21-22.diff"
"patch_source": "https://bugreports.qt.io/browse/QTBUG-120627?focusedId=789243&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-789243"
"patch_type": "portability"
"5.15.12":
- "base_path": "qt5/qtbase"
"patch_file": "patches/aa2a39dea5.diff"
- "base_path": "qt5/qtwebengine"

Check warning on line 128 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 127)

Check warning on line 128 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtbase ^ (line: 127)
"patch_file": "patches/c72097e.diff"
- "base_path": "qt5/qttools"

Check warning on line 130 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine ^ (line: 129)

Check warning on line 130 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine ^ (line: 129)
"patch_file": "patches/fix-macdeployqt.diff"
- "base_path": "qt5/qtwebengine/src/3rdparty/chromium/v8"

Check warning on line 132 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qttools ^ (line: 131)

Check warning on line 132 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qttools ^ (line: 131)
"patch_file": "patches/chromium-v8-missing-constexpr.patch"
- "base_path": "qt5/qtwebengine/src/3rdparty"

Check warning on line 134 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine/s ... ^ (line: 133)

Check warning on line 134 in recipes/qt/5.x.x/conandata.yml

View workflow job for this annotation

GitHub Actions / Lint changed files (YAML files)

conandata.yml schema warning

Schema outlined in /~https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md#patches-fields is not followed. required key(s) 'patch_description', 'patch_type' not found in - base_path: qt5/qtwebengine/s ... ^ (line: 133)
"patch_file": "patches/chromium-skia-missing-iterator-include.patch"
- "base_path": "qt5/qtwebengine/src/3rdparty/chromium/third_party/skia"
"patch_file": "patches/skia-cd397f3.diff"
Expand Down
82 changes: 82 additions & 0 deletions recipes/qt/5.x.x/patches/5.15.13-android-21-22.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
diff --git a/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java b/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java
index 9dba7f2..85a7027 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/ExtractStyle.java
@@ -88,6 +88,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.lang.reflect.Field;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -903,11 +904,28 @@ public class ExtractStyle {
}
return json;
}
+
+ private ContextThemeWrapper getContextThemeWrapper()
+ {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
+ return new ContextThemeWrapper(m_context, m_theme);
+
+ int themeResId = 0;
+ try {
+ Class<?> clazz = ContextThemeWrapper.class;
+ Method method = clazz.getMethod("getThemeResId");
+ method.setAccessible(true);
+ themeResId = (Integer)method.invoke(m_context);
+ } catch (Exception e) {
+ Log.e(QtNative.QtTAG, "Failed to get theme resource ID", e);
+ }
+ return new ContextThemeWrapper(m_context, themeResId);
+ }

private TypedArray obtainStyledAttributes(int styleName, int[] attributes)
{
TypedValue typedValue = new TypedValue();
- Context ctx = new ContextThemeWrapper(m_context, m_theme);
+ Context ctx = getContextThemeWrapper();
ctx.getTheme().resolveAttribute(styleName, typedValue, true);
return ctx.obtainStyledAttributes(typedValue.data, attributes);
}
@@ -926,7 +944,7 @@ public class ExtractStyle {
public void extractViewInformation(int styleName, JSONObject json, String qtClassName, AttributeSet attributeSet) {
try {
TypedValue typedValue = new TypedValue();
- Context ctx = new ContextThemeWrapper(m_context, m_theme);
+ Context ctx = getContextThemeWrapper();
ctx.getTheme().resolveAttribute(styleName, typedValue, true);

int[] attributes = new int[]{
@@ -1120,7 +1138,7 @@ public class ExtractStyle {

try {
TypedValue typedValue = new TypedValue();
- Context ctx = new ContextThemeWrapper(m_context, m_theme);
+ Context ctx = getContextThemeWrapper();
ctx.getTheme().resolveAttribute(styleName, typedValue, true);

// Get textAppearance values
@@ -1391,7 +1409,7 @@ public class ExtractStyle {
JSONObject json = extractTextAppearanceInformation(styleName, qtClass);

TypedValue typedValue = new TypedValue();
- Context ctx = new ContextThemeWrapper(m_context, m_theme);
+ Context ctx = getContextThemeWrapper();
ctx.getTheme().resolveAttribute(styleName, typedValue, true);
final int[] attributes = new int[]{android.R.attr.button};
TypedArray array = ctx.obtainStyledAttributes(typedValue.data, attributes);
diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java b/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java
index e59ac39..bac333c 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/QtLayout.java
@@ -106,8 +106,6 @@ public class QtLayout extends ViewGroup
final WindowManager windowManager = activity.getWindowManager();
Display display;

- final WindowInsets rootInsets = getRootWindowInsets();
-
int maxWidth = 0;
int maxHeight = 0;

Loading