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

Commit 80932c14 authored by David Brazdil's avatar David Brazdil
Browse files

Assume package failed to compile unless proven otherwise

BackgroundDexOptService keeps a list of packages which failed to
compile so that they are not revisited. If compilation takes so long
that the background job is killed, the offending package is not
recorded.

This patch records the package before dexopt is called and removes it
from the list if dexopt succeeds.

Bug: 28082762
Change-Id: If7388e159b999287b60f19dc99cf4dde61ec64c8
parent 6a3b2d2b
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -168,15 +168,18 @@ public class BackgroundDexOptService extends JobService {
                        // Skip previously failing package
                        continue;
                    }
                    // Conservatively add package to the list of failing ones in case performDexOpt
                    // never returns.
                    sFailedPackageNames.add(pkg);
                    // Optimize package if needed. Note that there can be no race between
                    // concurrent jobs because PackageDexOptimizer.performDexOpt is synchronized.
                    if (!pm.performDexOpt(pkg,
                    if (pm.performDexOpt(pkg,
                            /* instruction set */ null,
                            /* checkProfiles */ true,
                            PackageManagerService.REASON_BACKGROUND_DEXOPT,
                            /* force */ false)) {
                        // Dexopt failed, remember this so we do not keep retrying.
                        sFailedPackageNames.add(pkg);
                        // Dexopt succeeded, remove package from the list of failing ones.
                        sFailedPackageNames.remove(pkg);
                    }
                }
                // Ran to completion, so we abandon our timeslice and do not reschedule.