Add --skip-ro-app option
authorWoongsuk Cho <ws77.cho@samsung.com>
Tue, 29 Mar 2022 22:34:50 +0000 (07:34 +0900)
committer조웅석/Common Platform Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Tue, 19 Apr 2022 22:22:44 +0000 (07:22 +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
packaging/715.dotnet_regen_app_ni.patch.sh

index ca53f72..cec0125 100644 (file)
@@ -38,6 +38,7 @@
 #define NI_FLAGS_NO_PIPELINE            0x0080
 #define NI_FLAGS_MIBC                   0x0100
 #define NI_FLAGS_PRINT_CMD              0x0200
+#define NI_FLAGS_SKIP_RO_APP            0x0400
 
 typedef std::function<void (std::string)> afterCreate;
 
index 4ecba24..79334a5 100644 (file)
@@ -64,6 +64,8 @@ void DisplayUsage() {
                "                                   (If not set, default system paths are used.)\n"
                "       --no-pipeline             - Compile the dlls individually\n"
                "       --print-cmd               - Print command and options\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"
@@ -120,6 +122,8 @@ int main(int argc, char* argv[])
                        opt->flags |= NI_FLAGS_NO_PIPELINE;
                } else if (arg == "--print-cmd") {
                        opt->flags |= NI_FLAGS_PRINT_CMD;
+               } else if (arg == "--skip-ro-app") {
+                       opt->flags |= NI_FLAGS_SKIP_RO_APP;
                } else if (arg == "--ibc-dir") {
                        ++i;
                        if (i >= argc) {
index ab93a46..199426f 100644 (file)
@@ -682,6 +682,18 @@ static int appAotCb(pkgmgrinfo_appinfo_h handle, void *userData)
        int ret = 0;
        NIOption **pOptions = (NIOption**)userData;
 
+       if ((*pOptions)->flags & 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;
+               }
+       }
+
        ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId);
        if (ret != PMINFO_R_OK) {
                _SERR("Failed to get pkgid");
index 1611395..fe3037c 100644 (file)
@@ -5,6 +5,6 @@
 PATH=/usr/bin:/bin:/usr/sbin:/sbin
 
 /usr/bin/dotnettool --tac-regen-all
-/usr/bin/dotnettool --ni-regen-all-app
+/usr/bin/dotnettool --ni-regen-all-app --skip-ro-app
 /usr/bin/dotnettool --resolve-all-app
 /usr/bin/dotnettool --rm-all-app-profile