From 14dfc32488984ae44d9f4b74f403a7487193c2c9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=A1=B0=EC=9B=85=EC=84=9D/Common=20Platform=20Lab=28SR=29?= =?utf8?q?/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 29 Mar 2022 13:36:50 +0900 Subject: [PATCH] Add --skip-ro-app option (#396) The "--ni-regen-all-app" option performs AOTC again for all installed apps. If the "--ni-regen-all-app" option is performed after FOTA (OTN), an error may occur or unnecessary AOTC may be performed by running AOTC for an app installed in the RO area. To avoid this situation, the "--skip-ro-app" option is added. If this option is set, native image regenration for apps installed in the RO area is skipped. Note! this option works with "--ni-regen-all-app" option only. --- NativeLauncher/inc/ni_common.h | 1 + NativeLauncher/tool/dotnettool.cc | 4 ++++ NativeLauncher/tool/ni_common.cc | 12 ++++++++++++ 3 files changed, 17 insertions(+) diff --git a/NativeLauncher/inc/ni_common.h b/NativeLauncher/inc/ni_common.h index bdaba44..329f442 100644 --- a/NativeLauncher/inc/ni_common.h +++ b/NativeLauncher/inc/ni_common.h @@ -30,6 +30,7 @@ #define NI_FLAGS_APPNI 0x0002 #define NI_FLAGS_COMPATIBILITY 0x0004 #define NI_FLAGS_VERBOSE 0x0008 +#define NI_FLAGS_SKIP_RO_APP 0x0010 #define NI_FLAGS_INSTRUMENT 0x1000 typedef std::function afterCreate; diff --git a/NativeLauncher/tool/dotnettool.cc b/NativeLauncher/tool/dotnettool.cc index 4b9e579..225b0e3 100644 --- a/NativeLauncher/tool/dotnettool.cc +++ b/NativeLauncher/tool/dotnettool.cc @@ -51,6 +51,8 @@ void DisplayUsage() { " (replaces /r with /Trusted_Platform_Assemblies)\n" " --verbose - Display verbose information\n" " --instrument - Generate an instrumented image for profiling (enable: /Tuning)\n" + " --skip-ro-app - Skip re-generate NI for apps installed RO area\n" + " (This option works with --ni-regen-all-app only)\n" "\n" "Usage: dotnettool [options] [command] [arguments]\n" "\n" @@ -99,6 +101,8 @@ int main(int argc, char* argv[]) flags |= NI_FLAGS_INSTRUMENT; } else if (!strncmp(*it, "--verbose", 9)) { flags |= NI_FLAGS_VERBOSE; + } else if (!strncmp(*it, "--skip-ro-app", 13)) { + flags |= NI_FLAGS_SKIP_RO_APP; } else { args.push_back(*it); } diff --git a/NativeLauncher/tool/ni_common.cc b/NativeLauncher/tool/ni_common.cc index 7e0dde0..e908b5f 100644 --- a/NativeLauncher/tool/ni_common.cc +++ b/NativeLauncher/tool/ni_common.cc @@ -388,6 +388,18 @@ static int appAotCb(pkgmgrinfo_appinfo_h handle, void *userData) return -1; } + if ((*pFlags) & NI_FLAGS_SKIP_RO_APP) { + bool isSystem = false; + int ret = pkgmgrinfo_appinfo_is_system(handle, &isSystem); + if (ret != PMINFO_R_OK) { + fprintf(stderr, "Failed to check that app is System or not\n"); + return -1; + } + if (isSystem) { + return 0; + } + } + if (removeNIUnderPkgRoot(pkgId) != NI_ERROR_NONE) { fprintf(stderr, "Failed to remove previous dlls from [%s]\n", pkgId); return -1; -- 2.7.4