Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e80d58db authored by Mathieu Chartier's avatar Mathieu Chartier
Browse files

Avoid generating app images for extract only

The extract only app images have no resolved classes and only
contain dex cache arrays.

Bug: 22858531
Change-Id: I4351ef374f66d2882cc23fca14495e63a0e30e89
parent c1af8c2d
Loading
Loading
Loading
Loading
+14 −10
Original line number Original line Diff line number Diff line
@@ -1118,6 +1118,8 @@ int dexopt(const char* apk_path, uid_t uid, const char* pkgname, const char* ins
        }
        }
    }
    }


    // Avoid generating an app image for extract only since it will not contain any classes.
    if (!extract_only) {
      strcpy(image_path, out_path);
      strcpy(image_path, out_path);
      trim_extension(image_path);
      trim_extension(image_path);
      // Recreate is false since we want to avoid deleting the image in case dex2oat decides to not
      // Recreate is false since we want to avoid deleting the image in case dex2oat decides to not
@@ -1129,6 +1131,8 @@ int dexopt(const char* apk_path, uid_t uid, const char* pkgname, const char* ins
      } else if (!set_permissions_and_ownership(image_fd, is_public, uid, image_path)) {
      } else if (!set_permissions_and_ownership(image_fd, is_public, uid, image_path)) {
          image_fd = -1;
          image_fd = -1;
      }
      }
    }

    ALOGV("DexInv: --- BEGIN '%s' ---\n", input_file);
    ALOGV("DexInv: --- BEGIN '%s' ---\n", input_file);


    pid_t pid;
    pid_t pid;