From 40881e0cf13696c5a1aad30db823d3b70e5adf5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Thu, 16 Oct 2025 16:13:42 +0200 Subject: [PATCH] Foo --- nymea-app.pro | 3 - nymea-app/nymea-app.pro | 1 + .../io/guh/nymeaapp/NymeaAppActivity.java | 60 ++++++++++++++++++- packaging/android/AndroidManifest.xml | 17 ++---- packaging/android/build.gradle | 2 - packaging/android/res/values/libs.xml | 6 -- 6 files changed, 65 insertions(+), 24 deletions(-) diff --git a/nymea-app.pro b/nymea-app.pro index bff014b4..e1e53824 100644 --- a/nymea-app.pro +++ b/nymea-app.pro @@ -81,9 +81,6 @@ linux:!android: { android: { message("Android package source dir $${ANDROID_PACKAGE_SOURCE_DIR}") - # SUBDIRS += androidservice - # androidservice.depends = libnymea-app - NYMEA_APP_ROOT_PROPERTY="nymeaAppRoot=$${top_srcdir}" no-firebase: FIREBASE_PROPERTY="useFirebase=false" else: FIREBASE_PROPERTY="useFirebase=true" diff --git a/nymea-app/nymea-app.pro b/nymea-app/nymea-app.pro index f7bb229b..78b80617 100644 --- a/nymea-app/nymea-app.pro +++ b/nymea-app/nymea-app.pro @@ -237,3 +237,4 @@ INSTALLS += target DISTFILES += +android: include(/usr/local/android/android_openssl/openssl.pri) diff --git a/nymea-app/platformintegration/android/java/io/guh/nymeaapp/NymeaAppActivity.java b/nymea-app/platformintegration/android/java/io/guh/nymeaapp/NymeaAppActivity.java index 0006be3a..3b8f665a 100644 --- a/nymea-app/platformintegration/android/java/io/guh/nymeaapp/NymeaAppActivity.java +++ b/nymea-app/platformintegration/android/java/io/guh/nymeaapp/NymeaAppActivity.java @@ -20,6 +20,11 @@ import androidx.core.content.FileProvider; import androidx.core.view.ViewCompat; import androidx.core.view.WindowCompat; import android.view.WindowInsets; +import android.graphics.Insets; + +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageManager; +import android.content.res.Resources; import org.qtproject.qt.android.bindings.QtActivity; @@ -44,6 +49,7 @@ public class NymeaAppActivity extends QtActivity @Override public void onCreate(Bundle savedInstanceState) { + logStaticInitClassesMetadata(); super.onCreate(savedInstanceState); // Move th app to the background (Edge to edge is forced since SDK 35) //WindowCompat.setDecorFitsSystemWindows(getWindow(), true); @@ -145,12 +151,62 @@ public class NymeaAppActivity extends QtActivity public int topPadding() { WindowInsets windowInsets = getWindow().getDecorView().getRootWindowInsets(); - return windowInsets.getInsets(WindowInsets.Type.statusBars() | WindowInsets.Type.displayCutout()).top; + + if (windowInsets == null) { + return 0; + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + Insets insets = windowInsets.getInsets(WindowInsets.Type.statusBars() | WindowInsets.Type.displayCutout()); + return insets != null ? insets.top : 0; + } + + return windowInsets.getStableInsetTop(); } public int bottomPadding() { WindowInsets windowInsets = getWindow().getDecorView().getRootWindowInsets(); - return windowInsets.getInsets(WindowInsets.Type.navigationBars() | WindowInsets.Type.displayCutout()).bottom; + if (windowInsets == null) { + return 0; + } + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + Insets insets = windowInsets.getInsets(WindowInsets.Type.navigationBars() | WindowInsets.Type.displayCutout()); + return insets != null ? insets.bottom : 0; + } + + return windowInsets.getStableInsetBottom(); } + private void logStaticInitClassesMetadata() { + try { + ApplicationInfo appInfo = getPackageManager().getApplicationInfo(getPackageName(), PackageManager.GET_META_DATA); + if (appInfo.metaData == null || !appInfo.metaData.containsKey("android.app.static_init_classes")) { + Log.w(TAG, "No android.app.static_init_classes meta-data present in the manifest"); + return; + } + + Object value = appInfo.metaData.get("android.app.static_init_classes"); + if (!(value instanceof Integer)) { + Log.w(TAG, "android.app.static_init_classes meta-data is not a resource reference: " + value); + return; + } + + int resId = (Integer) value; + if (resId == 0) { + Log.e(TAG, "android.app.static_init_classes meta-data resolves to resource id 0"); + return; + } + + try { + String resName = getResources().getResourceName(resId); + String resValue = getResources().getString(resId); + Log.i(TAG, "android.app.static_init_classes -> " + resName + " = " + resValue); + } catch (Resources.NotFoundException notFoundException) { + Log.e(TAG, "android.app.static_init_classes references missing resource 0x" + Integer.toHexString(resId), notFoundException); + } + } catch (PackageManager.NameNotFoundException exception) { + Log.e(TAG, "Failed to inspect android.app.static_init_classes meta-data", exception); + } + } } diff --git a/packaging/android/AndroidManifest.xml b/packaging/android/AndroidManifest.xml index 3ea6c8c9..173e75f3 100644 --- a/packaging/android/AndroidManifest.xml +++ b/packaging/android/AndroidManifest.xml @@ -63,9 +63,11 @@ + + + android:name="android.app.lib_name" + android:value="-- %%INSERT_APP_LIB_NAME%% --"/> - - @@ -97,12 +97,7 @@ - - - - - - + diff --git a/packaging/android/build.gradle b/packaging/android/build.gradle index 16e86bd3..39eecb79 100644 --- a/packaging/android/build.gradle +++ b/packaging/android/build.gradle @@ -10,7 +10,6 @@ println "Package source root ${nymeaAppRoot}" buildscript { repositories { - jcenter() google() mavenCentral() } @@ -24,7 +23,6 @@ buildscript { allprojects { repositories { google() - jcenter() maven { url "https://maven.google.com" } diff --git a/packaging/android/res/values/libs.xml b/packaging/android/res/values/libs.xml index ca84ac78..964d21a5 100644 --- a/packaging/android/res/values/libs.xml +++ b/packaging/android/res/values/libs.xml @@ -1,9 +1,5 @@ - - https://download.qt.io/ministro/android/qt6/qt-6.8 - - @@ -26,6 +22,4 @@ - -