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

Commit b118505e authored by Nicolas Geoffray's avatar Nicolas Geoffray Committed by Android (Google) Code Review
Browse files

Merge "resolve merge conflicts of 255b69ac to oc-dev-plus-aosp" into oc-dev-plus-aosp

parents 3e737d1c 7e1a2737
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -480,7 +480,7 @@ interface IPackageManager {
     * configuration.
     */
    boolean performDexOpt(String packageName, boolean checkProfiles,
            int compileReason, boolean force);
            int compileReason, boolean force, boolean bootComplete);

    /**
     * Ask the package manager to perform a dex-opt with the given compiler filter.
@@ -489,7 +489,7 @@ interface IPackageManager {
     *       definite state.
     */
    boolean performDexOptMode(String packageName, boolean checkProfiles,
            String targetCompilerFilter, boolean force);
            String targetCompilerFilter, boolean force, boolean bootComplete);

    /**
     * Ask the package manager to perform a dex-opt with the given compiler filter on the
+4 −2
Original line number Diff line number Diff line
@@ -214,7 +214,8 @@ public class BackgroundDexOptService extends JobService {
            int result = pm.performDexOptWithStatus(pkg,
                    /* checkProfiles */ false,
                    PackageManagerService.REASON_BOOT,
                    /* force */ false);
                    /* force */ false,
                    /* bootComplete */ true);
            if (result == PackageDexOptimizer.DEX_OPT_PERFORMED)  {
                updatedPackages.add(pkg);
            }
@@ -297,7 +298,8 @@ public class BackgroundDexOptService extends JobService {
                int result = pm.performDexOptWithStatus(pkg,
                        /* checkProfiles */ true,
                        PackageManagerService.REASON_BACKGROUND_DEXOPT,
                        /* force */ false);
                        /* force */ false,
                        /* bootComplete */ true);
                success = result != PackageDexOptimizer.DEX_OPT_FAILED;
                if (result == PackageDexOptimizer.DEX_OPT_PERFORMED) {
                    updatedPackages.add(pkg);
+2 −1
Original line number Diff line number Diff line
@@ -342,7 +342,8 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
                null /* ISAs */, false /* checkProfiles */,
                getCompilerFilterForReason(compilationReason),
                null /* CompilerStats.PackageStats */,
                mPackageManagerService.getDexManager().isUsedByOtherApps(pkg.packageName));
                mPackageManagerService.getDexManager().isUsedByOtherApps(pkg.packageName),
                true /* bootComplete */);

        return commands;
    }
