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 <assam.boudjelthia@qt.io>
bb10
Tinja Paavoseppä 2021-11-18 13:29:56 +02:00
parent 3bbbd4ae12
commit 1e64b58c35
1 changed files with 7 additions and 2 deletions

View File

@ -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;