ProfileVerifier.CompilationStatus
public class ProfileVerifier.CompilationStatus
CompilationStatus contains the result of a profile verification operation. It offers API to determine whether a profile was installed getProfileInstallResultCode and to check whether the app has been compiled with a profile or a profile is enqueued for compilation. Note that the app can be compiled with a profile also as result of background dex optimization.
Summary
Constants |
|
|---|---|
static final int |
Indicates that a profile is installed and the app has been compiled with it. |
static final int |
Indicates that a profile is installed and the app has been compiled with it. |
static final int |
Indicates that a previous verification result cache file exists but it cannot be read. |
static final int |
Indicates that wasn't possible to write the verification result cache file. |
static final int |
Indicates that the apk does not embed a baseline profile. |
static final int |
Indicates an error during the verification process: a |
static final int |
Indicates that ProfileVerifier runs on an unsupported api version of Android. |
static final int |
This field is deprecated. Do not use. |
static final int |
Indicates that no profile was installed for this app when installing the app through an app store or package manager. |
static final int |
Indicates that a profile is installed and the app will be compiled with it later when background dex optimization runs (i.e when the device is in idle and connected to the power). |
Public methods |
|
|---|---|
boolean |
|
int |
|
boolean |
|
boolean |
Constants
RESULT_CODE_COMPILED_WITH_PROFILE
public static final int RESULT_CODE_COMPILED_WITH_PROFILE = 1
Indicates that a profile is installed and the app has been compiled with it. This is the result of installation through app store or package manager, or installation through profile installer and subsequent compilation during background dex optimization.
RESULT_CODE_COMPILED_WITH_PROFILE_NON_MATCHING
public static final int RESULT_CODE_COMPILED_WITH_PROFILE_NON_MATCHING = 3
Indicates that a profile is installed and the app has been compiled with it. This is the result of installation through app store or package manager. Note that this result differs from RESULT_CODE_COMPILED_WITH_PROFILE as the profile is smaller than expected and may not include all the methods initially included in the baseline profile.
RESULT_CODE_ERROR_CACHE_FILE_EXISTS_BUT_CANNOT_BE_READ
public static final int RESULT_CODE_ERROR_CACHE_FILE_EXISTS_BUT_CANNOT_BE_READ = 131072
Indicates that a previous verification result cache file exists but it cannot be read.
RESULT_CODE_ERROR_CANT_WRITE_PROFILE_VERIFICATION_RESULT_CACHE_FILE
public static final int RESULT_CODE_ERROR_CANT_WRITE_PROFILE_VERIFICATION_RESULT_CACHE_FILE = 196608
Indicates that wasn't possible to write the verification result cache file. This can happen only because something is wrong with app folder permissions or if there is no free disk space on the device.
RESULT_CODE_ERROR_NO_PROFILE_EMBEDDED
public static final int RESULT_CODE_ERROR_NO_PROFILE_EMBEDDED = 327680
Indicates that the apk does not embed a baseline profile. When this happens it's usually because a baseline profile was not found at build time. Baseline profiles can be generated through the Baseline Profile Gradle Plugin, or manually added to the baseline profile source set for AGP 8.0 and above, or manually placed in `src/main/baseline-prof.txt for versions of AGP less than to 8.0 (legacy behavior that does not support variants).
RESULT_CODE_ERROR_PACKAGE_NAME_DOES_NOT_EXIST
public static final int RESULT_CODE_ERROR_PACKAGE_NAME_DOES_NOT_EXIST = 65536
Indicates an error during the verification process: a PackageManager.NameNotFoundException was launched when querying the PackageManager for the app package.
RESULT_CODE_ERROR_UNSUPPORTED_API_VERSION
public static final int RESULT_CODE_ERROR_UNSUPPORTED_API_VERSION = 262144
Indicates that ProfileVerifier runs on an unsupported api version of Android. Note that ProfileVerifier supports only P and above. Note that when this result code is returned isCompiledWithProfile and hasProfileEnqueuedForCompilation return false.
public static final int RESULT_CODE_NO_PROFILE = 0
Indicates that no profile was installed for this app. This means that no profile was installed when installing the app through app store or package manager and profile installer either didn't run (ProfileInstallerInitializer disabled) or the app was packaged without a compilation profile.
RESULT_CODE_NO_PROFILE_INSTALLED
public static final int RESULT_CODE_NO_PROFILE_INSTALLED = 0
Indicates that no profile was installed for this app when installing the app through an app store or package manager. The main reason for this to error code is that the profile installer did not run due to ProfileInstallerInitializer being disabled. Note that when this error is reported an embedded profile was still found in the application apk. When an embedded profile is not found, the error code returned is RESULT_CODE_ERROR_NO_PROFILE_EMBEDDED.
RESULT_CODE_PROFILE_ENQUEUED_FOR_COMPILATION
public static final int RESULT_CODE_PROFILE_ENQUEUED_FOR_COMPILATION = 2
Indicates that a profile is installed and the app will be compiled with it later when background dex optimization runs (i.e when the device is in idle and connected to the power). This is the result of installation through profile installer. When the profile is compiled, the result code will change to RESULT_CODE_COMPILED_WITH_PROFILE. Note that to test that the app is compiled with the installed profile, the background dex optimization can be forced through the following adb shell command: ``` adb shell cmd package compile -f -m speed-profile ```
Public methods
appApkHasEmbeddedProfile
public boolean appApkHasEmbeddedProfile()
| Returns | |
|---|---|
boolean |
True when the application apk has an embedded profile in the assets, false otherwise. Note that if the profile is not embedded, the result code is always |
getProfileInstallResultCode
public int getProfileInstallResultCode()
| Returns | |
|---|---|
int |
a result code that indicates whether there is a baseline profile installed and whether the app has been compiled with it. This depends on the installation method: if it was installed through app store or package manager the app gets compiled immediately with the profile and the return code is |
hasProfileEnqueuedForCompilation
public boolean hasProfileEnqueuedForCompilation()
| Returns | |
|---|---|
boolean |
True whether this app has a profile enqueued for compilation, false otherwise. An app can have a profile enqueued for compilation because of profile installation through profileinstaller or simply when the user starts interacting with the app. Note that if |
isCompiledWithProfile
public boolean isCompiledWithProfile()
| Returns | |
|---|---|
boolean |
True whether this app has been compiled with a profile, false otherwise. An app can be compiled with a profile because of profile installation through app store, package manager or profileinstaller and subsequent background dex optimization. There should be a performance improvement when an app has been compiled with a profile. Note that if |