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

Commit 186fe15c authored by Jiakai Zhang's avatar Jiakai Zhang Committed by Automerger Merge Worker
Browse files

Merge "Fix a logic error in `getDexoptNeeded`." into tm-dev am: e8a08386 am: 66439a2a

parents 749710e7 66439a2a
Loading
Loading
Loading
Loading
+9 −7
Original line number Original line Diff line number Diff line
@@ -936,12 +936,15 @@ public class PackageDexOptimizer {
            String classLoaderContext, int profileAnalysisResult, boolean downgrade,
            String classLoaderContext, int profileAnalysisResult, boolean downgrade,
            int dexoptFlags, String oatDir) {
            int dexoptFlags, String oatDir) {
        final boolean shouldBePublic = (dexoptFlags & DEXOPT_PUBLIC) != 0;
        final boolean shouldBePublic = (dexoptFlags & DEXOPT_PUBLIC) != 0;
        // If the artifacts should be public while the current artifacts are not, we should
        final boolean isProfileGuidedFilter = (dexoptFlags & DEXOPT_PROFILE_GUIDED) != 0;
        // re-compile anyway.
        boolean newProfile = profileAnalysisResult == PROFILE_ANALYSIS_OPTIMIZE;
        if (shouldBePublic && isOdexPrivate(packageName, path, isa, oatDir)) {

            // Ensure compilation by pretending a compiler filter change on the apk/odex location
        if (!newProfile && isProfileGuidedFilter && shouldBePublic
            // (the reason for the '-'. A positive value means the 'oat' location).
                && isOdexPrivate(packageName, path, isa, oatDir)) {
            return adjustDexoptNeeded(-DexFile.DEX2OAT_FOR_FILTER);
            // The profile that will be used is a cloud profile, while the profile used previously
            // is a user profile. Typically, this happens after an app starts being used by other
            // apps.
            newProfile = true;
        }
        }


        int dexoptNeeded;
        int dexoptNeeded;
@@ -959,7 +962,6 @@ public class PackageDexOptimizer {
                    && profileAnalysisResult == PROFILE_ANALYSIS_DONT_OPTIMIZE_EMPTY_PROFILES) {
                    && profileAnalysisResult == PROFILE_ANALYSIS_DONT_OPTIMIZE_EMPTY_PROFILES) {
                actualCompilerFilter = "verify";
                actualCompilerFilter = "verify";
            }
            }
            boolean newProfile = profileAnalysisResult == PROFILE_ANALYSIS_OPTIMIZE;
            dexoptNeeded = DexFile.getDexOptNeeded(path, isa, actualCompilerFilter,
            dexoptNeeded = DexFile.getDexOptNeeded(path, isa, actualCompilerFilter,
                    classLoaderContext, newProfile, downgrade);
                    classLoaderContext, newProfile, downgrade);
        } catch (IOException ioe) {
        } catch (IOException ioe) {