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

Commit 47c170a7 authored by Andreas Gampe's avatar Andreas Gampe
Browse files

Package Manager: Use new DexFile function to upgrade filter

In case an app is shared, do not simply use "full" for compilation.
Instead, upgrade the asked-for filter to the non-guided version.

Bug: 27921071
Change-Id: I54735b61732e6a5c9dc62425d04bc740dd365083
parent 1b8189d8
Loading
Loading
Loading
Loading
+9 −4
Original line number Original line Diff line number Diff line
@@ -42,7 +42,7 @@ import static com.android.server.pm.Installer.DEXOPT_PUBLIC;
import static com.android.server.pm.Installer.DEXOPT_SAFEMODE;
import static com.android.server.pm.Installer.DEXOPT_SAFEMODE;
import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets;
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets;
import static com.android.server.pm.PackageManagerServiceCompilerMapping.getFullCompilerFilter;
import static com.android.server.pm.PackageManagerServiceCompilerMapping.getNonProfileGuidedCompilerFilter;


/**
/**
 * Helper class for running dexopt command on packages.
 * Helper class for running dexopt command on packages.
@@ -144,9 +144,10 @@ class PackageDexOptimizer {
                if (isUsedByOtherApps(path)) {
                if (isUsedByOtherApps(path)) {
                    checkProfiles = false;
                    checkProfiles = false;


                    // TODO: Should we only upgrade to the non-profile-guided version? That is,
                    targetCompilerFilter = getNonProfileGuidedCompilerFilter(targetCompilerFilter);
                    //       given verify-profile, should we move to interpret-only?
                    if (DexFile.isProfileGuidedCompilerFilter(targetCompilerFilter)) {
                    targetCompilerFilter = getFullCompilerFilter();
                        throw new IllegalStateException(targetCompilerFilter);
                    }
                    isProfileGuidedFilter = false;
                    isProfileGuidedFilter = false;


                    break;
                    break;
@@ -181,6 +182,10 @@ class PackageDexOptimizer {
                    return DEX_OPT_FAILED;
                    return DEX_OPT_FAILED;
                }
                }
                dexoptNeeded = adjustDexoptNeeded(dexoptNeeded);
                dexoptNeeded = adjustDexoptNeeded(dexoptNeeded);
                if (PackageManagerService.DEBUG_DEXOPT) {
                    Log.i(TAG, "DexoptNeeded for " + path + "@" + targetCompilerFilter + " is " +
                            dexoptNeeded);
                }


                final String dexoptType;
                final String dexoptType;
                String oatDir = null;
                String oatDir = null;
+6 −0
Original line number Original line Diff line number Diff line
@@ -126,4 +126,10 @@ class PackageManagerServiceCompilerMapping {
        return value;
        return value;
    }
    }


    /**
     * Return the non-profile-guided filter corresponding to the given filter.
     */
    public static String getNonProfileGuidedCompilerFilter(String filter) {
        return DexFile.getNonProfileGuidedCompilerFilter(filter);
    }
}
}