Add --skip-ro-app option (#396)
author조웅석/Common Platform Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Tue, 29 Mar 2022 04:36:50 +0000 (13:36 +0900)
committerWoongsuk Cho <ws77.cho@samsung.com>
Tue, 29 Mar 2022 22:51:33 +0000 (07:51 +0900)
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
NativeLauncher/tool/dotnettool.cc
NativeLauncher/tool/ni_common.cc

index 79709635388d50432f54f86c6f1dc6d9241f3ece..630fa4250b02213649dab20769328a29e09cb254 100644 (file)
@@ -31,6 +31,7 @@
 #define NI_FLAGS_COMPATIBILITY          0x0004
 #define NI_FLAGS_VERBOSE                0x0008
 #define NI_FLAGS_APP_UNDER_RO_AREA      0x0010
+#define NI_FLAGS_SKIP_RO_APP            0x0020
 #define NI_FLAGS_INSTRUMENT             0x1000
 
 typedef std::function<void (std::string)> afterCreate;
index 38db4cdc302c5754f79d386c164f45dd949258f8..9e9bea01b856094ad93b7c154ab814ed975459ae 100644 (file)
@@ -59,6 +59,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"
@@ -109,6 +111,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);
                }
index 73cf7381b6f43561a461f3e9aad1fb8d78b05ddb..ae9c09d8f85221cbe68c5efd7ea66b00c1e604b6 100644 (file)
@@ -429,6 +429,23 @@ 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) {
+                       _SERR("Failed to check that app is System or not\n");
+                       return -1;
+               }
+               if (isSystem) {
+                       return 0;
+               }
+       }
+
+       if (removeNIUnderPkgRoot(pkgId) != NI_ERROR_NONE) {
+               _SERR("Failed to remove previous dlls from [%s]\n", pkgId);
+               return -1;
+       }
+
        if (createNIUnderPkgRoot(pkgId, *pFlags) != NI_ERROR_NONE) {
                _SERR("Failed to generate NI file [%s]", pkgId);
                return -1;