Added in API level 1
Deprecated in API level 24

MockPackageManager


open class MockPackageManager : PackageManager
kotlin.Any
   ↳ android.content.pm.PackageManager
   ↳ android.test.mock.MockPackageManager

A mock android.content.pm.PackageManager class. All methods are non-functional and throw java.lang.UnsupportedOperationException. Override it to provide the operations that you need.

Summary

Inherited constants
Public constructors

Public methods
open Unit

open Boolean

open Boolean

open Unit
addPreferredActivity(filter: IntentFilter, match: Int, set: Array<ComponentName!>?, activity: ComponentName)

open Boolean

open Array<String!>!

open Int
checkPermission(permName: String, pkgName: String)

open Int
checkSignatures(pkg1: String, pkg2: String)

open Int
checkSignatures(uid1: Int, uid2: Int)

open Unit

open Array<String!>!

open Unit
extendVerificationTimeout(id: Int, verificationCodeAtTimeout: Int, millisecondsToDelay: Long)

open Drawable?

open Drawable?

open Drawable

open Drawable

open ActivityInfo
getActivityInfo(className: ComponentName, flags: Int)

open Drawable?

open Drawable?

open MutableList<IntentFilter!>!
getAllIntentFilters(packageName: String!)

open MutableList<PermissionGroupInfo!>

open Drawable?

open Drawable?

open Int

open Drawable

open Drawable
getApplicationIcon(packageName: String)

open ApplicationInfo
getApplicationInfo(packageName: String, flags: Int)

open CharSequence

open Drawable?

open Drawable?
getApplicationLogo(packageName: String)

open Int

open Drawable

open Drawable?
getDrawable(packageName: String, resid: Int, appInfo: ApplicationInfo?)

open MutableList<ApplicationInfo!>

open MutableList<PackageInfo!>

open String?

open InstrumentationInfo

open Intent?

open Intent?

open String?

open PackageInfo?
getPackageArchiveInfo(archiveFilePath: String, flags: Int)

open IntArray!
getPackageGids(packageName: String)

open IntArray!
getPackageGids(packageName: String, flags: Int)

open PackageInfo!
getPackageInfo(packageName: String, flags: Int)

open PackageInfo!
getPackageInfo(versionedPackage: VersionedPackage, flags: Int)

open PackageInstaller

{@hide}

open Int
getPackageUid(packageName: String, flags: Int)

open Array<String!>?

open MutableList<PackageInfo!>
getPackagesHoldingPermissions(permissions: Array<String!>, flags: Int)

open PermissionGroupInfo

open PermissionInfo!
getPermissionInfo(name: String, flags: Int)

open Int
getPreferredActivities(outFilters: MutableList<IntentFilter!>, outActivities: MutableList<ComponentName!>, packageName: String?)

open MutableList<PackageInfo!>

open ProviderInfo
getProviderInfo(className: ComponentName, flags: Int)

open ActivityInfo
getReceiverInfo(className: ComponentName, flags: Int)

open Resources

open Resources

open Resources

open ServiceInfo
getServiceInfo(className: ComponentName, flags: Int)

open MutableList<SharedLibraryInfo!>

Get a list of shared libraries on the device.

open Array<FeatureInfo!>

open Array<String!>?

open CharSequence?
getText(packageName: String, resid: Int, appInfo: ApplicationInfo?)

open Drawable
getUserBadgedDrawableForDensity(drawable: Drawable, user: UserHandle, badgeLocation: Rect?, badgeDensity: Int)

open Drawable

open CharSequence

open XmlResourceParser?
getXml(packageName: String, resid: Int, appInfo: ApplicationInfo?)

open Boolean
hasSigningCertificate(packageName: String, certificate: ByteArray, type: Int)

Searches the set of signing certificates by which the given package has proven to have been signed.

open Boolean
hasSigningCertificate(uid: Int, certificate: ByteArray, type: Int)

Searches the set of signing certificates by which the package(s) for the given uid has proven to have been signed.

open Boolean

open Boolean
hasSystemFeature(name: String, version: Int)

open Boolean

open Boolean

open MutableList<ResolveInfo!>

open MutableList<ProviderInfo!>
queryContentProviders(processName: String?, uid: Int, flags: Int)

open MutableList<InstrumentationInfo!>
queryInstrumentation(targetPackage: String, flags: Int)

open MutableList<ResolveInfo!>
queryIntentActivities(intent: Intent, flags: Int)

open MutableList<ResolveInfo!>
queryIntentActivityOptions(caller: ComponentName?, specifics: Array<Intent!>?, intent: Intent, flags: Int)

open MutableList<ResolveInfo!>

open MutableList<ResolveInfo!>
queryIntentServices(intent: Intent, flags: Int)

open MutableList<PermissionInfo!>

open Unit

open Unit

open ResolveInfo?
resolveActivity(intent: Intent, flags: Int)

open ProviderInfo?

open ResolveInfo?
resolveService(intent: Intent, flags: Int)

open ResolveInfo!
resolveServiceAsUser(intent: Intent!, flags: Int, userId: Int)

open Unit
setApplicationEnabledSetting(packageName: String, newState: Int, flags: Int)

open Unit
setComponentEnabledSetting(componentName: ComponentName, newState: Int, flags: Int)

open Unit
setInstallerPackageName(targetPackage: String, installerPackageName: String?)

open Unit
verifyPendingInstall(id: Int, verificationCode: Int)

Inherited functions
Inherited properties

Public constructors

MockPackageManager

MockPackageManager()

Public methods

addPackageToPreferred

Added in API level 1
open fun addPackageToPreferred(packageName: String): Unit

Deprecated: Deprecated in Java.

Parameters
packageName String: This value cannot be null.

addPermission

Added in API level 1
open fun addPermission(info: PermissionInfo): Boolean

Deprecated: Deprecated in Java.

Parameters
info PermissionInfo: Description of the permission to be added. This value cannot be null.
Return
Boolean Returns true if a new permission was created, false if an existing one was updated.
Exceptions
java.lang.SecurityException if you are not allowed to add the given permission name.

