am a00be9b4: Remember failed dexopt to avoid retry

automerge: 2350c7c

* commit '2350c7cb1238ad24b5afaa7f6627b3443d33621b':
  Remember failed dexopt to avoid retry
This commit is contained in:
Brian Carlstrom
2014-12-16 01:46:40 +00:00
committed by android-build-merger

View File

@@ -39,6 +39,11 @@ public class BackgroundDexOptService extends JobService {
"android", "android",
BackgroundDexOptService.class.getName()); BackgroundDexOptService.class.getName());
/**
* Set of failed packages remembered across job runs.
*/
static final ArraySet<String> sFailedPackageNames = new ArraySet<String>();
final AtomicBoolean mIdleTime = new AtomicBoolean(false); final AtomicBoolean mIdleTime = new AtomicBoolean(false);
public static void schedule(Context context) { public static void schedule(Context context) {
@@ -75,7 +80,15 @@ public class BackgroundDexOptService extends JobService {
schedule(BackgroundDexOptService.this); schedule(BackgroundDexOptService.this);
return; return;
} }
pm.performDexOpt(pkg, null /* instruction set */, true); if (sFailedPackageNames.contains(pkg)) {
// skip previously failing package
continue;
}
if (!pm.performDexOpt(pkg, null /* instruction set */, true)) {
// there was a problem running dexopt,
// remember this so we do not keep retrying.
sFailedPackageNames.add(pkg);
}
} }
// ran to completion, so we abandon our timeslice and do not reschedule // ran to completion, so we abandon our timeslice and do not reschedule
jobFinished(jobParams, false); jobFinished(jobParams, false);