From 1e64b58c358adea5b4f237c231b324491e5e898a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tinja=20Paavosepp=C3=A4?= Date: Thu, 18 Nov 2021 13:29:56 +0200 Subject: Recognize system apps also when apk has parent directory When checking if the apk is being deployed from system partition, account for possibility of the apk not being installed directly under /system/app or /system/priv-app, but in a directory of its own. Otherwise, system applications that are not directly under system app/ priv-app directories will not be recognized as system apps, meaning they will not use the system library path to load their libraries. Pick-to: 6.2 Change-Id: I1e778b18cae3c0406e087b8c78fd31d521f7be73 Reviewed-by: Assam Boudjelthia --- .../java/src/org/qtproject/qt/android/bindings/QtLoader.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/android') diff --git a/src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java b/src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java index 3724fa28bc..81304e23f6 100644 --- a/src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java +++ b/src/android/java/src/org/qtproject/qt/android/bindings/QtLoader.java @@ -259,8 +259,13 @@ public abstract class QtLoader { boolean apkDeployFromSystem = false; String apkPath = m_context.getApplicationInfo().publicSourceDir; File apkFile = new File(apkPath); - if (apkFile.exists() && Arrays.asList(SYSTEM_APP_PATHS).contains(apkFile.getParentFile().getAbsolutePath() + "/")) - apkDeployFromSystem = true; + if (apkFile.exists()) { + for (String systemAppPath : SYSTEM_APP_PATHS) { + apkDeployFromSystem = apkFile.getAbsolutePath().startsWith(systemAppPath); + if (apkDeployFromSystem) + break; + } + } String libsDir = null; String bundledLibsDir = null; -- cgit v1.2.3