addPermissionAsync

Added in API level 8
Deprecated in API level 24
open fun addPermissionAsync(info: PermissionInfo): Boolean

Deprecated: Deprecated in Java.

Parameters
info PermissionInfo: This value cannot be null.

addPreferredActivity

Added in API level 1
open fun addPreferredActivity(
    filter: IntentFilter,
    match: Int,
    set: Array<ComponentName!>?,
    activity: ComponentName
): Unit

Deprecated: Deprecated in Java.

Parameters
filter IntentFilter: The set of intents under which this activity will be made preferred. This value cannot be null.
match Int: The IntentFilter match category that this preference applies to.
set Array<ComponentName!>?: The set of activities that the user was picking from when this preference was made. This value may be null.
activity ComponentName: The component name of the activity that is to be preferred. This value cannot be null.

canRequestPackageInstalls

Added in API level 26
Deprecated in API level 24
open fun canRequestPackageInstalls(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean true if the calling package is trusted by the user to request install packages on the device, false otherwise.

canonicalToCurrentPackageNames

Added in API level 8
Deprecated in API level 24
open fun canonicalToCurrentPackageNames(names: Array<String!>): Array<String!>!

Deprecated: Deprecated in Java.

Parameters
packageNames Array of new names to be mapped. This value cannot be null.
Return
Array<String!>! Returns an array of the same size as the original, containing the current name for each package.

checkPermission

Added in API level 1
open fun checkPermission(
    permName: String,
    pkgName: String
): Int

Deprecated: Deprecated in Java.

Parameters
permName String: The name of the permission you are checking for. This value cannot be null.
packageName The name of the package you are checking against. This value cannot be null.
Return
Int If the package has the permission, PERMISSION_GRANTED is returned. If it does not have the permission, PERMISSION_DENIED is returned. Value is android.content.pm.PackageManager#PERMISSION_GRANTED, or android.content.pm.PackageManager#PERMISSION_DENIED

checkSignatures

Added in API level 1
open fun checkSignatures(
    pkg1: String,
    pkg2: String
): Int

Deprecated: Deprecated in Java.

Parameters
packageName1 First package name whose signature will be compared. This value cannot be null.
packageName2 Second package name whose signature will be compared. This value cannot be null.
Return
Int Returns an integer indicating whether all signatures on the two packages match. The value is >= 0 (SIGNATURE_MATCH) if all signatures match or < 0 if there is not a match (SIGNATURE_NO_MATCH or SIGNATURE_UNKNOWN_PACKAGE). Value is android.content.pm.PackageManager#SIGNATURE_MATCH, android.content.pm.PackageManager#SIGNATURE_NEITHER_SIGNED, android.content.pm.PackageManager#SIGNATURE_FIRST_NOT_SIGNED, android.content.pm.PackageManager#SIGNATURE_SECOND_NOT_SIGNED, android.content.pm.PackageManager#SIGNATURE_NO_MATCH, or android.content.pm.PackageManager#SIGNATURE_UNKNOWN_PACKAGE

checkSignatures

Added in API level 5
Deprecated in API level 24
open fun checkSignatures(
    uid1: Int,
    uid2: Int
): Int

Deprecated: Deprecated in Java.

Parameters
uid1 Int: First UID whose signature will be compared.
uid2 Int: Second UID whose signature will be compared.
Return
Int Returns an integer indicating whether all signatures on the two packages match. The value is >= 0 (SIGNATURE_MATCH) if all signatures match or < 0 if there is not a match (SIGNATURE_NO_MATCH or SIGNATURE_UNKNOWN_PACKAGE). Value is android.content.pm.PackageManager#SIGNATURE_MATCH, android.content.pm.PackageManager#SIGNATURE_NEITHER_SIGNED, android.content.pm.PackageManager#SIGNATURE_FIRST_NOT_SIGNED, android.content.pm.PackageManager#SIGNATURE_SECOND_NOT_SIGNED, android.content.pm.PackageManager#SIGNATURE_NO_MATCH, or android.content.pm.PackageManager#SIGNATURE_UNKNOWN_PACKAGE

clearPackagePreferredActivities

Added in API level 1
open fun clearPackagePreferredActivities(packageName: String): Unit

Deprecated: Deprecated in Java.

Parameters
packageName String: The name of the package whose preferred activity mappings are to be removed. This value cannot be null.

currentToCanonicalPackageNames

Added in API level 8
Deprecated in API level 24
open fun currentToCanonicalPackageNames(names: Array<String!>): Array<String!>!

Deprecated: Deprecated in Java.

Parameters
packageNames Array of current names to be mapped. This value cannot be null.
Return
Array<String!>! Returns an array of the same size as the original, containing the canonical name for each package.

extendVerificationTimeout

Added in API level 17
Deprecated in API level 24
open fun extendVerificationTimeout(
    id: Int,
    verificationCodeAtTimeout: Int,
    millisecondsToDelay: Long
): Unit

Deprecated: Deprecated in Java.

Parameters
id Int: pending package identifier as passed via the PackageManager#EXTRA_VERIFICATION_ID Intent extra.
verificationCodeAtTimeout Int: either PackageManager#VERIFICATION_ALLOW or PackageManager#VERIFICATION_REJECT. If verificationCodeAtTimeout is neither PackageManager#VERIFICATION_ALLOW or PackageManager#VERIFICATION_REJECT, then verificationCodeAtTimeout will default to PackageManager#VERIFICATION_REJECT.
millisecondsToDelay Long: the amount of time requested for the timeout. Must be positive and less than PackageManager#MAXIMUM_VERIFICATION_TIMEOUT. If millisecondsToDelay is out of bounds, millisecondsToDelay will be set to the closest in bounds value; namely, 0 or PackageManager#MAXIMUM_VERIFICATION_TIMEOUT.
Exceptions
java.lang.SecurityException if the caller does not have the PACKAGE_VERIFICATION_AGENT permission.

getActivityBanner

Added in API level 20
Deprecated in API level 24
open fun getActivityBanner(activityName: ComponentName): Drawable?

Deprecated: Deprecated in Java.

Parameters
activityName ComponentName: Name of the activity whose banner is to be retrieved. This value cannot be null.
Return
Drawable? Returns the image of the banner, or null if the activity has no banner specified.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for the given activity could not be loaded.

getActivityBanner

Added in API level 20
Deprecated in API level 24
open fun getActivityBanner(intent: Intent): Drawable?

Deprecated: Deprecated in Java.

Parameters
intent Intent: The intent for which you would like to retrieve a banner. This value cannot be null.
Return
Drawable? Returns the image of the banner, or null if the activity has no banner specified.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for application matching the given intent could not be loaded.

getActivityIcon

Added in API level 1
open fun getActivityIcon(activityName: ComponentName): Drawable

Deprecated: Deprecated in Java.

Parameters
activityName ComponentName: Name of the activity whose icon is to be retrieved. This value cannot be null.
Return
Drawable Returns the image of the icon, or the default activity icon if it could not be found. Does not return null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for the given activity could not be loaded.

getActivityIcon

Added in API level 1
open fun getActivityIcon(intent: Intent): Drawable

Deprecated: Deprecated in Java.

Parameters
intent Intent: The intent for which you would like to retrieve an icon. This value cannot be null.
Return
Drawable Returns the image of the icon, or the default activity icon if it could not be found. Does not return null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for application matching the given intent could not be loaded.

getActivityInfo

Added in API level 1
open fun getActivityInfo(
    className: ComponentName,
    flags: Int
): ActivityInfo

Deprecated: Deprecated in Java.

Parameters
component The full component name (i.e. com.google.apps.contacts/com.google.apps.contacts. ContactsList) of an Activity class. This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
ActivityInfo An ActivityInfo containing information about the activity. This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.
Added in API level 9
Deprecated in API level 24
open fun getActivityLogo(activityName: ComponentName): Drawable?

Deprecated: Deprecated in Java.

Parameters
activityName ComponentName: Name of the activity whose logo is to be retrieved. This value cannot be null.
Return
Drawable? Returns the image of the logo or null if the activity has no logo specified.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for the given activity could not be loaded.

getActivityLogo

Added in API level 9
Deprecated in API level 24
open fun getActivityLogo(intent: Intent): Drawable?

Deprecated: Deprecated in Java.

Parameters
intent Intent: The intent for which you would like to retrieve a logo. This value cannot be null.
Return
Drawable? Returns the image of the logo, or null if the activity has no logo specified.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for application matching the given intent could not be loaded.

getAllIntentFilters

Added in API level 23
Deprecated in API level 24
open fun getAllIntentFilters(packageName: String!): MutableList<IntentFilter!>!

Deprecated: Deprecated in Java.

getAllPermissionGroups

Added in API level 1
open fun getAllPermissionGroups(flags: Int): MutableList<PermissionGroupInfo!>

Deprecated: Deprecated in Java.

Parameters
flags Int: Additional option flags to modify the data returned. Value is either 0 or android.content.pm.PackageManager#GET_META_DATA
Return
MutableList<PermissionGroupInfo!> Returns a list of PermissionGroupInfo containing information about all of the known permission groups. This value cannot be null.

getApplicationBanner

Added in API level 20
Deprecated in API level 24
open fun getApplicationBanner(info: ApplicationInfo): Drawable?

Deprecated: Deprecated in Java.

Parameters
info ApplicationInfo: Information about application being queried. This value cannot be null.
Return
Drawable? Returns the image of the banner or null if the application has no banner specified.

getApplicationBanner

Added in API level 20
Deprecated in API level 24
open fun getApplicationBanner(packageName: String): Drawable?

Deprecated: Deprecated in Java.

Parameters
packageName String: Name of the package whose application banner is to be retrieved. This value cannot be null.
Return
Drawable? Returns the image of the banner or null if the application has no banner specified.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded.

getApplicationEnabledSetting

Added in API level 1
open fun getApplicationEnabledSetting(packageName: String): Int

Deprecated: Deprecated in Java.

Parameters
packageName String: The package name of the application to retrieve. This value cannot be null.
Return
Int Returns the current enabled state for the application. Value is android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DEFAULT, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_ENABLED, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_USER, or android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
Exceptions
java.lang.IllegalArgumentException if the named package does not exist.

getApplicationIcon

Added in API level 1
open fun getApplicationIcon(info: ApplicationInfo): Drawable

Deprecated: Deprecated in Java.

Parameters
info ApplicationInfo: Information about application being queried. This value cannot be null.
Return
Drawable Returns the image of the icon, or the default application icon if it could not be found.

getApplicationIcon

Added in API level 1
open fun getApplicationIcon(packageName: String): Drawable

Deprecated: Deprecated in Java.

Parameters
packageName String: Name of the package whose application icon is to be retrieved. This value cannot be null.
Return
Drawable Returns the image of the icon, or the default application icon if it could not be found. Does not return null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded.

getApplicationInfo

Added in API level 1
open fun getApplicationInfo(
    packageName: String,
    flags: Int
): ApplicationInfo

Deprecated: Deprecated in Java.

Parameters
packageName String: The full name (i.e. com.google.apps.contacts) of an application. This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
ApplicationInfo An ApplicationInfo containing information about the package. If flag MATCH_UNINSTALLED_PACKAGES is set and if the package is not found in the list of installed applications, the application information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DELETE_KEEP_DATA flag set). This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

