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

Commit 29ec70b9 authored by Calin Juravle's avatar Calin Juravle Committed by Andreas Gampe
Browse files

Allow public profile compilation for primary apks

It is ok to perform a "public" compilation with
profiles comming from dex metdata files.

(cherry picked from commit ff3e4a1b)

Test: adb install foo.apk foo.dm
Bug: 30934496
Merged-In: I1d15e3281ccc61b19a2aafe3c885285a83ff6115
Change-Id: I1d15e3281ccc61b19a2aafe3c885285a83ff6115
parent 29c772cb
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -520,9 +520,13 @@ public class PackageDexOptimizer {
    private int getDexFlags(ApplicationInfo info, String compilerFilter, DexoptOptions options) {
        int flags = info.flags;
        boolean debuggable = (flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
        // Profile guide compiled oat files should not be public.
        // Profile guide compiled oat files should not be public unles they are based
        // on profiles from dex metadata archives.
        // The flag isDexoptInstallWithDexMetadata applies only on installs when we know that
        // the user does not have an existing profile.
        boolean isProfileGuidedFilter = isProfileGuidedCompilerFilter(compilerFilter);
        boolean isPublic = !info.isForwardLocked() && !isProfileGuidedFilter;
        boolean isPublic = !info.isForwardLocked() &&
                (!isProfileGuidedFilter || options.isDexoptInstallWithDexMetadata());
        int profileFlag = isProfileGuidedFilter ? DEXOPT_PROFILE_GUIDED : 0;
        // Some apps are executed with restrictions on hidden API usage. If this app is one
        // of them, pass a flag to dexopt to enable the same restrictions during compilation.