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
diff --git a/cmds/installd/commands.cpp b/cmds/installd/commands.cpp
index 1b16d30..f71284c 100644
--- a/cmds/installd/commands.cpp
+++ b/cmds/installd/commands.cpp
@@ -1118,17 +1118,21 @@
}
}
- strcpy(image_path, out_path);
- trim_extension(image_path);
- // Recreate is false since we want to avoid deleting the image in case dex2oat decides to not
- // compile anything.
- image_fd = open_with_extension(image_path, ".art", /*recreate*/false);
- if (image_fd < 0) {
- // Could not create application image file. Go on since we can compile without it.
- ALOGE("installd could not create '%s' for image file during dexopt\n", image_path);
- } else if (!set_permissions_and_ownership(image_fd, is_public, uid, image_path)) {
- image_fd = -1;
+ // Avoid generating an app image for extract only since it will not contain any classes.
+ if (!extract_only) {
+ strcpy(image_path, out_path);
+ trim_extension(image_path);
+ // Recreate is false since we want to avoid deleting the image in case dex2oat decides to not
+ // compile anything.
+ image_fd = open_with_extension(image_path, ".art", /*recreate*/false);
+ if (image_fd < 0) {
+ // Could not create application image file. Go on since we can compile without it.
+ ALOGE("installd could not create '%s' for image file during dexopt\n", image_path);
+ } else if (!set_permissions_and_ownership(image_fd, is_public, uid, image_path)) {
+ image_fd = -1;
+ }
}
+
ALOGV("DexInv: --- BEGIN '%s' ---\n", input_file);
pid_t pid;