getApplicationLabel

Added in API level 1
open fun getApplicationLabel(info: ApplicationInfo): CharSequence

Deprecated: Deprecated in Java.

Parameters
info ApplicationInfo: The ApplicationInfo of the application to get the label of. This value cannot be null.
Return
CharSequence Returns a CharSequence containing the label associated with this application, or its name the item does not have a label. This value cannot be null.
Added in API level 9
Deprecated in API level 24
open fun getApplicationLogo(info: ApplicationInfo): Drawable?

Deprecated: Deprecated in Java.

Parameters
info ApplicationInfo: Information about application being queried. This value cannot be null.
Return
Drawable? Returns the image of the logo, or null if no logo is specified by the application.

getApplicationLogo

Added in API level 9
Deprecated in API level 24
open fun getApplicationLogo(packageName: String): Drawable?

Deprecated: Deprecated in Java.

Parameters
packageName String: Name of the package whose application logo is to be retrieved. This value cannot be null.
Return
Drawable? Returns the image of the logo, or null if no application logo has been specified.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded.

getComponentEnabledSetting

Added in API level 1
open fun getComponentEnabledSetting(componentName: ComponentName): Int

Deprecated: Deprecated in Java.

Parameters
componentName ComponentName: The component to retrieve. This value cannot be null.
Return
Int Returns the current enabled state for the component. Value is android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DEFAULT, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_ENABLED, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_USER, or android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED

