MockPackageManager
open classMockPackageManager: 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 |
addPackageToPreferred(packageName: String) |
| open Boolean |
addPermission(info: PermissionInfo)Add a new dynamic permission to the system. |
| open Boolean |
addPermissionAsync(info: PermissionInfo)Like |
| open Unit |
addPreferredActivity(filter: IntentFilter, match: Int, set: Array<ComponentName!>?, activity: ComponentName)Add a new preferred activity mapping to the system. |
| open Boolean |
addWhitelistedRestrictedPermission(packageName: String, permission: String, whitelistFlags: Int) |
| open Boolean |
Checks whether the calling package is allowed to request package installs through package installer. |
| open Array<String!>! |
canonicalToCurrentPackageNames(names: Array<String!>)Map from a packages canonical name to the current name in use on the device. |
| open Int |
checkPermission(permName: String, pkgName: String)Check whether a particular package has been granted a particular permission. |
| open Int |
checkSignatures(uid1: Int, uid2: Int)Like |
| open Int |
checkSignatures(pkg1: String, pkg2: String)Compare the signatures of two packages to determine if the same signature appears in both of them. |
| open Unit | |
| open Unit |
clearPackagePreferredActivities(packageName: String)Remove all preferred activity mappings, previously added with |
| open Array<String!>! |
currentToCanonicalPackageNames(names: Array<String!>)Map from the current package names in use on the device to whatever the current canonical name of that package is. |
| open Unit |
extendVerificationTimeout(id: Int, verificationCodeAtTimeout: Int, millisecondsToDelay: Long)Allows a package listening to the |
| open Drawable? |
getActivityBanner(activityName: ComponentName)Retrieve the banner associated with an activity. |
| open Drawable? |
getActivityBanner(intent: Intent)Retrieve the banner associated with an Intent. |
| open Drawable |
getActivityIcon(activityName: ComponentName)Retrieve the icon associated with an activity. |
| open Drawable |
getActivityIcon(intent: Intent)Retrieve the icon associated with an Intent. |
| open ActivityInfo |
getActivityInfo(className: ComponentName, flags: Int)Retrieve all of the information we know about a particular activity class. |
| open Drawable? |
getActivityLogo(activityName: ComponentName)Retrieve the logo associated with an activity. |
| open Drawable? |
getActivityLogo(intent: Intent)Retrieve the logo associated with an Intent. |
| open MutableList<IntentFilter!>! |
getAllIntentFilters(packageName: String!) |
| open MutableList<PermissionGroupInfo!> |
getAllPermissionGroups(flags: Int)Retrieve all of the known permission groups in the system. |
| open Drawable? |
Retrieve the banner associated with an application. |
| open Drawable? |
getApplicationBanner(packageName: String)Retrieve the banner associated with an application. |
| open Int |
getApplicationEnabledSetting(packageName: String)Return the enabled setting for an application. |
| open Drawable |
Retrieve the icon associated with an application. |
| open Drawable |
getApplicationIcon(packageName: String)Retrieve the icon associated with an application. |
| open ApplicationInfo |
getApplicationInfo(packageName: String, flags: Int)Retrieve all of the information we know about a particular package/application. |
| open CharSequence |
Return the label to use for this application. |
| open Drawable? |
Retrieve the logo associated with an application. |
| open Drawable? |
getApplicationLogo(packageName: String)Retrieve the logo associated with an application. |
| open ChangedPackages? |
getChangedPackages(sequenceNumber: Int) |
| open Int |
getComponentEnabledSetting(componentName: ComponentName)Return the enabled setting for a package component (activity, receiver, service, provider). |
| open Drawable |
Return the generic icon for an activity that is used when no specific icon is defined. |
| open Drawable? |
getDrawable(packageName: String, resid: Int, appInfo: ApplicationInfo?)Retrieve an image from a package. |
| open MutableList<ApplicationInfo!> |
getInstalledApplications(flags: Int)Return a List of all application packages that are installed for the current user. |
| open MutableList<PackageInfo!> |
getInstalledPackages(flags: Int)Return a List of all packages that are installed for the current user. |
| open String? |
getInstallerPackageName(packageName: String)Retrieve the package name of the application that installed a package. |
| open ByteArray | |
| open Int | |
| open InstrumentationInfo |
getInstrumentationInfo(className: ComponentName, flags: Int)Retrieve all of the information we know about a particular instrumentation class. |
| open Intent? |
getLaunchIntentForPackage(packageName: String)Returns a "good" intent to launch a front-door activity in a package. |
| open Intent? |
getLeanbackLaunchIntentForPackage(packageName: String)Return a "good" intent to launch a front-door Leanback activity in a package, for use for example to implement an "open" button when browsing through packages. |
| open String? |
getNameForUid(uid: Int)Retrieve the official name associated with a uid. |
| open PackageInfo? |
getPackageArchiveInfo(archiveFilePath: String, flags: Int)Retrieve overall information about an application package defined in a package archive file Use |
| open IntArray! |
getPackageGids(packageName: String)Return an array of all of the POSIX secondary group IDs that have been assigned to the given package. |
| open IntArray! |
getPackageGids(packageName: String, flags: Int)Return an array of all of the POSIX secondary group IDs that have been assigned to the given package. |
| open PackageInfo! |
getPackageInfo(versionedPackage: VersionedPackage, flags: Int)Retrieve overall information about an application package that is installed on the system. |
| open PackageInfo! |
getPackageInfo(packageName: String, flags: Int)Retrieve overall information about an application package that is installed on the system. |
| open PackageInstaller | |
| open Int |
getPackageUid(packageName: String, flags: Int)Return the UID associated with the given package name. |
| open Array<String!>? |
getPackagesForUid(uid: Int)Retrieve the names of all packages that are associated with a particular user id. |
| open MutableList<PackageInfo!> |
getPackagesHoldingPermissions(permissions: Array<String!>, flags: Int)Return a List of all installed packages that are currently holding any of the given permissions. |
| open PermissionGroupInfo |
getPermissionGroupInfo(name: String, flags: Int)Retrieve all of the information we know about a particular group of permissions. |
| open PermissionInfo! |
getPermissionInfo(name: String, flags: Int)Retrieve all of the information we know about a particular permission. |
| open Int |
getPreferredActivities(outFilters: MutableList<IntentFilter!>, outActivities: MutableList<ComponentName!>, packageName: String?)Retrieve all preferred activities, previously added with |
| open MutableList<PackageInfo!> |
getPreferredPackages(flags: Int)Retrieve the list of all currently configured preferred packages. |
| open ProviderInfo |
getProviderInfo(className: ComponentName, flags: Int)Retrieve all of the information we know about a particular content provider class. |
| open ActivityInfo |
getReceiverInfo(className: ComponentName, flags: Int)Retrieve all of the information we know about a particular receiver class. |
| open Resources |
getResourcesForActivity(activityName: ComponentName)Retrieve the resources associated with an activity. |
| open Resources |
Retrieve the resources for an application. |
| open Resources |
getResourcesForApplication(appPackageName: String)Retrieve the resources associated with an application. |
| open ServiceInfo |
getServiceInfo(className: ComponentName, flags: Int)Retrieve all of the information we know about a particular service class. |
| open MutableList<SharedLibraryInfo!> |
Get a list of shared libraries on the device. |
| open Array<FeatureInfo!> |
Get a list of features that are available on the system. |
| open Array<String!>? |
Get a list of shared libraries that are available on the system. |
| open CharSequence? |
getText(packageName: String, resid: Int, appInfo: ApplicationInfo?)Retrieve text from a package. |
| open Drawable |
getUserBadgedDrawableForDensity(drawable: Drawable, user: UserHandle, badgeLocation: Rect?, badgeDensity: Int)If the target user is a managed profile of the calling user or the caller is itself a managed profile, then this returns a badged copy of the given drawable allowing the user to distinguish it from the original drawable. |
| open Drawable |
getUserBadgedIcon(icon: Drawable, user: UserHandle)If the target user is a managed profile, then this returns a badged copy of the given icon to be able to distinguish it from the original icon. |
| open CharSequence |
getUserBadgedLabel(label: CharSequence, user: UserHandle)If the target user is a managed profile of the calling user or the caller is itself a managed profile, then this returns a copy of the label with badging for accessibility services like talkback. |
| open MutableSet<String!> |
getWhitelistedRestrictedPermissions(packageName: String, whitelistFlags: Int) |
| open XmlResourceParser? |
getXml(packageName: String, resid: Int, appInfo: ApplicationInfo?)Retrieve an XML file from a package. |
| 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 |
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 |
hasSystemFeature(name: String)Check whether the given feature name is one of the available features as returned by |
| open Boolean |
hasSystemFeature(name: String, version: Int)Check whether the given feature name and version is one of the available features as returned by |
| open Boolean | |
| open Boolean | |
| open Boolean |
isInstantApp(packageName: String) |
| open Boolean |
isPermissionRevokedByPolicy(permName: String, pkgName: String)Checks whether a particular permissions has been revoked for a package by policy. |
| open Boolean |
Return whether the device has been booted into safe mode. |
| open MutableList<ResolveInfo!> |
queryBroadcastReceivers(intent: Intent, flags: Int)Retrieve all receivers that can handle a broadcast of the given intent. |
| open MutableList<ProviderInfo!> |
queryContentProviders(processName: String?, uid: Int, flags: Int)Retrieve content provider information. |
| open MutableList<InstrumentationInfo!> |
queryInstrumentation(targetPackage: String, flags: Int)Retrieve information about available instrumentation code. |
| open MutableList<ResolveInfo!> |
queryIntentActivities(intent: Intent, flags: Int)Retrieve all activities that can be performed for the given intent. |
| open MutableList<ResolveInfo!> |
queryIntentActivityOptions(caller: ComponentName?, specifics: Array<Intent!>?, intent: Intent, flags: Int)Retrieve a set of activities that should be presented to the user as similar options. |
| open MutableList<ResolveInfo!> |
queryIntentContentProviders(intent: Intent, flags: Int)Retrieve all providers that can match the given intent. |
| open MutableList<ResolveInfo!> |
queryIntentServices(intent: Intent, flags: Int)Retrieve all services that can match the given intent. |
| open MutableList<PermissionInfo!> |
queryPermissionsByGroup(group: String?, flags: Int)Query for all of the permissions associated with a particular group. |
| open Unit |
removePackageFromPreferred(packageName: String) |
| open Unit |
removePermission(name: String)Removes a permission that was previously added with |
| open Boolean |
removeWhitelistedRestrictedPermission(packageName: String, permission: String, whitelistFlags: Int) |
| open ResolveInfo? |
resolveActivity(intent: Intent, flags: Int)Determine the best action to perform for a given Intent. |
| open ProviderInfo? |
resolveContentProvider(name: String, flags: Int)Find a single content provider by its authority. |
| open ResolveInfo? |
resolveService(intent: Intent, flags: Int)Determine the best service to handle for a given Intent. |
| open ResolveInfo! |
resolveServiceAsUser(intent: Intent!, flags: Int, userId: Int) |
| open Unit |
setApplicationCategoryHint(packageName: String, categoryHint: Int) |
| open Unit |
setApplicationEnabledSetting(packageName: String, newState: Int, flags: Int)Set the enabled setting for an application This setting will override any enabled state which may have been set by the application in its manifest. |
| open Unit |
setComponentEnabledSetting(componentName: ComponentName, newState: Int, flags: Int)Set the enabled setting for a package component (activity, receiver, service, provider). |
| open Unit |
setInstallerPackageName(targetPackage: String, installerPackageName: String?)Change the installer associated with a given package. |
| open Boolean |
setInstantAppCookie(cookie: ByteArray) |
| open Unit |
updateInstantAppCookie(cookie: ByteArray!) |
| open Unit |
verifyPendingInstall(id: Int, verificationCode: Int)Allows a package listening to the |
| Inherited functions | |
|---|---|
| Inherited properties | |
|---|---|
Public constructors
MockPackageManager
MockPackageManager()
Public methods
addPackageToPreferred
open funaddPackageToPreferred(packageName: String): Unit
Deprecated: Deprecated in Java.
| Parameters | |
|---|---|
packageName |
String: This value cannot be null. |
addPermission
open funaddPermission(info: PermissionInfo): Boolean
Deprecated: Deprecated in Java.
Add a new dynamic permission to the system. For this to work, your package must have defined a permission tree through the <permission-tree> tag in its manifest. A package can only add permissions to trees that were defined by either its own package or another with the same user id; a permission is in a tree if it matches the name of the permission tree + ".": for example, "com.foo.bar" is a member of the permission tree "com.foo".
It is good to make your permission tree name descriptive, because you are taking possession of that entire set of permission names. Thus, it must be under a domain you control, with a suffix that will not match any normal permissions that may be declared in any applications that are part of that domain.
New permissions must be added before any .apks are installed that use those permissions. Permissions you add through this method are remembered across reboots of the device. If the given permission already exists, the info you supply here will be used to update it.
| 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
open funaddPermissionAsync(info: PermissionInfo): Boolean
Deprecated: Deprecated in Java.
Like addPermission(android.content.pm.PermissionInfo) but asynchronously persists the package manager state after returning from the call, allowing it to return quicker and batch a series of adds at the expense of no guarantee the added permission will be retained if the device is rebooted before it is written.
| Parameters | |
|---|---|
info |
PermissionInfo: This value cannot be null. |
addPreferredActivity
open funaddPreferredActivity(
filter: IntentFilter,
match: Int,
set: Array<ComponentName!>?,
activity: ComponentName
): Unit
Deprecated: Deprecated in Java.
Add a new preferred activity mapping to the system. This will be used to automatically select the given activity component when Context.startActivity() finds multiple matching activities and also matches the given filter.
| 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. |
addWhitelistedRestrictedPermission
open funaddWhitelistedRestrictedPermission(
packageName: String,
permission: String,
whitelistFlags: Int
): Boolean
Deprecated: Deprecated in Java.
| Parameters | |
|---|---|
packageName |
String: The app for which to get whitelisted permissions. This value cannot be null. |
permName |
The whitelisted permission to add. This value cannot be null. |
whitelistFlags |
Int: The whitelists to which to add. Passing multiple flags updates all specified whitelists. Value is either 0 or a combination of the following:
|
| Return | |
|---|---|
Boolean |
Whether the permission was added to the whitelist. |
| Exceptions | |
|---|---|
java.lang.SecurityException |
if you try to modify a whitelist that you have no access to. |
canRequestPackageInstalls
open funcanRequestPackageInstalls(): Boolean
Deprecated: Deprecated in Java.
Checks whether the calling package is allowed to request package installs through package installer. Apps are encouraged to call this API before launching the package installer via intent android.content.Intent#ACTION_INSTALL_PACKAGE. Starting from Android O, the user can explicitly choose what external sources they trust to install apps on the device. If this API returns false, the install request will be blocked by the package installer and a dialog will be shown to the user with an option to launch settings to change their preference. An application must target Android O or higher and declare permission android.Manifest.permission#REQUEST_INSTALL_PACKAGES in order to use this API.
| Return | |
|---|---|
Boolean |
true if the calling package is trusted by the user to request install packages on the device, false otherwise. |
canonicalToCurrentPackageNames
open funcanonicalToCurrentPackageNames(names: Array<String!>): Array<String!>!
Deprecated: Deprecated in Java.
Map from a packages canonical name to the current name in use on the device.
| 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
open funcheckPermission(
permName: String,
pkgName: String
): Int
Deprecated: Deprecated in Java.
Check whether a particular package has been granted a particular permission.
Note: This API returns the underlying permission state as-is and is mostly intended for permission managing system apps. To perform an access check for a certain app, please use the Context.checkPermission APIs instead.
| 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 one of the following: |
checkSignatures
open funcheckSignatures(
uid1: Int,
uid2: Int
): Int
Deprecated: Deprecated in Java.
Like checkSignatures(java.lang.String,java.lang.String), but takes UIDs of the two packages to be checked. This can be useful, for example, when doing the check in an IPC, where the UID is the only identity available. It is functionally identical to determining the package associated with the UIDs and checking their signatures.
| 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 one of the following: |
checkSignatures
open funcheckSignatures(
pkg1: String,
pkg2: String
): Int
Deprecated: Deprecated in Java.
Compare the signatures of two packages to determine if the same signature appears in both of them. If they do contain the same signature, then they are allowed special privileges when working with each other: they can share the same user-id, run instrumentation against each other, etc.
| 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 one of the following: |
clearInstantAppCookie
open funclearInstantAppCookie(): Unit
Deprecated: Deprecated in Java.
clearPackagePreferredActivities
open funclearPackagePreferredActivities(packageName: String): Unit
Deprecated: Deprecated in Java.
Remove all preferred activity mappings, previously added with addPreferredActivity, from the system whose activities are implemented in the given package name. An application can only clear its own package(s).
| Parameters | |
|---|---|
packageName |
String: The name of the package whose preferred activity mappings are to be removed. This value cannot be null. |
currentToCanonicalPackageNames
open funcurrentToCanonicalPackageNames(names: Array<String!>): Array<String!>!
Deprecated: Deprecated in Java.
Map from the current package names in use on the device to whatever the current canonical name of that package is.
| 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
open funextendVerificationTimeout(
id: Int,
verificationCodeAtTimeout: Int,
millisecondsToDelay: Long
): Unit
Deprecated: Deprecated in Java.
Allows a package listening to the package verification to extend the default timeout for a response and declare what action to perform after the timeout occurs. The response must include the verificationCodeAtTimeout which is one of PackageManager.VERIFICATION_ALLOW or PackageManager.VERIFICATION_REJECT. This method may only be called once per package id. Additional calls will have no effect.
| 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
open fungetActivityBanner(activityName: ComponentName): Drawable?
Deprecated: Deprecated in Java.
Retrieve the banner associated with an activity. Given the full name of an activity, retrieves the information about it and calls ComponentInfo.loadIcon() to return its banner. If the activity cannot be found, NameNotFoundException is thrown.
| 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
open fungetActivityBanner(intent: Intent): Drawable?
Deprecated: Deprecated in Java.
Retrieve the banner associated with an Intent. If intent.getClassName() is set, this simply returns the result of getActivityBanner(intent.getClassName()). Otherwise it resolves the intent's component and returns the banner associated with the resolved component. If intent.getClassName() cannot be found or the Intent cannot be resolved to a component, NameNotFoundException is thrown.
| 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
open fungetActivityIcon(activityName: ComponentName): Drawable
Deprecated: Deprecated in Java.
Retrieve the icon associated with an activity. Given the full name of an activity, retrieves the information about it and calls ComponentInfo.loadIcon() to return its icon. If the activity cannot be found, NameNotFoundException is thrown.
| 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
open fungetActivityIcon(intent: Intent): Drawable
Deprecated: Deprecated in Java.
Retrieve the icon associated with an Intent. If intent.getClassName() is set, this simply returns the result of getActivityIcon(intent.getClassName()). Otherwise it resolves the intent's component and returns the icon associated with the resolved component. If intent.getClassName() cannot be found or the Intent cannot be resolved to a component, NameNotFoundException is thrown.
| 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
open fungetActivityInfo(
className: ComponentName,
flags: Int
): ActivityInfo
Deprecated: Deprecated in Java.
Retrieve all of the information we know about a particular activity class. Use getActivityInfo(android.content.ComponentName,android.content.pm.PackageManager.ComponentInfoFlags) when long flags are needed.
| 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. |
getActivityLogo
open fungetActivityLogo(activityName: ComponentName): Drawable?
Deprecated: Deprecated in Java.
Retrieve the logo associated with an activity. Given the full name of an activity, retrieves the information about it and calls ComponentInfo.loadLogo() to return its logo. If the activity cannot be found, NameNotFoundException is thrown.
| 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
open fungetActivityLogo(intent: Intent): Drawable?
Deprecated: Deprecated in Java.
Retrieve the logo associated with an Intent. If intent.getClassName() is set, this simply returns the result of getActivityLogo(intent.getClassName()). Otherwise it resolves the intent's component and returns the logo associated with the resolved component. If intent.getClassName() cannot be found or the Intent cannot be resolved to a component, NameNotFoundException is thrown.
| 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
open fungetAllIntentFilters(packageName: String!): MutableList<IntentFilter!>!
Deprecated: Deprecated in Java.
getAllPermissionGroups
open fungetAllPermissionGroups(flags: Int): MutableList<PermissionGroupInfo!>
Deprecated: Deprecated in Java.
Retrieve all of the known permission groups in the system.
| Parameters | |
|---|---|
flags |
Int: Additional option flags to modify the data returned. Value is either 0 or
|
| Return | |
|---|---|
MutableList<PermissionGroupInfo!> |
Returns a list of PermissionGroupInfo containing information about all of the known permission groups. This value cannot be null. |
getApplicationBanner
open fungetApplicationBanner(info: ApplicationInfo): Drawable?
Deprecated: Deprecated in Java.
Retrieve the banner associated with an application.
| 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
open fungetApplicationBanner(packageName: String): Drawable?
Deprecated: Deprecated in Java.
Retrieve the banner associated with an application. Given the name of the application's package, retrieves the information about it and calls getApplicationIcon() to return its banner. If the application cannot be found, NameNotFoundException is thrown.
| 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
open fungetApplicationEnabledSetting(packageName: String): Int
Deprecated: Deprecated in Java.
Return the enabled setting for an application. This returns the last value set by setApplicationEnabledSetting(java.lang.String,int,int); in most cases this value will be COMPONENT_ENABLED_STATE_DEFAULT since the value originally specified in the manifest has not been modified.
| 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 one of the following: |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if the named package does not exist. |
getApplicationIcon
open fungetApplicationIcon(info: ApplicationInfo): Drawable
Deprecated: Deprecated in Java.
Retrieve the icon associated with an application. If it has not defined an icon, the default app icon is returned. Does not return null.
| 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
open fungetApplicationIcon(packageName: String): Drawable
Deprecated: Deprecated in Java.
Retrieve the icon associated with an application. Given the name of the application's package, retrieves the information about it and calls getApplicationIcon() to return its icon. If the application cannot be found, NameNotFoundException is thrown.
| 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
open fungetApplicationInfo(
packageName: String,
flags: Int
): ApplicationInfo
Deprecated: Deprecated in Java.
Retrieve all of the information we know about a particular package/application. Use getApplicationInfo(java.lang.String,android.content.pm.PackageManager.ApplicationInfoFlags) when long flags are needed.
| 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
open fungetApplicationLabel(info: ApplicationInfo): CharSequence
Deprecated: Deprecated in Java.
Return the label to use for this application.
| 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. |
getApplicationLogo
open fungetApplicationLogo(info: ApplicationInfo): Drawable?
Deprecated: Deprecated in Java.
Retrieve the logo associated with an application. If it has not specified a logo, this method returns null.
| 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
open fungetApplicationLogo(packageName: String): Drawable?
Deprecated: Deprecated in Java.
Retrieve the logo associated with an application. Given the name of the application's package, retrieves the information about it and calls getApplicationLogo() to return its logo. If the application cannot be found, NameNotFoundException is thrown.
| 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. |
getChangedPackages
open fungetChangedPackages(sequenceNumber: Int): ChangedPackages?
Deprecated: Deprecated in Java.
| Parameters | |
|---|---|
sequenceNumber |
Int: The first sequence number for which to retrieve package changes. Value is 0 or greater |
getComponentEnabledSetting
open fungetComponentEnabledSetting(componentName: ComponentName): Int
Deprecated: Deprecated in Java.
Return the enabled setting for a package component (activity, receiver, service, provider). This returns the last value set by setComponentEnabledSetting(android.content.ComponentName,int,int); in most cases this value will be COMPONENT_ENABLED_STATE_DEFAULT since the value originally specified in the manifest has not been modified.
| Parameters | |
|---|---|
componentName |
ComponentName: The component to retrieve. This value cannot be null. |
| Return | |
|---|---|
Int |
Returns the current enabled state for the component. Value is one of the following: |
getDefaultActivityIcon
open fungetDefaultActivityIcon(): Drawable
Deprecated: Deprecated in Java.
Return the generic icon for an activity that is used when no specific icon is defined.
| Return | |
|---|---|
Drawable |
Drawable Image of the icon. This value cannot be null. |
getDrawable
open fungetDrawable(
packageName: String,
resid: Int,
appInfo: ApplicationInfo?
): Drawable?
Deprecated: Deprecated in Java.
Retrieve an image from a package. This is a low-level API used by the various package manager info structures (such as ComponentInfo to implement retrieval of their associated icon.
| 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
open fungetInstalledApplications(flags: Int): MutableList<ApplicationInfo!>
Deprecated: Deprecated in Java.
Return a List of all application packages that are installed for the current user. If flag GET_UNINSTALLED_PACKAGES has been set, a list of all applications including those deleted with DELETE_KEEP_DATA (partially installed apps with data directory) will be returned. Use getInstalledApplications(android.content.pm.PackageManager.ApplicationInfoFlags) when long flags are needed.
| 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
open fungetInstalledPackages(flags: Int): MutableList<PackageInfo!>
Deprecated: Deprecated in Java.
Return a List of all packages that are installed for the current user. Use getInstalledPackages(android.content.pm.PackageManager.PackageInfoFlags) when long flags are needed.
| 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
open fungetInstallerPackageName(packageName: String): String?
Deprecated: Deprecated in Java.
Retrieve the package name of the application that installed a package. This identifies which market the package came from.
| 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 |
getInstantAppCookie
open fungetInstantAppCookie(): ByteArray
Deprecated: Deprecated in Java.
| Return | |
|---|---|
ByteArray |
The cookie. This value cannot be null. |
getInstantAppCookieMaxBytes
open fungetInstantAppCookieMaxBytes(): Int
Deprecated: Deprecated in Java.
| Return | |
|---|---|
Int |
The max cookie size in bytes. |
getInstrumentationInfo
open fungetInstrumentationInfo(
className: ComponentName,
flags: Int
): InstrumentationInfo
Deprecated: Deprecated in Java.
Retrieve all of the information we know about a particular instrumentation class.
| 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
|
| 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
open fungetLaunchIntentForPackage(packageName: String): Intent?
Deprecated: Deprecated in Java.
Returns a "good" intent to launch a front-door activity in a package. This is used, for example, to implement an "open" button when browsing through packages. The current implementation looks first for a main activity in the category Intent.CATEGORY_INFO, and next for a main activity in the category Intent.CATEGORY_LAUNCHER. Returns null if neither are found.
Consider using getLaunchIntentSenderForPackage(java.lang.String) if the caller is not allowed to query for the packageName.
| 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
open fungetLeanbackLaunchIntentForPackage(packageName: String): Intent?
Deprecated: Deprecated in Java.
Return a "good" intent to launch a front-door Leanback activity in a package, for use for example to implement an "open" button when browsing through packages. The current implementation will look for a main activity in the category Intent.CATEGORY_LEANBACK_LAUNCHER, or return null if no main leanback activities are found.
| 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
open fungetNameForUid(uid: Int): String?
Deprecated: Deprecated in Java.
Retrieve the official name associated with a uid. This name is guaranteed to never change, though it is possible for the underlying uid to be changed. That is, if you are storing information about uids in persistent storage, you should use the string returned by this function instead of the raw uid.
| 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
open fungetPackageArchiveInfo(
archiveFilePath: String,
flags: Int
): PackageInfo?
Deprecated: Deprecated in Java.
Retrieve overall information about an application package defined in a package archive file Use getPackageArchiveInfo(java.lang.String,android.content.pm.PackageManager.PackageInfoFlags) when long flags are needed.
| 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
open fungetPackageGids(packageName: String): IntArray!
Deprecated: Deprecated in Java.
Return an array of all of the POSIX secondary group IDs that have been assigned to the given package.
Note that the same package may have different GIDs under different UserHandle on the same device.
| 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
open fungetPackageGids(
packageName: String,
flags: Int
): IntArray!
Deprecated: Deprecated in Java.
Return an array of all of the POSIX secondary group IDs that have been assigned to the given package.
Note that the same package may have different GIDs under different UserHandle on the same device. Use getPackageGids(java.lang.String,android.content.pm.PackageManager.PackageInfoFlags) when long flags are needed.
| 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
open fungetPackageInfo(
versionedPackage: VersionedPackage,
flags: Int
): PackageInfo!
Deprecated: Deprecated in Java.
Retrieve overall information about an application package that is installed on the system. This method can be used for retrieving information about packages for which multiple versions can be installed at the time. Currently only packages hosting static shared libraries can have multiple installed versions. The method can also be used to get info for a package that has a single version installed by passing VERSION_CODE_HIGHEST in the VersionedPackage constructor. Use getPackageInfo(android.content.pm.VersionedPackage,android.content.pm.PackageManager.PackageInfoFlags) when long flags are needed.
| 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. |
getPackageInfo
open fungetPackageInfo(
packageName: String,
flags: Int
): PackageInfo!
Deprecated: Deprecated in Java.
Retrieve overall information about an application package that is installed on the system. Use getPackageInfo(java.lang.String,android.content.pm.PackageManager.PackageInfoFlags) when long flags are needed.
| 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. |
getPackageInstaller
open fungetPackageInstaller(): PackageInstaller
Deprecated: Deprecated in Java.
| Return | |
|---|---|
PackageInstaller |
This value cannot be null. |
getPackageUid
open fungetPackageUid(
packageName: String,
flags: Int
): Int
Deprecated: Deprecated in Java.
Return the UID associated with the given package name.
Note that the same package will have different UIDs under different UserHandle on the same device. Use getPackageUid(java.lang.String,android.content.pm.PackageManager.PackageInfoFlags) when long flags are needed.
| 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
open fungetPackagesForUid(uid: Int): Array<String!>?
Deprecated: Deprecated in Java.
Retrieve the names of all packages that are associated with a particular user id. In most cases, this will be a single package name, the package that has been assigned that user id. Where there are multiple packages sharing the same user id through the "sharedUserId" mechanism, all packages with that id will be returned.
| 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
open fungetPackagesHoldingPermissions(
permissions: Array<String!>,
flags: Int
): MutableList<PackageInfo!>
Deprecated: Deprecated in Java.
Return a List of all installed packages that are currently holding any of the given permissions. Use getPackagesHoldingPermissions(java.lang.String[],android.content.pm.PackageManager.PackageInfoFlags) when long flags are needed.
| Parameters | |
|---|---|
permissions |
Array<String!>: This value cannot be null. |
flags |
Int: Additional option flags to modify the data returned. |
| 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
open fungetPermissionGroupInfo(
name: String,
flags: Int
): PermissionGroupInfo
Deprecated: Deprecated in Java.
Retrieve all of the information we know about a particular group of permissions.
| 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
|
| 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
open fungetPermissionInfo(
name: String,
flags: Int
): PermissionInfo!
Deprecated: Deprecated in Java.
Retrieve all of the information we know about a particular permission.
| 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
|
| 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
open fungetPreferredActivities(
outFilters: MutableList<IntentFilter!>,
outActivities: MutableList<ComponentName!>,
packageName: String?
): Int
Deprecated: Deprecated in Java.
Retrieve all preferred activities, previously added with addPreferredActivity, that are currently registered with the system.
| 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
open fungetPreferredPackages(flags: Int): MutableList<PackageInfo!>
Deprecated: Deprecated in Java.
Retrieve the list of all currently configured preferred packages. The first package on the list is the most preferred, the last is the least preferred.
| 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
open fungetProviderInfo(
className: ComponentName,
flags: Int
): ProviderInfo
Deprecated: Deprecated in Java.
Retrieve all of the information we know about a particular content provider class. Use getProviderInfo(android.content.ComponentName,android.content.pm.PackageManager.ComponentInfoFlags) when long flags are needed.
| 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
open fungetReceiverInfo(
className: ComponentName,
flags: Int
): ActivityInfo
Deprecated: Deprecated in Java.
Retrieve all of the information we know about a particular receiver class. Use getReceiverInfo(android.content.ComponentName,android.content.pm.PackageManager.ComponentInfoFlags) when long flags are needed.
| 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
open fungetResourcesForActivity(activityName: ComponentName): Resources
Deprecated: Deprecated in Java.
Retrieve the resources associated with an activity. Given the full name of an activity, retrieves the information about it and calls getResources() to return its application's resources. If the activity cannot be found, NameNotFoundException is thrown.
| 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
open fungetResourcesForApplication(app: ApplicationInfo): Resources
Deprecated: Deprecated in Java.
Retrieve the resources for an application. Throws NameNotFoundException if the package is no longer installed.
| 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
open fungetResourcesForApplication(appPackageName: String): Resources
Deprecated: Deprecated in Java.
Retrieve the resources associated with an application. Given the full package name of an application, retrieves the information about it and calls getResources() to return its application's resources. If the appPackageName cannot be found, NameNotFoundException is thrown.
| 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
open fungetServiceInfo(
className: ComponentName,
flags: Int
): ServiceInfo
Deprecated: Deprecated in Java.
Retrieve all of the information we know about a particular service class. Use getServiceInfo(android.content.ComponentName,android.content.pm.PackageManager.ComponentInfoFlags) when long flags are needed.
| 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
open fungetSharedLibraries(: 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
open fungetSystemAvailableFeatures(): Array<FeatureInfo!>
Deprecated: Deprecated in Java.
Get a list of features that are available on the system.
| Return | |
|---|---|
Array<FeatureInfo!> |
An array of FeatureInfo classes describing the features that are available on the system, or null if there are none(!!). |
getSystemSharedLibraryNames
open fungetSystemSharedLibraryNames(): Array<String!>?
Deprecated: Deprecated in Java.
Get a list of shared libraries that are available on the system.
| Return | |
|---|---|
Array<String!>? |
An array of shared library names that are available on the system, or null if none are installed. |
getText
open fungetText(
packageName: String,
resid: Int,
appInfo: ApplicationInfo?
): CharSequence?
Deprecated: Deprecated in Java.
Retrieve text from a package. This is a low-level API used by the various package manager info structures (such as ComponentInfo to implement retrieval of their associated labels and other text.
| 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
open fungetUserBadgedDrawableForDensity(
drawable: Drawable,
user: UserHandle,
badgeLocation: Rect?,
badgeDensity: Int
): Drawable
Deprecated: Deprecated in Java.
If the target user is a managed profile of the calling user or the caller is itself a managed profile, then this returns a badged copy of the given drawable allowing the user to distinguish it from the original drawable. The caller can specify the location in the bounds of the drawable to be badged where the badge should be applied as well as the density of the badge to be used.
If the original drawable is a BitmapDrawable and the backing bitmap is mutable as per android.graphics.Bitmap#isMutable(), the badging is performed in place and the original drawable is returned.
| 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
open fungetUserBadgedIcon(
icon: Drawable,
user: UserHandle
): Drawable
Deprecated: Deprecated in Java.
If the target user is a managed profile, then this returns a badged copy of the given icon to be able to distinguish it from the original icon. For badging an arbitrary drawable use getUserBadgedDrawableForDensity(android.graphics.drawable.Drawable,android.os.UserHandle,android.graphics.Rect,int).
If the original drawable is a BitmapDrawable and the backing bitmap is mutable as per android.graphics.Bitmap#isMutable(), the badging is performed in place and the original drawable is returned.
| 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
open fungetUserBadgedLabel(
label: CharSequence,
user: UserHandle
): CharSequence
Deprecated: Deprecated in Java.
If the target user is a managed profile of the calling user or the caller is itself a managed profile, then this returns a copy of the label with badging for accessibility services like talkback. E.g. passing in "Email" and it might return "Work Email" for Email in the work profile.
| 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. |
getWhitelistedRestrictedPermissions
open fungetWhitelistedRestrictedPermissions(
packageName: String,
whitelistFlags: Int
): MutableSet<String!>
Deprecated: Deprecated in Java.
| Parameters | |
|---|---|
packageName |
String: The app for which to get whitelisted permissions. This value cannot be null. |
whitelistFlag |
The flag to determine which whitelist to query. Only one flag can be passed.s. Value is either 0 or a combination of the following:
|
| Return | |
|---|---|
MutableSet<String!> |
The whitelisted permissions that are on any of the whitelists you query for. This value cannot be null. |
| Exceptions | |
|---|---|
java.lang.SecurityException |
if you try to access a whitelist that you have no access to. |
getXml
open fungetXml(
packageName: String,
resid: Int,
appInfo: ApplicationInfo?
): XmlResourceParser?
Deprecated: Deprecated in Java.
Retrieve an XML file from a package. This is a low-level API used to retrieve XML meta data.
| 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
open funhasSigningCertificate(
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 one of the following: |
| Return | |
|---|---|
Boolean |
true if this package was or is signed by exactly the certificate certificate |
hasSigningCertificate
open funhasSigningCertificate(
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 one of the following: |
| Return | |
|---|---|
Boolean |
true if this package was or is signed by exactly the certificate certificate |
hasSystemFeature
open funhasSystemFeature(name: String): Boolean
Deprecated: Deprecated in Java.
Check whether the given feature name is one of the available features as returned by getSystemAvailableFeatures(). This tests for the presence of any version of the given feature name; use hasSystemFeature(java.lang.String,int) to check for a minimum version.
| Parameters | |
|---|---|
featureName |
This value cannot be null. |
| Return | |
|---|---|
Boolean |
Returns true if the devices supports the feature, else false. |
hasSystemFeature
open funhasSystemFeature(
name: String,
version: Int
): Boolean
Deprecated: Deprecated in Java.
Check whether the given feature name and version is one of the available features as returned by getSystemAvailableFeatures(). Since features are defined to always be backwards compatible, this returns true if the available feature version is greater than or equal to the requested version.
| Parameters | |
|---|---|
featureName |
This value cannot be null. |
| Return | |
|---|---|
Boolean |
Returns true if the devices supports the feature, else false. |
isInstantApp
open funisInstantApp(): Boolean
Deprecated: Deprecated in Java.
| Return | |
|---|---|
Boolean |
Whether caller is an instant app. |
isInstantApp
open funisInstantApp(packageName: String): Boolean
Deprecated: Deprecated in Java.
| Parameters | |
|---|---|
packageName |
String: The package to check. This value cannot be null. |
| Return | |
|---|---|
Boolean |
Whether the given package is an instant app. |
isPermissionRevokedByPolicy
open funisPermissionRevokedByPolicy(
permName: String,
pkgName: String
): Boolean
Deprecated: Deprecated in Java.
Checks whether a particular permissions has been revoked for a package by policy. Typically the device owner or the profile owner may apply such a policy. The user cannot grant policy revoked permissions, hence the only way for an app to get such a permission is by a policy change.
| 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
open funisSafeMode(): Boolean
Deprecated: Deprecated in Java.
Return whether the device has been booted into safe mode.
queryBroadcastReceivers
open funqueryBroadcastReceivers(
intent: Intent,
flags: Int
): MutableList<ResolveInfo!>
Deprecated: Deprecated in Java.
Retrieve all receivers that can handle a broadcast of the given intent. Use queryBroadcastReceivers(android.content.Intent,android.content.pm.PackageManager.ResolveInfoFlags) when long flags are needed.
| 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, returns an empty list. This value cannot be null. |
queryContentProviders
open funqueryContentProviders(
processName: String?,
uid: Int,
flags: Int
): MutableList<ProviderInfo!>
Deprecated: Deprecated in Java.
Retrieve content provider information.
Note: unlike most other methods, an empty result set is indicated by a null return instead of an empty list. Use queryContentProviders(java.lang.String,int,android.content.pm.PackageManager.ComponentInfoFlags) when long flags are needed.
| 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
open funqueryInstrumentation(
targetPackage: String,
flags: Int
): MutableList<InstrumentationInfo!>
Deprecated: Deprecated in Java.
Retrieve information about available instrumentation code. May be used to retrieve either all instrumentation code, or only the code targeting a particular package.
| 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
|
| 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
open funqueryIntentActivities(
intent: Intent,
flags: Int
): MutableList<ResolveInfo!>
Deprecated: Deprecated in Java.
Retrieve all activities that can be performed for the given intent. Use queryIntentActivities(android.content.Intent,android.content.pm.PackageManager.ResolveInfoFlags) when long flags are needed.
| 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
open funqueryIntentActivityOptions(
caller: ComponentName?,
specifics: Array<Intent!>?,
intent: Intent,
flags: Int
): MutableList<ResolveInfo!>
Deprecated: Deprecated in Java.
Retrieve a set of activities that should be presented to the user as similar options. This is like #queryIntentActivities, except it also allows you to supply a list of more explicit Intents that you would like to resolve to particular options, and takes care of returning the final ResolveInfo list in a reasonable order, with no duplicates, based on those inputs. Use queryIntentActivityOptions(android.content.ComponentName,java.util.List,android.content.Intent,android.content.pm.PackageManager.ResolveInfoFlags) when long flags are needed.
| 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
open funqueryIntentContentProviders(
intent: Intent,
flags: Int
): MutableList<ResolveInfo!>
Deprecated: Deprecated in Java.
Retrieve all providers that can match the given intent. Use queryIntentContentProviders(android.content.Intent,android.content.pm.PackageManager.ResolveInfoFlags) when long flags are needed.
| 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, returns an empty list. This value cannot be null. |
queryIntentServices
open funqueryIntentServices(
intent: Intent,
flags: Int
): MutableList<ResolveInfo!>
Deprecated: Deprecated in Java.
Retrieve all services that can match the given intent. Use queryIntentServices(android.content.Intent,android.content.pm.PackageManager.ResolveInfoFlags) when long flags are needed.
| 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, returns an empty list. This value cannot be null. |
queryPermissionsByGroup
open funqueryPermissionsByGroup(
group: String?,
flags: Int
): MutableList<PermissionInfo!>
Deprecated: Deprecated in Java.
Query for all of the permissions associated with a particular group.
| 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
|
| 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
open funremovePackageFromPreferred(packageName: String): Unit
Deprecated: Deprecated in Java.
| Parameters | |
|---|---|
packageName |
String: This value cannot be null. |
removePermission
open funremovePermission(name: String): Unit
Deprecated: Deprecated in Java.
Removes a permission that was previously added with addPermission(android.content.pm.PermissionInfo). The same ownership rules apply -- you are only allowed to remove permissions that you are allowed to add.
| 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. |
removeWhitelistedRestrictedPermission
open funremoveWhitelistedRestrictedPermission(
packageName: String,
permission: String,
whitelistFlags: Int
): Boolean
Deprecated: Deprecated in Java.
| Parameters | |
|---|---|
packageName |
String: The app for which to get whitelisted permissions. This value cannot be null. |
permName |
The whitelisted permission to remove. This value cannot be null. |
whitelistFlags |
Int: The whitelists from which to remove. Passing multiple flags updates all specified whitelists. Value is either 0 or a combination of the following:
|
| Return | |
|---|---|
Boolean |
Whether the permission was removed from the whitelist. |
| Exceptions | |
|---|---|
java.lang.SecurityException |
if you try to modify a whitelist that you have no access to. |
resolveActivity
open funresolveActivity(
intent: Intent,
flags: Int
): ResolveInfo?
Deprecated: Deprecated in Java.
Determine the best action to perform for a given Intent. This is how Intent.resolveActivity finds an activity if a class has not been explicitly specified.
Note: if using an implicit Intent (without an explicit ComponentName specified), be sure to consider whether to set the MATCH_DEFAULT_ONLY only flag. You need to do so to resolve the activity in the same way that android.content.Context#startActivity(Intent) and Intent.resolveActivity(PackageManager) do.
resolveActivity(android.content.Intent,android.content.pm.PackageManager.ResolveInfoFlags) when long flags are needed.
| 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
open funresolveContentProvider(
name: String,
flags: Int
): ProviderInfo?
Deprecated: Deprecated in Java.
Find a single content provider by its authority.
Example:
Uri uri = Uri.parse("content://com.example.app.provider/table1"); ProviderInfo info = packageManager.resolveContentProvider(uri.getAuthority(), flags);
resolveContentProvider(java.lang.String,android.content.pm.PackageManager.ComponentInfoFlags) when long flags are needed.
| 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
open funresolveService(
intent: Intent,
flags: Int
): ResolveInfo?
Deprecated: Deprecated in Java.
Determine the best service to handle for a given Intent. Use resolveService(android.content.Intent,android.content.pm.PackageManager.ResolveInfoFlags) when long flags are needed.
| 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
open funresolveServiceAsUser(
intent: Intent!,
flags: Int,
userId: Int
): ResolveInfo!
Deprecated: Deprecated in Java.
setApplicationCategoryHint
open funsetApplicationCategoryHint(
packageName: String,
categoryHint: Int
): Unit
Deprecated: Deprecated in Java.
| Parameters | |
|---|---|
packageName |
String: the package to change the category hint for. This value cannot be null. |
categoryHint |
Int: the category hint to set. Value is one of the following:
|
setApplicationEnabledSetting
open funsetApplicationEnabledSetting(
packageName: String,
newState: Int,
flags: Int
): Unit
Deprecated: Deprecated in Java.
Set the enabled setting for an application This setting will override any enabled state which may have been set by the application in its manifest. It also overrides the enabled state set in the manifest for any of the application's components. It does not override any enabled state set by setComponentEnabledSetting for any of the application's components.
| 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 one of the following: |
flags |
Int: Optional behavior flags. Value is either 0 or a combination of the following:
|
setComponentEnabledSetting
open funsetComponentEnabledSetting(
componentName: ComponentName,
newState: Int,
flags: Int
): Unit
Deprecated: Deprecated in Java.
Set the enabled setting for a package component (activity, receiver, service, provider). This setting will override any enabled state which may have been set by the component in its manifest.
Consider using setComponentEnabledSettings(java.util.List) if multiple components need to be updated atomically.
| Parameters | |
|---|---|
componentName |
ComponentName: The component to enable. This value cannot be null. |
newState |
Int: The new enabled state for the component. Value is one of the following: |
flags |
Int: Optional behavior flags. Value is either 0 or a combination of the following:
|
setInstallerPackageName
open funsetInstallerPackageName(
targetPackage: String,
installerPackageName: String?
): Unit
Deprecated: Deprecated in Java.
Change the installer associated with a given package. There are limitations on how the installer package can be changed; in particular:
- A SecurityException will be thrown if installerPackageName is not signed with the same certificate as the calling application.
- A SecurityException will be thrown if targetPackage already has an installer package, and that installer package is not signed with the same certificate as the calling application.
| 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. |
setInstantAppCookie
open funsetInstantAppCookie(cookie: ByteArray): Boolean
Deprecated: Deprecated in Java.
| Parameters | |
|---|---|
cookie |
ByteArray: This value cannot be null. |
updateInstantAppCookie
open funupdateInstantAppCookie(cookie: ByteArray!): Unit
Deprecated: Deprecated in Java.
| Parameters | |
|---|---|
cookie |
ByteArray!: This value cannot be null. |
| Exceptions | |
|---|---|
java.lang.IllegalArgumentException |
if the array exceeds max cookie size. |
verifyPendingInstall
open funverifyPendingInstall(
id: Int,
verificationCode: Int
): Unit
Deprecated: Deprecated in Java.
Allows a package listening to the package verification to respond to the package manager. The response must include the verificationCode which is one of PackageManager.VERIFICATION_ALLOW or PackageManager.VERIFICATION_REJECT.
| 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. |