package com.android.server.pm;
-import static com.android.server.pm.PackageManagerServiceCompilerMapping.REASON_BACKGROUND_DEXOPT;
-
import android.app.AlarmManager;
import android.app.job.JobInfo;
import android.app.job.JobParameters;
import android.content.ComponentName;
import android.content.Context;
import android.os.ServiceManager;
-import android.os.SystemProperties;
import android.util.ArraySet;
import android.util.Log;
continue;
}
if (!pm.performDexOpt(pkg, /* instruction set */ null, /* checkProfiles */ true,
- REASON_BACKGROUND_DEXOPT, /* force */ false)) {
+ PackageManagerService.REASON_BACKGROUND_DEXOPT, /* force */ false)) {
// there was a problem running dexopt,
// remember this so we do not keep retrying.
sFailedPackageNames.add(pkg);
import static com.android.server.pm.InstructionSets.getAppDexInstructionSets;
import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets;
import static com.android.server.pm.PackageManagerServiceCompilerMapping.getCompilerFilterForReason;
-import static com.android.server.pm.PackageManagerServiceCompilerMapping.REASON_AB_OTA;
import android.content.Context;
import android.content.pm.IOtaDexopt;
}
mPackageDexOptimizer.performDexOpt(nextPackage, null /* ISAs */, false /* useProfiles */,
- getCompilerFilterForReason(REASON_AB_OTA));
+ getCompilerFilterForReason(PackageManagerService.REASON_AB_OTA));
}
private void moveAbArtifacts(Installer installer) {
import static com.android.server.pm.InstructionSets.getPrimaryInstructionSet;
import static com.android.server.pm.PackageManagerServiceCompilerMapping.getCompilerFilterForReason;
import static com.android.server.pm.PackageManagerServiceCompilerMapping.getFullCompilerFilter;
-import static com.android.server.pm.PackageManagerServiceCompilerMapping.REASON_BOOT;
-import static com.android.server.pm.PackageManagerServiceCompilerMapping.REASON_FORCED_DEXOPT;
-import static com.android.server.pm.PackageManagerServiceCompilerMapping.REASON_INSTALL;
-import static com.android.server.pm.PackageManagerServiceCompilerMapping.REASON_NON_SYSTEM_LIBRARY;
-import static com.android.server.pm.PackageManagerServiceCompilerMapping.REASON_SHARED_APK;
import static com.android.server.pm.PermissionsState.PERMISSION_OPERATION_FAILURE;
import static com.android.server.pm.PermissionsState.PERMISSION_OPERATION_SUCCESS;
import static com.android.server.pm.PermissionsState.PERMISSION_OPERATION_SUCCESS_GIDS_CHANGED;
sBrowserIntent.setData(Uri.parse("http:"));
}
+ // Compilation reasons.
+ public static final int REASON_BOOT = 0;
+ public static final int REASON_INSTALL = 1;
+ public static final int REASON_BACKGROUND_DEXOPT = 2;
+ public static final int REASON_AB_OTA = 3;
+ public static final int REASON_NON_SYSTEM_LIBRARY = 4;
+ public static final int REASON_SHARED_APK = 5;
+ public static final int REASON_FORCED_DEXOPT = 6;
+
+ public static final int REASON_LAST = REASON_FORCED_DEXOPT;
+
final ServiceThread mHandlerThread;
final PackageHandler mHandler;
* Manage (retrieve) mappings from compilation reason to compilation filter.
*/
class PackageManagerServiceCompilerMapping {
- // Compilation reasons.
- public static final int REASON_BOOT = 0;
- public static final int REASON_INSTALL = 1;
- public static final int REASON_BACKGROUND_DEXOPT = 2;
- public static final int REASON_AB_OTA = 3;
- public static final int REASON_NON_SYSTEM_LIBRARY = 4;
- public static final int REASON_SHARED_APK = 5;
- public static final int REASON_FORCED_DEXOPT = 6;
-
- private static final int REASON_LAST = REASON_FORCED_DEXOPT;
-
// Names for compilation reasons.
static final String REASON_STRINGS[] = {
"boot", "install", "bg-dexopt", "ab-ota", "nsys-library", "shared-apk", "forced-dexopt"
// Static block to ensure the strings array is of the right length.
static {
- if (REASON_LAST + 1 != REASON_STRINGS.length) {
+ if (PackageManagerService.REASON_LAST + 1 != REASON_STRINGS.length) {
throw new IllegalStateException("REASON_STRINGS not correct");
}
}
// Ensure that some reasons are not mapped to profile-guided filters.
switch (reason) {
- case REASON_SHARED_APK:
- case REASON_FORCED_DEXOPT:
+ case PackageManagerService.REASON_SHARED_APK:
+ case PackageManagerService.REASON_FORCED_DEXOPT:
if (DexFile.isProfileGuidedCompilerFilter(sysPropValue)) {
throw new IllegalStateException("\"" + sysPropValue + "\" is profile-guided, "
+ "but not allowed for " + REASON_STRINGS[reason]);
// overview. Store the exceptions here.
RuntimeException toThrow = null;
- for (int reason = 0; reason <= REASON_LAST; reason++) {
+ for (int reason = 0; reason <= PackageManagerService.REASON_LAST; reason++) {
try {
// Check that the system property name is legal.
String sysPropName = getSystemPropertyName(reason);
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ShellCommand;
-import android.os.SystemProperties;
import android.os.UserHandle;
import android.text.TextUtils;
import android.util.PrintWriterPrinter;
// Use the default mode for background dexopt.
targetCompilerFilter =
PackageManagerServiceCompilerMapping.getCompilerFilterForReason(
- PackageManagerServiceCompilerMapping.REASON_BACKGROUND_DEXOPT);
+ PackageManagerService.REASON_BACKGROUND_DEXOPT);
} else if ("reset".equals(compilerFilter)) {
// Use the default mode for install.
targetCompilerFilter =
PackageManagerServiceCompilerMapping.getCompilerFilterForReason(
- PackageManagerServiceCompilerMapping.REASON_INSTALL);
+ PackageManagerService.REASON_INSTALL);
} else {
if (!DexFile.isValidCompilerFilter(compilerFilter)) {
pw.println("Error: \"" + compilerFilter +