getDefaultActivityIcon

Added in API level 1
open fun getDefaultActivityIcon(): Drawable

Deprecated: Deprecated in Java.

Return
Drawable Drawable Image of the icon. This value cannot be null.

getDrawable

Added in API level 1
open fun getDrawable(
    packageName: String,
    resid: Int,
    appInfo: ApplicationInfo?
): Drawable?

Deprecated: Deprecated in Java.

Parameters
packageName String: The name of the package that this icon is coming from. Cannot be null.
resid Int: The resource identifier of the desired image. Cannot be 0.
appInfo ApplicationInfo?: Overall information about packageName. This may be null, in which case the application information will be retrieved for you if needed; if you already have this information around, it can be much more efficient to supply it here.
Return
Drawable? Returns a Drawable holding the requested image. Returns null if an image could not be found for any reason.

getInstalledApplications

Added in API level 1
open fun getInstalledApplications(flags: Int): MutableList<ApplicationInfo!>

Deprecated: Deprecated in Java.

Parameters
flags Int: Additional option flags to modify the data returned.
Return
MutableList<ApplicationInfo!> A List of ApplicationInfo objects, one for each installed application. In the unlikely case there are no installed packages, an empty list is returned. If flag MATCH_UNINSTALLED_PACKAGES is set, the application information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DELETE_KEEP_DATA flag set). This value cannot be null.

getInstalledPackages

Added in API level 1
open fun getInstalledPackages(flags: Int): MutableList<PackageInfo!>

Deprecated: Deprecated in Java.

Parameters
flags Int: Additional option flags to modify the data returned.
Return
MutableList<PackageInfo!> A List of PackageInfo objects, one for each installed package, containing information about the package. In the unlikely case there are no installed packages, an empty list is returned. If flag MATCH_UNINSTALLED_PACKAGES is set, the package information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DELETE_KEEP_DATA flag set). This value cannot be null.

getInstallerPackageName

Added in API level 5
Deprecated in API level 24
open fun getInstallerPackageName(packageName: String): String?

Deprecated: Deprecated in Java.

Parameters
packageName String: The name of the package to query This value cannot be null.
Return
String? This value may be null.
Exceptions
java.lang.IllegalArgumentException if the given package name is not installed

getInstrumentationInfo

Added in API level 1
open fun getInstrumentationInfo(
    className: ComponentName,
    flags: Int
): InstrumentationInfo

Deprecated: Deprecated in Java.

Parameters
className ComponentName: The full name (i.e. com.google.apps.contacts.InstrumentList) of an Instrumentation class. This value cannot be null.
flags Int: Additional option flags to modify the data returned. Value is either 0 or android.content.pm.PackageManager#GET_META_DATA
Return
InstrumentationInfo An InstrumentationInfo object containing information about the instrumentation. This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

getLaunchIntentForPackage

Added in API level 3
Deprecated in API level 24
open fun getLaunchIntentForPackage(packageName: String): Intent?

Deprecated: Deprecated in Java.

Parameters
packageName String: The name of the package to inspect. This value cannot be null.
Return
Intent? A fully-qualified Intent that can be used to launch the main activity in the package. Returns null if the package does not contain such an activity, or if packageName is not recognized.

getLeanbackLaunchIntentForPackage

Added in API level 21
Deprecated in API level 24
open fun getLeanbackLaunchIntentForPackage(packageName: String): Intent?

Deprecated: Deprecated in Java.

Parameters
packageName String: The name of the package to inspect. This value cannot be null.
Return
Intent? Returns either a fully-qualified Intent that can be used to launch the main Leanback activity in the package, or null if the package does not contain such an activity.

getNameForUid

Added in API level 1
open fun getNameForUid(uid: Int): String?

Deprecated: Deprecated in Java.

Parameters
uid Int: The uid for which you would like to retrieve a name.
Return
String? Returns a unique name for the given uid, or null if the uid is not currently assigned.

getPackageArchiveInfo

Added in API level 1
open fun getPackageArchiveInfo(
    archiveFilePath: String,
    flags: Int
): PackageInfo?

Deprecated: Deprecated in Java.

Parameters
archiveFilePath String: The path to the archive file This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
PackageInfo? A PackageInfo object containing information about the package archive. If the package could not be parsed, returns null.

getPackageGids

Added in API level 1
open fun getPackageGids(packageName: String): IntArray!

Deprecated: Deprecated in Java.

Parameters
packageName String: The full name (i.e. com.google.apps.contacts) of the desired package. This value cannot be null.
Return
IntArray! Returns an int array of the assigned GIDs, or null if there are none.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if no such package is available to the caller.

getPackageGids

Added in API level 24
Deprecated in API level 24
open fun getPackageGids(
    packageName: String,
    flags: Int
): IntArray!

Deprecated: Deprecated in Java.

Parameters
packageName String: The full name (i.e. com.google.apps.contacts) of the desired package. This value cannot be null.
Return
IntArray! Returns an int array of the assigned gids, or null if there are none.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if no such package is available to the caller.

getPackageInfo

Added in API level 1
open fun getPackageInfo(
    packageName: String,
    flags: Int
): PackageInfo!

