Compile secondary dex files according to REASON_BACKGROUND_DEXOPT

Test: adb shell cmd package bg-dexopt-job works for sercondary dex files

Bug: 32871170
Bug: 26719109

(cherry picked from commit a70b1b1203)

Merged-In: Iaee8071449c83e774b2fe331aaccfc5433856f4f
Change-Id: I2334e4d73a5acdd1106e913c59ddf642782f1eee
This commit is contained in:
Calin Juravle
2017-03-09 18:41:10 -08:00
parent a9f46f76af
commit c480bdafdb
3 changed files with 18 additions and 2 deletions

View File

@@ -290,8 +290,8 @@ public class BackgroundDexOptService extends JobService {
PackageManagerService.REASON_BACKGROUND_DEXOPT,
/* force */ false)
: pm.performDexOptSecondary(pkg,
PackageManagerServiceCompilerMapping.getFullCompilerFilter(),
/* force */ true);
PackageManagerService.REASON_BACKGROUND_DEXOPT,
/* force */ false);
if (success) {
// Dexopt succeeded, remove package from the list of failing ones.
synchronized (failedPackageNames) {

View File

@@ -7516,6 +7516,11 @@ public class PackageManagerService extends IPackageManager.Stub {
return mDexManager.dexoptSecondaryDex(packageName, compilerFilter, force);
}
public boolean performDexOptSecondary(String packageName, int compileReason,
boolean force) {
return mDexManager.dexoptSecondaryDex(packageName, compileReason, force);
}
/**
* Reconcile the information we have about the secondary dex files belonging to
* {@code packagName} and the actual dex files. For all dex files that were

View File

@@ -274,6 +274,17 @@ public class DexManager {
return mPackageDexUsage.getPackageUseInfo(packageName);
}
/**
* Perform dexopt on the package {@code packageName} secondary dex files.
* @return true if all secondary dex files were processed successfully (compiled or skipped
* because they don't need to be compiled)..
*/
public boolean dexoptSecondaryDex(String packageName, int compilerReason, boolean force) {
return dexoptSecondaryDex(packageName,
PackageManagerServiceCompilerMapping.getCompilerFilterForReason(compilerReason),
force);
}
/**
* Perform dexopt on the package {@code packageName} secondary dex files.
* @return true if all secondary dex files were processed successfully (compiled or skipped