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

Commit 07463524 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "[installd] Add check that classpath is up to date to getDexOptNeeded"

parents 4f3f6529 58cab077
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -1365,7 +1365,8 @@ void update_out_oat_access_times(const char* apk_path, const char* out_oat_path)
// If this is for a profile guided compilation, profile_was_updated will tell whether or not
// the profile has changed.
static void exec_dexoptanalyzer(const std::string& dex_file, const std::string& instruction_set,
        const std::string& compiler_filter, bool profile_was_updated, bool downgrade) {
        const std::string& compiler_filter, bool profile_was_updated, bool downgrade,
        const char* class_loader_context) {
    const char* dexoptanalyzer_bin =
            is_debug_runtime()
                    ? "/system/bin/dexoptanalyzerd"
@@ -1383,11 +1384,16 @@ static void exec_dexoptanalyzer(const std::string& dex_file, const std::string&
    std::string compiler_filter_arg = "--compiler-filter=" + compiler_filter;
    const char* assume_profile_changed = "--assume-profile-changed";
    const char* downgrade_flag = "--downgrade";
    std::string class_loader_context_arg = "--class-loader-context=";
    if (class_loader_context != nullptr) {
        class_loader_context_arg += class_loader_context;
    }

    // program name, dex file, isa, filter, the final NULL
    const int argc = 5 +
        (profile_was_updated ? 1 : 0) +
        (downgrade ? 1 : 0);
        (downgrade ? 1 : 0) +
        (class_loader_context != nullptr ? 1 : 0);
    const char* argv[argc];
    int i = 0;
    argv[i++] = dexoptanalyzer_bin;
@@ -1400,6 +1406,9 @@ static void exec_dexoptanalyzer(const std::string& dex_file, const std::string&
    if (downgrade) {
        argv[i++] = downgrade_flag;
    }
    if (class_loader_context != nullptr) {
        argv[i++] = class_loader_context;
    }
    argv[i] = NULL;

    execv(dexoptanalyzer_bin, (char * const *)argv);
@@ -1480,7 +1489,8 @@ static bool process_dexoptanalyzer_result(const std::string& dex_path, int resul
static bool process_secondary_dex_dexopt(const char* original_dex_path, const char* pkgname,
        int dexopt_flags, const char* volume_uuid, int uid, const char* instruction_set,
        const char* compiler_filter, bool* is_public_out, int* dexopt_needed_out,
        std::string* oat_dir_out, std::string* dex_path_out, bool downgrade) {
        std::string* oat_dir_out, std::string* dex_path_out, bool downgrade,
        const char* class_loader_context) {
    int storage_flag;

    if ((dexopt_flags & DEXOPT_STORAGE_CE) != 0) {
@@ -1550,7 +1560,7 @@ static bool process_secondary_dex_dexopt(const char* original_dex_path, const ch
        drop_capabilities(uid);
        // Run dexoptanalyzer to get dexopt_needed code.
        exec_dexoptanalyzer(dex_path, instruction_set, compiler_filter, profile_was_updated,
                            downgrade);
                            downgrade, class_loader_context);
        exit(DEXOPTANALYZER_BIN_EXEC_ERROR);
    }

@@ -1606,8 +1616,7 @@ int dexopt(const char* dex_path, uid_t uid, const char* pkgname, const char* ins
    if (is_secondary_dex) {
        if (process_secondary_dex_dexopt(dex_path, pkgname, dexopt_flags, volume_uuid, uid,
                instruction_set, compiler_filter, &is_public, &dexopt_needed, &oat_dir_str,
                &dex_real_path,
                downgrade)) {
                &dex_real_path, downgrade, class_loader_context)) {
            oat_dir = oat_dir_str.c_str();
            dex_path = dex_real_path.c_str();
            if (dexopt_needed == NO_DEXOPT_NEEDED) {