Deprecated: Deprecated in Java.

Parameters
packageName String: The full name (i.e. com.google.apps.contacts) of the desired package. This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
PackageInfo! A PackageInfo object containing information about the package. If flag MATCH_UNINSTALLED_PACKAGES is set and if the package is not found in the list of installed applications, the package information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DELETE_KEEP_DATA flag set).
Exceptions
android.content.pm.PackageManager.NameNotFoundException if no such package is available to the caller.

getPackageInfo

Added in API level 26
Deprecated in API level 24
open fun getPackageInfo(
    versionedPackage: VersionedPackage,
    flags: Int
): PackageInfo!

Deprecated: Deprecated in Java.

Parameters
versionedPackage VersionedPackage: The versioned package for which to query. This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
PackageInfo! A PackageInfo object containing information about the package. If flag MATCH_UNINSTALLED_PACKAGES is set and if the package is not found in the list of installed applications, the package information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DELETE_KEEP_DATA flag set).
Exceptions
android.content.pm.PackageManager.NameNotFoundException if no such package is available to the caller.

getPackageInstaller

open fun getPackageInstaller(): PackageInstaller

Deprecated: Deprecated in Java.

{@hide}

Return
PackageInstaller This value cannot be null.

getPackageUid

Added in API level 24
Deprecated in API level 24
open fun getPackageUid(
    packageName: String,
    flags: Int
): Int

Deprecated: Deprecated in Java.

Parameters
packageName String: The full name (i.e. com.google.apps.contacts) of the desired package. This value cannot be null.
Return
Int Returns an integer UID who owns the given package name.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if no such package is available to the caller.

getPackagesForUid

Added in API level 1
open fun getPackagesForUid(uid: Int): Array<String!>?

Deprecated: Deprecated in Java.

Parameters
uid Int: The user id for which you would like to retrieve the associated packages.
Return
Array<String!>? Returns an array of one or more packages assigned to the user id, or null if there are no known packages with the given id.

getPackagesHoldingPermissions

Added in API level 18
Deprecated in API level 24
open fun getPackagesHoldingPermissions(
    permissions: Array<String!>,
    flags: Int
): MutableList<PackageInfo!>

Deprecated: Deprecated in Java.

Parameters
flags Int: Additional option flags to modify the data returned.
permissions Array<String!>: This value cannot be null.
Return
MutableList<PackageInfo!> A List of PackageInfo objects, one for each installed package that holds any of the permissions that were provided, containing information about the package. If no installed packages hold any of the permissions, an empty list is returned. If flag MATCH_UNINSTALLED_PACKAGES is set, the package information is retrieved from the list of uninstalled applications (which includes installed applications as well as applications with data directory i.e. applications which had been deleted with DELETE_KEEP_DATA flag set). This value cannot be null.

getPermissionGroupInfo

Added in API level 1
open fun getPermissionGroupInfo(
    name: String,
    flags: Int
): PermissionGroupInfo

Deprecated: Deprecated in Java.

Parameters
groupName The fully qualified name (i.e. com.google.permission_group.APPS) of the permission you are interested in. This value cannot be null.
flags Int: Additional option flags to modify the data returned. Value is either 0 or android.content.pm.PackageManager#GET_META_DATA
Return
PermissionGroupInfo Returns a PermissionGroupInfo containing information about the permission. This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

getPermissionInfo

Added in API level 1
open fun getPermissionInfo(
    name: String,
    flags: Int
): PermissionInfo!

Deprecated: Deprecated in Java.

Parameters
permName The fully qualified name (i.e. com.google.permission.LOGIN) of the permission you are interested in. This value cannot be null.
flags Int: Additional option flags to modify the data returned. Value is either 0 or android.content.pm.PackageManager#GET_META_DATA
Return
PermissionInfo! Returns a PermissionInfo containing information about the permission.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

getPreferredActivities

Added in API level 1
open fun getPreferredActivities(
    outFilters: MutableList<IntentFilter!>,
    outActivities: MutableList<ComponentName!>,
    packageName: String?
): Int

Deprecated: Deprecated in Java.

Parameters
outFilters MutableList<IntentFilter!>: A required list in which to place the filters of all of the preferred activities. This value cannot be null.
outActivities MutableList<ComponentName!>: A required list in which to place the component names of all of the preferred activities. This value cannot be null.
packageName String?: An optional package in which you would like to limit the list. If null, all activities will be returned; if non-null, only those activities in the given package are returned.
Return
Int Returns the total number of registered preferred activities (the number of distinct IntentFilter records, not the number of unique activity components) that were found.

getPreferredPackages

Added in API level 1
open fun getPreferredPackages(flags: Int): MutableList<PackageInfo!>

Deprecated: Deprecated in Java.

Parameters
flags Int: Additional option flags to modify the data returned.
Return
MutableList<PackageInfo!> A List of PackageInfo objects, one for each preferred application, in order of preference. This value cannot be null.

getProviderInfo

Added in API level 9
Deprecated in API level 24
open fun getProviderInfo(
    className: ComponentName,
    flags: Int
): ProviderInfo

Deprecated: Deprecated in Java.

Parameters
component The full component name (i.e. com.google.providers.media/com.google.providers.media. MediaProvider) of a ContentProvider class. This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
ProviderInfo A ProviderInfo object containing information about the provider. This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

getReceiverInfo

Added in API level 1
open fun getReceiverInfo(
    className: ComponentName,
    flags: Int
): ActivityInfo

Deprecated: Deprecated in Java.

Parameters
component The full component name (i.e. com.google.apps.calendar/com.google.apps.calendar. CalendarAlarm) of a Receiver class. This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
ActivityInfo An ActivityInfo containing information about the receiver. This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if a package with the given name cannot be found on the system.

getResourcesForActivity

Added in API level 1
open fun getResourcesForActivity(activityName: ComponentName): Resources

Deprecated: Deprecated in Java.

Parameters
activityName ComponentName: Name of the activity whose resources are to be retrieved. This value cannot be null.
Return
Resources Returns the application's Resources. This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded.

