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
This commit is contained in:
David Brazdil
2016-04-08 16:38:04 +01:00
parent 6a3b2d2bc6
commit 80932c1418

View File

@@ -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.