diff options
| author | 2018-03-12 17:55:06 -0700 | |
|---|---|---|
| committer | 2018-03-12 17:55:06 -0700 | |
| commit | ad45a1b89bc3b6ec84ac32c4200be3d3c1d056fa (patch) | |
| tree | 4e530e5fe5cb7a90d6ff821ef477085e31342309 /cmds/installd/dexopt.cpp | |
| parent | 990cc3e31debfb9c7891b2d6348ccc73c09147b2 (diff) | |
Add flag for controling app image generation
So that package manager service can control this.
Bug: 72696798
Test: manual
Change-Id: I15fa74aff24ef14d22541117408840f80b7d300f
Diffstat (limited to 'cmds/installd/dexopt.cpp')
| -rw-r--r-- | cmds/installd/dexopt.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/cmds/installd/dexopt.cpp b/cmds/installd/dexopt.cpp index e1e73c7a61..27776629de 100644 --- a/cmds/installd/dexopt.cpp +++ b/cmds/installd/dexopt.cpp @@ -1264,8 +1264,8 @@ class Dex2oatFileWrapper { }; // (re)Creates the app image if needed. -Dex2oatFileWrapper maybe_open_app_image(const char* out_oat_path, bool profile_guided, - bool is_public, int uid, bool is_secondary_dex) { +Dex2oatFileWrapper maybe_open_app_image(const char* out_oat_path, + bool generate_app_image, bool is_public, int uid, bool is_secondary_dex) { // We don't create an image for secondary dex files. if (is_secondary_dex) { @@ -1278,11 +1278,11 @@ Dex2oatFileWrapper maybe_open_app_image(const char* out_oat_path, bool profile_g return Dex2oatFileWrapper(); } - // Use app images only if it is enabled (by a set image format) and we are compiling - // profile-guided (so the app image doesn't conservatively contain all classes). - if (!profile_guided) { - // In case there is a stale image, remove it now. Ignore any error. - unlink(image_path.c_str()); + // In case there is a stale image, remove it now. Ignore any error. + unlink(image_path.c_str()); + + // Not enabled, exit. + if (!generate_app_image) { return Dex2oatFileWrapper(); } char app_image_format[kPropertyValueMax]; @@ -1959,6 +1959,7 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins bool background_job_compile = (dexopt_flags & DEXOPT_IDLE_BACKGROUND_JOB) != 0; bool enable_hidden_api_checks = (dexopt_flags & DEXOPT_ENABLE_HIDDEN_API_CHECKS) != 0; bool generate_compact_dex = (dexopt_flags & DEXOPT_GENERATE_COMPACT_DEX) != 0; + bool generate_app_image = (dexopt_flags & DEXOPT_GENERATE_APP_IMAGE) != 0; // Check if we're dealing with a secondary dex file and if we need to compile it. std::string oat_dir_str; @@ -2027,8 +2028,8 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins unique_fd swap_fd = maybe_open_dexopt_swap_file(out_oat_path); // Create the app image file if needed. - Dex2oatFileWrapper image_fd = - maybe_open_app_image(out_oat_path, profile_guided, is_public, uid, is_secondary_dex); + Dex2oatFileWrapper image_fd = maybe_open_app_image( + out_oat_path, generate_app_image, is_public, uid, is_secondary_dex); // Open the reference profile if needed. Dex2oatFileWrapper reference_profile_fd = maybe_open_reference_profile( |