getResourcesForApplication

Added in API level 1
open fun getResourcesForApplication(app: ApplicationInfo): Resources

Deprecated: Deprecated in Java.

Parameters
app ApplicationInfo: Information about the desired application. This value cannot be null.
Return
Resources Returns the application's Resources. This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded (most likely because it was uninstalled).

getResourcesForApplication

Added in API level 1
open fun getResourcesForApplication(appPackageName: String): Resources

Deprecated: Deprecated in Java.

Parameters
packageName Package name of the application whose resources are to be retrieved. This value cannot be null.
Return
Resources Returns the application's Resources. This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException Thrown if the resources for the given application could not be loaded.

getServiceInfo

Added in API level 1
open fun getServiceInfo(
    className: ComponentName,
    flags: Int
): ServiceInfo

Deprecated: Deprecated in Java.

Parameters
component The full component name (i.e. com.google.apps.media/com.google.apps.media. BackgroundPlayback) of a Service class. This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
ServiceInfo A ServiceInfo object containing information about the service. This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if the component cannot be found on the system.

getSharedLibraries

Added in API level 26
Deprecated in API level 24
open fun getSharedLibraries(flags: Int): MutableList<SharedLibraryInfo!>

Deprecated: Deprecated in Java.

Get a list of shared libraries on the device. Use getSharedLibraries(android.content.pm.PackageManager.PackageInfoFlags) when long flags are needed.

Parameters
flags Int: To filter the libraries to return.
Return
MutableList<SharedLibraryInfo!> This value cannot be null.

getSystemAvailableFeatures

Added in API level 5
Deprecated in API level 24
open fun getSystemAvailableFeatures(): Array<FeatureInfo!>

Deprecated: Deprecated in Java.

Return
Array<FeatureInfo!> An array of FeatureInfo classes describing the features that are available on the system, or null if there are none(!!).

getSystemSharedLibraryNames

Added in API level 3
Deprecated in API level 24
open fun getSystemSharedLibraryNames(): Array<String!>?

Deprecated: Deprecated in Java.

Return
Array<String!>? An array of shared library names that are available on the system, or null if none are installed.

getText

Added in API level 1
open fun getText(
    packageName: String,
    resid: Int,
    appInfo: ApplicationInfo?
): CharSequence?

Deprecated: Deprecated in Java.

Parameters
packageName String: The name of the package that this text is coming from. Cannot be null.
resid Int: The resource identifier of the desired text. Cannot be 0.
appInfo ApplicationInfo?: Overall information about packageName. This may be null, in which case the application information will be retrieved for you if needed; if you already have this information around, it can be much more efficient to supply it here.
Return
CharSequence? Returns a CharSequence holding the requested text. Returns null if the text could not be found for any reason.

getUserBadgedDrawableForDensity

Added in API level 21
Deprecated in API level 24
open fun getUserBadgedDrawableForDensity(
    drawable: Drawable,
    user: UserHandle,
    badgeLocation: Rect?,
    badgeDensity: Int
): Drawable

Deprecated: Deprecated in Java.

Parameters
drawable Drawable: The drawable to badge. This value cannot be null.
user UserHandle: The target user. This value cannot be null.
badgeLocation Rect?: Where in the bounds of the badged drawable to place the badge. If it's null, the badge is applied on top of the entire drawable being badged.
badgeDensity Int: The optional desired density for the badge as per android.util.DisplayMetrics#densityDpi. If it's not positive, the density of the display is used.
Return
Drawable A drawable that combines the original drawable and a badge as determined by the system. This value cannot be null.

getUserBadgedIcon

Added in API level 21
Deprecated in API level 24
open fun getUserBadgedIcon(
    icon: Drawable,
    user: UserHandle
): Drawable

Deprecated: Deprecated in Java.

Parameters
drawable The drawable to badge. This value cannot be null.
user UserHandle: The target user. This value cannot be null.
Return
Drawable A drawable that combines the original icon and a badge as determined by the system. This value cannot be null.

getUserBadgedLabel

Added in API level 21
Deprecated in API level 24
open fun getUserBadgedLabel(
    label: CharSequence,
    user: UserHandle
): CharSequence

Deprecated: Deprecated in Java.

Parameters
label CharSequence: The label to change. This value cannot be null.
user UserHandle: The target user. This value cannot be null.
Return
CharSequence A label that combines the original label and a badge as determined by the system. This value cannot be null.

getXml

Added in API level 1
open fun getXml(
    packageName: String,
    resid: Int,
    appInfo: ApplicationInfo?
): XmlResourceParser?

Deprecated: Deprecated in Java.

Parameters
packageName String: The name of the package that this xml is coming from. Cannot be null.
resid Int: The resource identifier of the desired xml. Cannot be 0.
appInfo ApplicationInfo?: Overall information about packageName. This may be null, in which case the application information will be retrieved for you if needed; if you already have this information around, it can be much more efficient to supply it here.
Return
XmlResourceParser? Returns an XmlPullParser allowing you to parse out the XML data. Returns null if the xml resource could not be found for any reason.

hasSigningCertificate

Added in API level 28
Deprecated in API level 24
open fun hasSigningCertificate(
    packageName: String,
    certificate: ByteArray,
    type: Int
): Boolean

Deprecated: Deprecated in Java.

Searches the set of signing certificates by which the given package has proven to have been signed. This should be used instead of getPackageInfo with GET_SIGNATURES since it takes into account the possibility of signing certificate rotation, except in the case of packages that are signed by multiple certificates, for which signing certificate rotation is not supported. This method is analogous to using getPackageInfo with GET_SIGNING_CERTIFICATES and then searching through the resulting signingInfo field to see if the desired certificate is present.

Parameters
packageName String: package whose signing certificates to check This value cannot be null.
certificate ByteArray: signing certificate for which to search This value cannot be null.
type Int: Value is android.content.pm.PackageManager#CERT_INPUT_RAW_X509, or android.content.pm.PackageManager#CERT_INPUT_SHA256
Return
Boolean true if this package was or is signed by exactly the certificate certificate