+13 −9
Original line number Diff line number Diff line
@@ -113,7 +113,8 @@ public class PackageDexOptimizer {
     */
    int performDexOpt(PackageParser.Package pkg, String[] sharedLibraries,
            String[] instructionSets, boolean checkProfiles, String targetCompilationFilter,
            CompilerStats.PackageStats packageStats, boolean isUsedByOtherApps) {
            CompilerStats.PackageStats packageStats, boolean isUsedByOtherApps,
            boolean bootComplete) {
        if (!canOptimizePackage(pkg)) {
            return DEX_OPT_SKIPPED;
        }
@@ -121,7 +122,7 @@ public class PackageDexOptimizer {
            final long acquireTime = acquireWakeLockLI(pkg.applicationInfo.uid);
            try {
                return performDexOptLI(pkg, sharedLibraries, instructionSets, checkProfiles,
                        targetCompilationFilter, packageStats, isUsedByOtherApps);
                        targetCompilationFilter, packageStats, isUsedByOtherApps, bootComplete);
            } finally {
                releaseWakeLockLI(acquireTime);
            }
@@ -136,7 +137,7 @@ public class PackageDexOptimizer {
    private int performDexOptLI(PackageParser.Package pkg, String[] sharedLibraries,
            String[] targetInstructionSets, boolean checkForProfileUpdates,
            String targetCompilerFilter, CompilerStats.PackageStats packageStats,
            boolean isUsedByOtherApps) {
            boolean isUsedByOtherApps, boolean bootComplete) {
        final String[] instructionSets = targetInstructionSets != null ?
                targetInstructionSets : getAppDexInstructionSets(pkg.applicationInfo);
        final String[] dexCodeInstructionSets = getDexCodeInstructionSets(instructionSets);
@@ -150,7 +151,7 @@ public class PackageDexOptimizer {

        final String sharedLibrariesPath = getSharedLibrariesPath(sharedLibraries);
        // Get the dexopt flags after getRealCompilerFilter to make sure we get the correct flags.
        final int dexoptFlags = getDexFlags(pkg, compilerFilter);
        final int dexoptFlags = getDexFlags(pkg, compilerFilter, bootComplete);
        // Get the dependencies of each split in the package. For each code path in the package,
        // this array contains the relative paths of each split it depends on, separated by colons.
        String[] splitDependencies = getSplitDependencies(pkg);
@@ -296,7 +297,9 @@ public class PackageDexOptimizer {
            String compilerFilter, boolean isUsedByOtherApps) {
        compilerFilter = getRealCompilerFilter(info, compilerFilter, isUsedByOtherApps);
        // Get the dexopt flags after getRealCompilerFilter to make sure we get the correct flags.
        int dexoptFlags = getDexFlags(info, compilerFilter) | DEXOPT_SECONDARY_DEX;
        // Secondary dex files are currently not compiled at boot.
        int dexoptFlags = getDexFlags(info, compilerFilter, /* bootComplete */ true)
                | DEXOPT_SECONDARY_DEX;
        // Check the app storage and add the appropriate flags.
        if (info.deviceProtectedDataDir != null &&
                FileUtils.contains(info.deviceProtectedDataDir, path)) {
@@ -397,11 +400,12 @@ public class PackageDexOptimizer {
     * Computes the dex flags that needs to be pass to installd for the given package and compiler
     * filter.
     */
    private int getDexFlags(PackageParser.Package pkg, String compilerFilter) {
        return getDexFlags(pkg.applicationInfo, compilerFilter);
    private int getDexFlags(PackageParser.Package pkg, String compilerFilter,
            boolean bootComplete) {
        return getDexFlags(pkg.applicationInfo, compilerFilter, bootComplete);
    }

    private int getDexFlags(ApplicationInfo info, String compilerFilter) {
    private int getDexFlags(ApplicationInfo info, String compilerFilter, boolean bootComplete) {
        int flags = info.flags;
        boolean debuggable = (flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
        // Profile guide compiled oat files should not be public.
@@ -412,7 +416,7 @@ public class PackageDexOptimizer {
                (isPublic ? DEXOPT_PUBLIC : 0)
                | (debuggable ? DEXOPT_DEBUGGABLE : 0)
                | profileFlag
                | DEXOPT_BOOTCOMPLETE;
                | (bootComplete ? DEXOPT_BOOTCOMPLETE : 0);
        return adjustDexoptFlags(dexFlags);
    }

+28 −20
Original line number Diff line number Diff line
@@ -2943,7 +2943,6 @@ public class PackageManagerService extends IPackageManager.Stub
            Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "write settings");
            mSettings.writeLPr();
            Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
            EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_READY,
                    SystemClock.uptimeMillis());
@@ -9121,7 +9120,8 @@ public class PackageManagerService extends IPackageManager.Stub
        final long startTime = System.nanoTime();
        final int[] stats = performDexOptUpgrade(pkgs, mIsPreNUpgrade /* showDialog */,
                    getCompilerFilterForReason(causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT));
                    getCompilerFilterForReason(causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT),
                    false /* bootComplete */);
        final int elapsedTimeSeconds =
                (int) TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - startTime);
@@ -9140,7 +9140,7 @@ public class PackageManagerService extends IPackageManager.Stub
     * and {@code numberOfPackagesFailed}.
     */
    private int[] performDexOptUpgrade(List<PackageParser.Package> pkgs, boolean showDialog,
            String compilerFilter) {
            String compilerFilter, boolean bootComplete) {
        int numberOfPackagesVisited = 0;
        int numberOfPackagesOptimized = 0;
@@ -9197,7 +9197,8 @@ public class PackageManagerService extends IPackageManager.Stub
            int dexOptStatus = performDexOptTraced(pkg.packageName,
                    false /* checkProfiles */,
                    compilerFilter,
                    false /* force */);
                    false /* force */,
                    bootComplete);
            switch (dexOptStatus) {
                case PackageDexOptimizer.DEX_OPT_PERFORMED:
                    numberOfPackagesOptimized++;
@@ -9254,9 +9255,10 @@ public class PackageManagerService extends IPackageManager.Stub
    @Override
    public boolean performDexOpt(String packageName,
            boolean checkProfiles, int compileReason, boolean force) {
        return performDexOptWithStatus(packageName, checkProfiles, compileReason, force) !=
                PackageDexOptimizer.DEX_OPT_FAILED;
            boolean checkProfiles, int compileReason, boolean force, boolean bootComplete) {
        int dexoptStatus = performDexOptWithStatus(
              packageName, checkProfiles, compileReason, force, bootComplete);
        return dexoptStatus != PackageDexOptimizer.DEX_OPT_FAILED;
    }
    /**
@@ -9266,28 +9268,30 @@ public class PackageManagerService extends IPackageManager.Stub
     *  {@link PackageDexOptimizer#DEX_OPT_FAILED}
     */
    /* package */ int performDexOptWithStatus(String packageName,
            boolean checkProfiles, int compileReason, boolean force) {
            boolean checkProfiles, int compileReason, boolean force, boolean bootComplete) {
        return performDexOptTraced(packageName, checkProfiles,
                getCompilerFilterForReason(compileReason), force);
                getCompilerFilterForReason(compileReason), force, bootComplete);
    }
    @Override
    public boolean performDexOptMode(String packageName,
            boolean checkProfiles, String targetCompilerFilter, boolean force) {
            boolean checkProfiles, String targetCompilerFilter, boolean force,
            boolean bootComplete) {
        if (getInstantAppPackageName(Binder.getCallingUid()) != null) {
            return false;
        }
        int dexOptStatus = performDexOptTraced(packageName, checkProfiles,
                targetCompilerFilter, force);
                targetCompilerFilter, force, bootComplete);
        return dexOptStatus != PackageDexOptimizer.DEX_OPT_FAILED;
    }
    private int performDexOptTraced(String packageName,
                boolean checkProfiles, String targetCompilerFilter, boolean force) {
                boolean checkProfiles, String targetCompilerFilter, boolean force,
                boolean bootComplete) {
        Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt");
        try {
            return performDexOptInternal(packageName, checkProfiles,
                    targetCompilerFilter, force);
                    targetCompilerFilter, force, bootComplete);
        } finally {
            Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
        }
@@ -9296,7 +9300,8 @@ public class PackageManagerService extends IPackageManager.Stub
    // Run dexopt on a given package. Returns true if dexopt did not fail, i.e.
    // if the package can now be considered up to date for the given filter.
    private int performDexOptInternal(String packageName,
                boolean checkProfiles, String targetCompilerFilter, boolean force) {
                boolean checkProfiles, String targetCompilerFilter, boolean force,
                boolean bootComplete) {
        PackageParser.Package p;
        synchronized (mPackages) {
            p = mPackages.get(packageName);
@@ -9311,7 +9316,7 @@ public class PackageManagerService extends IPackageManager.Stub
        try {
            synchronized (mInstallLock) {
                return performDexOptInternalWithDependenciesLI(p, checkProfiles,
                        targetCompilerFilter, force);
                        targetCompilerFilter, force, bootComplete);
            }
        } finally {
            Binder.restoreCallingIdentity(callingId);
@@ -9332,7 +9337,7 @@ public class PackageManagerService extends IPackageManager.Stub
    private int performDexOptInternalWithDependenciesLI(PackageParser.Package p,
            boolean checkProfiles, String targetCompilerFilter,
            boolean force) {
            boolean force, boolean bootComplete) {
        // Select the dex optimizer based on the force parameter.
        // Note: The force option is rarely used (cmdline input for testing, mostly), so it's OK to
        //       allocate an object here.
@@ -9356,12 +9361,13 @@ public class PackageManagerService extends IPackageManager.Stub
                        false /* checkProfiles */,
                        targetCompilerFilter,
                        getOrCreateCompilerPackageStats(depPackage),
                        true /* isUsedByOtherApps */);
                        true /* isUsedByOtherApps */,
                        bootComplete);
            }
        }
        return pdo.performDexOpt(p, p.usesLibraryFiles, instructionSets, checkProfiles,
                targetCompilerFilter, getOrCreateCompilerPackageStats(p),
                mDexManager.isUsedByOtherApps(p.packageName));
                mDexManager.isUsedByOtherApps(p.packageName), bootComplete);
    }
    // Performs dexopt on the used secondary dex files belonging to the given package.
@@ -9555,7 +9561,8 @@ public class PackageManagerService extends IPackageManager.Stub
            // Don't use profiles since that may cause compilation to be skipped.
            final int res = performDexOptInternalWithDependenciesLI(pkg,
                    false /* checkProfiles */, getDefaultCompilerFilter(),
                    true /* force */);
                    true /* force */,
                    true /* bootComplete */);
            Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
            if (res != PackageDexOptimizer.DEX_OPT_PERFORMED) {
@@ -17926,7 +17933,8 @@ public class PackageManagerService extends IPackageManager.Stub
                        null /* instructionSets */, false /* checkProfiles */,
                        getCompilerFilterForReason(REASON_INSTALL),
                        getOrCreateCompilerPackageStats(pkg),
                        mDexManager.isUsedByOtherApps(pkg.packageName));
                        mDexManager.isUsedByOtherApps(pkg.packageName),
                        true /* bootComplete */);
                Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
            }
Loading