Merge "Annotate the compilation reason with dex metadata information"

This commit is contained in:
Calin Juravle
2018-07-23 19:08:28 +00:00
committed by Android (Google) Code Review
2 changed files with 18 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ import android.util.Slog;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.IndentingPrintWriter;
import com.android.server.pm.Installer.InstallerException;
import com.android.server.pm.dex.ArtManagerService;
import com.android.server.pm.dex.DexManager;
import com.android.server.pm.dex.DexoptOptions;
import com.android.server.pm.dex.DexoptUtils;
@@ -289,7 +290,8 @@ public class PackageDexOptimizer {
mInstaller.dexopt(path, uid, pkg.packageName, isa, dexoptNeeded, oatDir, dexoptFlags,
compilerFilter, pkg.volumeUuid, classLoaderContext, pkg.applicationInfo.seInfo,
false /* downgrade*/, pkg.applicationInfo.targetSdkVersion,
profileName, dexMetadataPath, getReasonName(compilationReason));
profileName, dexMetadataPath,
getAugmentedReasonName(compilationReason, dexMetadataPath != null));
if (packageStats != null) {
long endTime = System.currentTimeMillis();
@@ -302,6 +304,12 @@ public class PackageDexOptimizer {
}
}
private String getAugmentedReasonName(int compilationReason, boolean useDexMetadata) {
String annotation = useDexMetadata
? ArtManagerService.DEXOPT_REASON_WITH_DEX_METADATA_ANNOTATION : "";
return getReasonName(compilationReason) + annotation;
}
/**
* Performs dexopt on the secondary dex {@code path} belonging to the app {@code info}.
*

View File

@@ -519,6 +519,11 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
private static final int TRON_COMPILATION_REASON_AB_OTA = 6;
private static final int TRON_COMPILATION_REASON_INACTIVE = 7;
private static final int TRON_COMPILATION_REASON_SHARED = 8;
private static final int TRON_COMPILATION_REASON_INSTALL_WITH_DEX_METADATA = 9;
// The annotation to add as a suffix to the compilation reason when dexopt was
// performed with dex metadata.
public static final String DEXOPT_REASON_WITH_DEX_METADATA_ANNOTATION = "-dm";
/**
* Convert the compilation reason to an int suitable to be logged to TRON.
@@ -534,6 +539,10 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
case "ab-ota" : return TRON_COMPILATION_REASON_AB_OTA;
case "inactive" : return TRON_COMPILATION_REASON_INACTIVE;
case "shared" : return TRON_COMPILATION_REASON_SHARED;
// This is a special marker for dex metadata installation that does not
// have an equivalent as a system property.
case "install" + DEXOPT_REASON_WITH_DEX_METADATA_ANNOTATION :
return TRON_COMPILATION_REASON_INSTALL_WITH_DEX_METADATA;
default: return TRON_COMPILATION_REASON_UNKNOWN;
}
}