hasSigningCertificate

Added in API level 28
Deprecated in API level 24
open fun hasSigningCertificate(
    uid: Int,
    certificate: ByteArray,
    type: Int
): Boolean

Deprecated: Deprecated in Java.

Searches the set of signing certificates by which the package(s) for the given uid has proven to have been signed. For multiple packages sharing the same uid, this will return the signing certificates found in the signing history of the "newest" package, where "newest" indicates the package with the newest signing certificate in the shared uid group. This method should be used instead of getPackageInfo with GET_SIGNATURES since it takes into account the possibility of signing certificate rotation, except in the case of packages that are signed by multiple certificates, for which signing certificate rotation is not supported. This method is analogous to using getPackagesForUid followed by getPackageInfo with GET_SIGNING_CERTIFICATES, selecting the PackageInfo of the newest-signed bpackage , and finally searching through the resulting signingInfo field to see if the desired certificate is there.

Parameters
uid Int: uid whose signing certificates to check
certificate ByteArray: signing certificate for which to search This value cannot be null.
type Int: Value is android.content.pm.PackageManager#CERT_INPUT_RAW_X509, or android.content.pm.PackageManager#CERT_INPUT_SHA256
Return
Boolean true if this package was or is signed by exactly the certificate certificate

hasSystemFeature

Added in API level 5
Deprecated in API level 24
open fun hasSystemFeature(name: String): Boolean

Deprecated: Deprecated in Java.

Parameters
featureName This value cannot be null.
Return
Boolean Returns true if the devices supports the feature, else false.

hasSystemFeature

Added in API level 24
Deprecated in API level 24
open fun hasSystemFeature(
    name: String,
    version: Int
): Boolean

Deprecated: Deprecated in Java.

Parameters
featureName This value cannot be null.
Return
Boolean Returns true if the devices supports the feature, else false.

isPermissionRevokedByPolicy

Added in API level 23
Deprecated in API level 24
open fun isPermissionRevokedByPolicy(
    permName: String,
    pkgName: String
): Boolean

Deprecated: Deprecated in Java.

Parameters
permName String: The name of the permission you are checking for. This value cannot be null.
packageName The name of the package you are checking against. This value cannot be null.
Return
Boolean Whether the permission is restricted by policy.

isSafeMode

Added in API level 3
Deprecated in API level 24
open fun isSafeMode(): Boolean

Deprecated: Deprecated in Java.

queryBroadcastReceivers

Added in API level 1
open fun queryBroadcastReceivers(
    intent: Intent,
    flags: Int
): MutableList<ResolveInfo!>

Deprecated: Deprecated in Java.

Parameters
intent Intent: The desired intent as per resolveActivity(). This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
MutableList<ResolveInfo!> Returns a List of ResolveInfo objects containing one entry for each matching receiver, ordered from best to worst. If there are no matching receivers, an empty list or null is returned.

queryContentProviders

Added in API level 1
open fun queryContentProviders(
    processName: String?,
    uid: Int,
    flags: Int
): MutableList<ProviderInfo!>

Deprecated: Deprecated in Java.

Parameters
processName String?: If non-null, limits the returned providers to only those that are hosted by the given process. If null, all content providers are returned.
uid Int: If processName is non-null, this is the required uid owning the requested content providers.
flags Int: Additional option flags to modify the data returned.
Return
MutableList<ProviderInfo!> A list of ProviderInfo objects containing one entry for each provider either matching processName or, if processName is null, all known content providers. If there are no matching providers, null is returned.

queryInstrumentation

Added in API level 1
open fun queryInstrumentation(
    targetPackage: String,
    flags: Int
): MutableList<InstrumentationInfo!>

Deprecated: Deprecated in Java.

Parameters
targetPackage String: If null, all instrumentation is returned; only the instrumentation targeting this package name is returned.
flags Int: Additional option flags to modify the data returned. Value is either 0 or android.content.pm.PackageManager#GET_META_DATA
Return
MutableList<InstrumentationInfo!> A list of InstrumentationInfo objects containing one entry for each matching instrumentation. If there are no instrumentation available, returns an empty list. This value cannot be null.

queryIntentActivities

Added in API level 1
open fun queryIntentActivities(
    intent: Intent,
    flags: Int
): MutableList<ResolveInfo!>

Deprecated: Deprecated in Java.

Parameters
intent Intent: The desired intent as per resolveActivity(). This value cannot be null.
flags Int: Additional option flags to modify the data returned. The most important is MATCH_DEFAULT_ONLY, to limit the resolution to only those activities that support the android.content.Intent#CATEGORY_DEFAULT. Or, set MATCH_ALL to prevent any filtering of the results.
Return
MutableList<ResolveInfo!> Returns a List of ResolveInfo objects containing one entry for each matching activity, ordered from best to worst. In other words, the first item is what would be returned by #resolveActivity. If there are no matching activities, an empty list is returned. This value cannot be null.

queryIntentActivityOptions

Added in API level 1
open fun queryIntentActivityOptions(
    caller: ComponentName?,
    specifics: Array<Intent!>?,
    intent: Intent,
    flags: Int
): MutableList<ResolveInfo!>

Deprecated: Deprecated in Java.

Parameters
caller ComponentName?: The class name of the activity that is making the request. This activity will never appear in the output list. Can be null.
specifics Array<Intent!>?: An array of Intents that should be resolved to the first specific results. Can be null.
intent Intent: The desired intent as per resolveActivity(). This value cannot be null.
flags Int: Additional option flags to modify the data returned. The most important is MATCH_DEFAULT_ONLY, to limit the resolution to only those activities that support the android.content.Intent#CATEGORY_DEFAULT.
Return
MutableList<ResolveInfo!> Returns a List of ResolveInfo objects containing one entry for each matching activity. The list is ordered first by all of the intents resolved in specifics and then any additional activities that can handle intent but did not get included by one of the specifics intents. If there are no matching activities, an empty list is returned. This value cannot be null.

queryIntentContentProviders

Added in API level 19
Deprecated in API level 24
open fun queryIntentContentProviders(
    intent: Intent,
    flags: Int
): MutableList<ResolveInfo!>

Deprecated: Deprecated in Java.

Parameters
intent Intent: An intent containing all of the desired specification (action, data, type, category, and/or component). This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
MutableList<ResolveInfo!> Returns a List of ResolveInfo objects containing one entry for each matching provider, ordered from best to worst. If there are no matching services, an empty list or null is returned.

queryIntentServices

Added in API level 1
open fun queryIntentServices(
    intent: Intent,
    flags: Int
): MutableList<ResolveInfo!>

Deprecated: Deprecated in Java.

Parameters
intent Intent: The desired intent as per resolveService(). This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
MutableList<ResolveInfo!> Returns a List of ResolveInfo objects containing one entry for each matching service, ordered from best to worst. In other words, the first item is what would be returned by #resolveService. If there are no matching services, an empty list or null is returned.

queryPermissionsByGroup

Added in API level 1
open fun queryPermissionsByGroup(
    group: String?,
    flags: Int
): MutableList<PermissionInfo!>

Deprecated: Deprecated in Java.

Parameters
permissionGroup The fully qualified name (i.e. com.google.permission.LOGIN) of the permission group you are interested in. Use null to find all of the permissions not associated with a group.
flags Int: Additional option flags to modify the data returned. Value is either 0 or android.content.pm.PackageManager#GET_META_DATA
Return
MutableList<PermissionInfo!> Returns a list of PermissionInfo containing information about all of the permissions in the given group. This value cannot be null.
Exceptions
android.content.pm.PackageManager.NameNotFoundException if a group with the given name cannot be found on the system.

removePackageFromPreferred

Added in API level 1
open fun removePackageFromPreferred(packageName: String): Unit

Deprecated: Deprecated in Java.

Parameters
packageName String: This value cannot be null.

removePermission

Added in API level 1
open fun removePermission(name: String): Unit

Deprecated: Deprecated in Java.

Parameters
permName The name of the permission to remove. This value cannot be null.
Exceptions
java.lang.SecurityException if you are not allowed to remove the given permission name.

resolveActivity

Added in API level 1
open fun resolveActivity(
    intent: Intent,
    flags: Int
): ResolveInfo?

Deprecated: Deprecated in Java.

Parameters
intent Intent: An intent containing all of the desired specification (action, data, type, category, and/or component). This value cannot be null.
flags Int: Additional option flags to modify the data returned. The most important is MATCH_DEFAULT_ONLY, to limit the resolution to only those activities that support the android.content.Intent#CATEGORY_DEFAULT.
Return
ResolveInfo? Returns a ResolveInfo object containing the final activity intent that was determined to be the best action. Returns null if no matching activity was found. If multiple matching activities are found and there is no default set, returns a ResolveInfo object containing something else, such as the activity resolver.

resolveContentProvider

Added in API level 1
open fun resolveContentProvider(
    name: String,
    flags: Int
): ProviderInfo?

Deprecated: Deprecated in Java.

Parameters
authority The authority of the provider to find. This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
ProviderInfo? A ProviderInfo object containing information about the provider. If a provider was not found, returns null.

resolveService

Added in API level 1
open fun resolveService(
    intent: Intent,
    flags: Int
): ResolveInfo?

Deprecated: Deprecated in Java.

Parameters
intent Intent: An intent containing all of the desired specification (action, data, type, category, and/or component). This value cannot be null.
flags Int: Additional option flags to modify the data returned.
Return
ResolveInfo? Returns a ResolveInfo object containing the final service intent that was determined to be the best action. Returns null if no matching service was found.

resolveServiceAsUser

Added in API level 1
open fun resolveServiceAsUser(
    intent: Intent!,
    flags: Int,
    userId: Int
): ResolveInfo!

Deprecated: Deprecated in Java.

setApplicationEnabledSetting

Added in API level 1
open fun setApplicationEnabledSetting(
    packageName: String,
    newState: Int,
    flags: Int
): Unit

Deprecated: Deprecated in Java.

Parameters
packageName String: The package name of the application to enable This value cannot be null.
newState Int: The new enabled state for the application. Value is android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DEFAULT, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_ENABLED, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_USER, or android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
flags Int: Optional behavior flags. Value is either 0 or a combination of android.content.pm.PackageManager#DONT_KILL_APP, and android.content.pm.PackageManager#SYNCHRONOUS

setComponentEnabledSetting

Added in API level 1
open fun setComponentEnabledSetting(
    componentName: ComponentName,
    newState: Int,
    flags: Int
): Unit

Deprecated: Deprecated in Java.

Parameters
componentName ComponentName: The component to enable This value cannot be null.
newState Int: The new enabled state for the component. Value is android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DEFAULT, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_ENABLED, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED, android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_USER, or android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED
flags Int: Optional behavior flags. Value is either 0 or a combination of android.content.pm.PackageManager#DONT_KILL_APP, and android.content.pm.PackageManager#SYNCHRONOUS

setInstallerPackageName

Added in API level 11
Deprecated in API level 24
open fun setInstallerPackageName(
    targetPackage: String,
    installerPackageName: String?
): Unit

Deprecated: Deprecated in Java.

Parameters
targetPackage String: The installed package whose installer will be changed. This value cannot be null.
installerPackageName String?: The package name of the new installer. May be null to clear the association.

verifyPendingInstall

Added in API level 14
Deprecated in API level 24
open fun verifyPendingInstall(
    id: Int,
    verificationCode: Int
): Unit

Deprecated: Deprecated in Java.

Parameters
id Int: pending package identifier as passed via the PackageManager#EXTRA_VERIFICATION_ID Intent extra.
verificationCode Int: either PackageManager#VERIFICATION_ALLOW or PackageManager#VERIFICATION_REJECT.
Exceptions
java.lang.SecurityException if the caller does not have the PACKAGE_VERIFICATION_AGENT permission.