Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/content/pm/LauncherApps#nestedclasses) \| [Constants](https://developer.android.com/reference/android/content/pm/LauncherApps#constants) \| [Methods](https://developer.android.com/reference/android/content/pm/LauncherApps#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/content/pm/LauncherApps#inhmethods)

# LauncherApps

*** ** * ** ***


`
public


class
LauncherApps
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.content.pm.LauncherApps |

<br />

*** ** * ** ***

Class for retrieving a list of launchable activities for the current user and any associated
managed profiles that are visible to the current user, which can be retrieved with
`https://developer.android.com/reference/android/content/pm/LauncherApps#getProfiles()`. This is mainly for use by launchers.

Apps can be queried for each user profile.
Since the PackageManager will not deliver package broadcasts for other profiles, you can register
for package changes here.


To watch for managed profiles being added or removed, register for the following broadcasts:
`https://developer.android.com/reference/android/content/Intent#ACTION_MANAGED_PROFILE_ADDED` and `https://developer.android.com/reference/android/content/Intent#ACTION_MANAGED_PROFILE_REMOVED`.


Note as of Android O, apps on a managed profile are no longer allowed to access apps on the
main profile. Apps can only access profiles returned by `https://developer.android.com/reference/android/content/pm/LauncherApps#getProfiles()`.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/content/pm/LauncherApps.ArchiveCompatibilityParams` Used to enable Archiving compatibility options with `https://developer.android.com/reference/android/content/pm/LauncherApps#setArchiveCompatibility(android.content.pm.LauncherApps.ArchiveCompatibilityParams)`. |
| ` class` | `https://developer.android.com/reference/android/content/pm/LauncherApps.Callback` Callbacks for package changes to this and related managed profiles. |
| ` class` | `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest` Represents a "pin shortcut" or a "pin appwidget" request made by an app, which is sent with an `https://developer.android.com/reference/android/content/pm/LauncherApps#ACTION_CONFIRM_PIN_SHORTCUT` or `https://developer.android.com/reference/android/content/pm/LauncherApps#ACTION_CONFIRM_PIN_APPWIDGET` intent respectively to the default launcher app. |
| ` class` | `https://developer.android.com/reference/android/content/pm/LauncherApps.ShortcutQuery` Represents a query passed to `https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcuts(android.content.pm.LauncherApps.ShortcutQuery,%20android.os.UserHandle)`. |

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/content/pm/LauncherApps#ACTION_CONFIRM_PIN_APPWIDGET` Activity Action: For the default launcher to show the confirmation dialog to create a pinned app widget. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/content/pm/LauncherApps#ACTION_CONFIRM_PIN_SHORTCUT` Activity Action: For the default launcher to show the confirmation dialog to create a pinned shortcut. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/content/pm/LauncherApps#EXTRA_PIN_ITEM_REQUEST` An extra for `https://developer.android.com/reference/android/content/pm/LauncherApps#ACTION_CONFIRM_PIN_SHORTCUT` \& `https://developer.android.com/reference/android/content/pm/LauncherApps#ACTION_CONFIRM_PIN_APPWIDGET` containing a `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest` of appropriate type asked to pin. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/LauncherActivityInfo>` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getActivityList(java.lang.String,%20android.os.UserHandle)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/android/os/UserHandle user) ` Retrieves a list of activities that specify `https://developer.android.com/reference/android/content/Intent#ACTION_MAIN` and `https://developer.android.com/reference/android/content/Intent#CATEGORY_LAUNCHER`, across all apps, for a specified user. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo>` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getAllPackageInstallerSessions()() ` Return list of all known install sessions in this user and managed profiles, regardless of the installer. |
| ` https://developer.android.com/reference/android/content/IntentSender` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getAppMarketActivityIntent(java.lang.String,%20android.os.UserHandle)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/android/os/UserHandle user) ` Returns an intent sender which can be used to start the App Market activity (Installer Activity). |
| ` https://developer.android.com/reference/android/content/pm/ApplicationInfo` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getApplicationInfo(java.lang.String,%20int,%20android.os.UserHandle)(https://developer.android.com/reference/java/lang/String packageName, int flags, https://developer.android.com/reference/android/os/UserHandle user) ` Returns `https://developer.android.com/reference/android/content/pm/ApplicationInfo` about an application installed for a specific user profile. |
| ` final https://developer.android.com/reference/android/content/pm/LauncherUserInfo` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getLauncherUserInfo(android.os.UserHandle)(https://developer.android.com/reference/android/os/UserHandle userHandle) ` Returns information related to a user which is useful for displaying UI elements to distinguish it from other users (eg, badges). |
| ` https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getPinItemRequest(android.content.Intent)(https://developer.android.com/reference/android/content/Intent intent) ` A helper method to extract a `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest` set to the `https://developer.android.com/reference/android/content/pm/LauncherApps#EXTRA_PIN_ITEM_REQUEST` extra. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getPreInstalledSystemPackages(android.os.UserHandle)(https://developer.android.com/reference/android/os/UserHandle userHandle) ` Returns the list of the system packages that are installed at user creation. |
| ` https://developer.android.com/reference/android/content/IntentSender` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getPrivateSpaceSettingsIntent()() ` Returns `https://developer.android.com/reference/android/content/IntentSender` which can be used to start the Private Space Settings Activity. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/os/UserHandle>` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getProfiles()() ` Return a list of profiles that the caller can access via the `https://developer.android.com/reference/android/content/pm/LauncherApps` APIs. |
| ` https://developer.android.com/reference/android/graphics/drawable/Drawable` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo,%20int)(https://developer.android.com/reference/android/content/pm/ShortcutInfo shortcut, int density) ` Returns the shortcut icon with badging appropriate for the profile. |
| ` https://developer.android.com/reference/android/content/IntentSender` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutConfigActivityIntent(android.content.pm.LauncherActivityInfo)(https://developer.android.com/reference/android/content/pm/LauncherActivityInfo info) ` Returns an intent sender which can be used to start the configure activity for creating custom shortcuts. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/LauncherActivityInfo>` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutConfigActivityList(java.lang.String,%20android.os.UserHandle)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/android/os/UserHandle user) ` Retrieves a list of config activities for creating `https://developer.android.com/reference/android/content/pm/ShortcutInfo`. |
| ` https://developer.android.com/reference/android/graphics/drawable/Drawable` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutIconDrawable(android.content.pm.ShortcutInfo,%20int)(https://developer.android.com/reference/android/content/pm/ShortcutInfo shortcut, int density) ` Returns the icon for this shortcut, without any badging for the profile. |
| ` https://developer.android.com/reference/android/app/PendingIntent` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutIntent(java.lang.String,%20java.lang.String,%20android.os.Bundle,%20android.os.UserHandle)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/java/lang/String shortcutId, https://developer.android.com/reference/android/os/Bundle opts, https://developer.android.com/reference/android/os/UserHandle user) ` Returns PendingIntent associated with specified shortcut. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo>` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcuts(android.content.pm.LauncherApps.ShortcutQuery,%20android.os.UserHandle)(https://developer.android.com/reference/android/content/pm/LauncherApps.ShortcutQuery query, https://developer.android.com/reference/android/os/UserHandle user) ` Returns `https://developer.android.com/reference/android/content/pm/ShortcutInfo`s that match `query`. |
| ` https://developer.android.com/reference/android/os/Bundle` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#getSuspendedPackageLauncherExtras(java.lang.String,%20android.os.UserHandle)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/android/os/UserHandle user) ` Gets the launcher extras supplied to the system when the given package was suspended via `PackageManager#setPackagesSuspended(String[], boolean, PersistableBundle, PersistableBundle, String)`. |
| ` boolean` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#hasShortcutHostPermission()() ` Returns whether the caller can access the shortcut information. |
| ` boolean` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#isActivityEnabled(android.content.ComponentName,%20android.os.UserHandle)(https://developer.android.com/reference/android/content/ComponentName component, https://developer.android.com/reference/android/os/UserHandle user) ` Checks if the activity exists and it enabled for a profile. |
| ` boolean` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#isPackageEnabled(java.lang.String,%20android.os.UserHandle)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/android/os/UserHandle user) ` Checks if the package is installed and enabled for a profile. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#pinShortcuts(java.lang.String,%20java.util.List<java.lang.String>,%20android.os.UserHandle)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> shortcutIds, https://developer.android.com/reference/android/os/UserHandle user) ` Pin shortcuts on a package. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#registerCallback(android.content.pm.LauncherApps.Callback)(https://developer.android.com/reference/android/content/pm/LauncherApps.Callback callback) ` Registers a callback for changes to packages in this user and managed profiles. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#registerCallback(android.content.pm.LauncherApps.Callback,%20android.os.Handler)(https://developer.android.com/reference/android/content/pm/LauncherApps.Callback callback, https://developer.android.com/reference/android/os/Handler handler) ` Registers a callback for changes to packages in this user and managed profiles. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#registerPackageInstallerSessionCallback(java.util.concurrent.Executor,%20android.content.pm.PackageInstaller.SessionCallback)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback callback) ` Register a callback to watch for session lifecycle events in this user and managed profiles. |
| ` https://developer.android.com/reference/android/content/pm/LauncherActivityInfo` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#resolveActivity(android.content.Intent,%20android.os.UserHandle)(https://developer.android.com/reference/android/content/Intent intent, https://developer.android.com/reference/android/os/UserHandle user) ` Returns the activity info for a given intent and user handle, if it resolves. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#setArchiveCompatibility(android.content.pm.LauncherApps.ArchiveCompatibilityParams)(https://developer.android.com/reference/android/content/pm/LauncherApps.ArchiveCompatibilityParams params) ` Disable different archive compatibility options of the launcher for the caller of this method. |
| ` boolean` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#shouldHideFromSuggestions(java.lang.String,%20android.os.UserHandle)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/android/os/UserHandle user) ` Returns whether a package should be hidden from suggestions to the user. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#startAppDetailsActivity(android.content.ComponentName,%20android.os.UserHandle,%20android.graphics.Rect,%20android.os.Bundle)(https://developer.android.com/reference/android/content/ComponentName component, https://developer.android.com/reference/android/os/UserHandle user, https://developer.android.com/reference/android/graphics/Rect sourceBounds, https://developer.android.com/reference/android/os/Bundle opts) ` Starts the settings activity to show the application details for a package in the specified profile. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#startMainActivity(android.content.ComponentName,%20android.os.UserHandle,%20android.graphics.Rect,%20android.os.Bundle)(https://developer.android.com/reference/android/content/ComponentName component, https://developer.android.com/reference/android/os/UserHandle user, https://developer.android.com/reference/android/graphics/Rect sourceBounds, https://developer.android.com/reference/android/os/Bundle opts) ` Starts a Main activity in the specified profile. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#startPackageInstallerSessionDetailsActivity(android.content.pm.PackageInstaller.SessionInfo,%20android.graphics.Rect,%20android.os.Bundle)(https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo sessionInfo, https://developer.android.com/reference/android/graphics/Rect sourceBounds, https://developer.android.com/reference/android/os/Bundle opts) ` Starts an activity to show the details of the specified session. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#startShortcut(java.lang.String,%20java.lang.String,%20android.graphics.Rect,%20android.os.Bundle,%20android.os.UserHandle)(https://developer.android.com/reference/java/lang/String packageName, https://developer.android.com/reference/java/lang/String shortcutId, https://developer.android.com/reference/android/graphics/Rect sourceBounds, https://developer.android.com/reference/android/os/Bundle startActivityOptions, https://developer.android.com/reference/android/os/UserHandle user) ` Starts a shortcut. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#startShortcut(android.content.pm.ShortcutInfo,%20android.graphics.Rect,%20android.os.Bundle)(https://developer.android.com/reference/android/content/pm/ShortcutInfo shortcut, https://developer.android.com/reference/android/graphics/Rect sourceBounds, https://developer.android.com/reference/android/os/Bundle startActivityOptions) ` Launches a shortcut. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#unregisterCallback(android.content.pm.LauncherApps.Callback)(https://developer.android.com/reference/android/content/pm/LauncherApps.Callback callback) ` Unregisters a callback that was previously registered. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/LauncherApps#unregisterPackageInstallerSessionCallback(android.content.pm.PackageInstaller.SessionCallback)(https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionCallback callback) ` Unregisters a callback that was previously registered. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Constants

### ACTION_CONFIRM_PIN_APPWIDGET

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_CONFIRM_PIN_APPWIDGET
```

Activity Action: For the default launcher to show the confirmation dialog to create
a pinned app widget.

See the `https://developer.android.com/reference/android/appwidget/AppWidgetManager#requestPinAppWidget(android.content.ComponentName,%20android.os.Bundle,%20android.app.PendingIntent)` javadoc for
details.


Use `https://developer.android.com/reference/android/content/pm/LauncherApps#getPinItemRequest(android.content.Intent)` to get a `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest` object,
and call `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest#accept(android.os.Bundle)`
if the user accepts. If the user doesn't accept, no further action is required.

<br />

**See also:**

- `https://developer.android.com/reference/android/content/pm/LauncherApps#EXTRA_PIN_ITEM_REQUEST`

Constant Value:

"android.content.pm.action.CONFIRM_PIN_APPWIDGET"


### ACTION_CONFIRM_PIN_SHORTCUT

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_CONFIRM_PIN_SHORTCUT
```

Activity Action: For the default launcher to show the confirmation dialog to create
a pinned shortcut.

See the `https://developer.android.com/reference/android/content/pm/ShortcutManager` javadoc for details.


Use `https://developer.android.com/reference/android/content/pm/LauncherApps#getPinItemRequest(android.content.Intent)` to get a `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest` object,
and call `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest#accept(android.os.Bundle)`
if the user accepts. If the user doesn't accept, no further action is required.

<br />

**See also:**

- `https://developer.android.com/reference/android/content/pm/LauncherApps#EXTRA_PIN_ITEM_REQUEST`

Constant Value:

"android.content.pm.action.CONFIRM_PIN_SHORTCUT"


### EXTRA_PIN_ITEM_REQUEST

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_PIN_ITEM_REQUEST
```

An extra for `https://developer.android.com/reference/android/content/pm/LauncherApps#ACTION_CONFIRM_PIN_SHORTCUT` \& `https://developer.android.com/reference/android/content/pm/LauncherApps#ACTION_CONFIRM_PIN_APPWIDGET`
containing a `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest` of appropriate type asked to pin.

A helper function `https://developer.android.com/reference/android/content/pm/LauncherApps#getPinItemRequest(android.content.Intent)` can be used
instead of using this constant directly.

<br />

**See also:**

- `https://developer.android.com/reference/android/content/pm/LauncherApps#ACTION_CONFIRM_PIN_SHORTCUT`
- `https://developer.android.com/reference/android/content/pm/LauncherApps#ACTION_CONFIRM_PIN_APPWIDGET`

Constant Value:

"android.content.pm.extra.PIN_ITEM_REQUEST"


## Public methods

### getActivityList

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<LauncherActivityInfo> getActivityList (String packageName, 
                UserHandle user)
```

Retrieves a list of activities that specify `https://developer.android.com/reference/android/content/Intent#ACTION_MAIN` and
`https://developer.android.com/reference/android/content/Intent#CATEGORY_LAUNCHER`, across all apps, for a specified user. If an app doesn't
have any activities that specify `ACTION_MAIN` or `CATEGORY_LAUNCHER`,
the system adds a synthesized activity to the list. This synthesized activity represents the
app's details page within system settings.

**Note:**It's possible for system apps, such as app stores, to prevent
the system from adding synthesized activities to the returned list.

As of [Android Q](https://developer.android.com/reference/android/os/Build.VERSION_CODES#Q), at least
one of the app's activities or synthesized activities appears in the returned list unless the
app satisfies at least one of the following conditions:

- The app is a system app.
- The app doesn't request any [permissions](https://developer.android.com/guide/topics/permissions/overview).
- The app doesn't have a *launcher activity* that is enabled by default. A launcher activity has an intent containing the `ACTION_MAIN` action and the `CATEGORY_LAUNCHER` category.

Additionally, the system hides synthesized activities for some or all apps in the
following enterprise-related cases:

- If the device is a [fully
  managed device](https://developers.google.com/android/work/overview#company-owned-devices-for-knowledge-workers), no synthesized activities for any app appear in the returned list.
- If the current user has a [work
  profile](https://developers.google.com/android/work/overview#employee-owned-devices-byod), no synthesized activities for the user's work apps appear in the returned list.

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

For the returned `https://developer.android.com/reference/android/content/pm/LauncherActivityInfo` objects, the App Lock fields
(`https://developer.android.com/reference/android/content/pm/ApplicationInfo#isAppLockEnabled` and `https://developer.android.com/reference/android/content/pm/ApplicationInfo#isAppLockSupported`)
within the underlying `https://developer.android.com/reference/android/content/pm/ApplicationInfo` (retrieved via
`https://developer.android.com/reference/android/content/pm/LauncherActivityInfo#getApplicationInfo()`) are present if the caller has the
`https://developer.android.com/reference/android/Manifest.permission#LOCK_APPS` permission. See
`https://developer.android.com/reference/android/content/pm/PackageManager#getEnableAppLockIntentForPackage(java.lang.String,%20boolean)` for more information about App Lock.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: The specific package to query. If null, it checks all installed packages in the profile. <br /> |
| `user` | `UserHandle`: The UserHandle of the profile. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/LauncherActivityInfo>` | List of launchable activities. Can be an empty list but will not be null. <br /> |

### getAllPackageInstallerSessions

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<PackageInstaller.SessionInfo> getAllPackageInstallerSessions ()
```

Return list of all known install sessions in this user and managed profiles, regardless
of the installer. Callers need to either declare \<queries\> element with the specific
package name in the app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be
the session owner to retrieve these details.

To receive callbacks for hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/PackageInstaller.SessionInfo>` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/pm/PackageInstaller#getAllSessions()`

### getAppMarketActivityIntent

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public IntentSender getAppMarketActivityIntent (String packageName, 
                UserHandle user)
```

Returns an intent sender which can be used to start the App Market activity (Installer
Activity).
This method is primarily used to get an intent sender which starts App Market activity for
another profile, if the caller is not otherwise allowed to start activity in that profile.

When packageName is set, intent sender to start the App Market Activity which installed
the package in calling user will be returned, but for the profile passed.

When packageName is not set, intent sender to launch the default App Market Activity for
the profile will be returned. In case there are multiple App Market Activities available for
the profile, IntentPicker will be started, allowing user to choose the preferred activity.

The method will fall back to the behaviour of not having the packageName set, in case:

- No activity for the packageName is found in calling user-space.
- The App Market Activity which installed the package in calling user-space is not present.
- The App Market Activity which installed the package in calling user-space is not present in the profile passed.

<br />

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: the package for which intent sender to launch App Market Activity is required. This value may be `null`. <br /> |
| `user` | `UserHandle`: the profile for which intent sender to launch App Market Activity is required. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/IntentSender` | `https://developer.android.com/reference/android/content/IntentSender` object which launches the App Market Activity, null in case there is no such activity. <br /> |

### getApplicationInfo

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ApplicationInfo getApplicationInfo (String packageName, 
                int flags, 
                UserHandle user)
```

Returns `https://developer.android.com/reference/android/content/pm/ApplicationInfo` about an application installed for a specific user profile.

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

App Lock fields in the returned `https://developer.android.com/reference/android/content/pm/ApplicationInfo` object
(`https://developer.android.com/reference/android/content/pm/ApplicationInfo#isAppLockEnabled` and `https://developer.android.com/reference/android/content/pm/ApplicationInfo#isAppLockSupported`) are
present if the caller has the `https://developer.android.com/reference/android/Manifest.permission#LOCK_APPS` permission. See
`https://developer.android.com/reference/android/content/pm/PackageManager#getEnableAppLockIntentForPackage(java.lang.String,%20boolean)` for more information about App Lock.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: The package name of the application. This value cannot be `null`. <br /> |
| `flags` | `int`: Additional option flags `https://developer.android.com/reference/android/content/pm/PackageManager#getApplicationInfo(java.lang.String,%20android.content.pm.PackageManager.ApplicationInfoFlags)` Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/content/pm/PackageManager#GET_META_DATA` - `https://developer.android.com/reference/android/content/pm/PackageManager#GET_SHARED_LIBRARY_FILES` - `https://developer.android.com/reference/android/content/pm/PackageManager#MATCH_UNINSTALLED_PACKAGES` - `https://developer.android.com/reference/android/content/pm/PackageManager#MATCH_SYSTEM_ONLY` - `https://developer.android.com/reference/android/content/pm/PackageManager#MATCH_DISABLED_COMPONENTS` - `https://developer.android.com/reference/android/content/pm/PackageManager#MATCH_DISABLED_UNTIL_USED_COMPONENTS` - `https://developer.android.com/reference/android/content/pm/PackageManager#GET_DISABLED_UNTIL_USED_COMPONENTS` - `https://developer.android.com/reference/android/content/pm/PackageManager#GET_UNINSTALLED_PACKAGES` - `https://developer.android.com/reference/android/content/pm/PackageManager#MATCH_APEX` - `https://developer.android.com/reference/android/content/pm/PackageManager#MATCH_ARCHIVED_PACKAGES` - `https://developer.android.com/reference/android/content/pm/PackageManager#GET_APP_LOCK_INFO` |
| `user` | `UserHandle`: The UserHandle of the profile. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/ApplicationInfo` | `https://developer.android.com/reference/android/content/pm/ApplicationInfo` containing information about the package. Returns `null` if the package isn't installed for the given profile, or the profile isn't enabled. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/PackageManager.NameNotFoundException` |   |

### getLauncherUserInfo

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public final LauncherUserInfo getLauncherUserInfo (UserHandle userHandle)
```

Returns information related to a user which is useful for displaying UI elements
to distinguish it from other users (eg, badges).

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

<br />

| Parameters ||
|---|---|
| `userHandle` | `UserHandle`: user handle of the user for which LauncherUserInfo is requested. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/LauncherUserInfo` | the `https://developer.android.com/reference/android/content/pm/LauncherUserInfo` object related to the user specified, null in case the user is inaccessible. <br /> |

### getPinItemRequest

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LauncherApps.PinItemRequest getPinItemRequest (Intent intent)
```

A helper method to extract a `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest` set to
the `https://developer.android.com/reference/android/content/pm/LauncherApps#EXTRA_PIN_ITEM_REQUEST` extra.

<br />

| Parameters ||
|---|---|
| `intent` | `Intent` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest` | <br /> |

### getPreInstalledSystemPackages

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<String> getPreInstalledSystemPackages (UserHandle userHandle)
```

Returns the list of the system packages that are installed at user creation.

An empty list denotes that all system packages should be treated as pre-installed for that
user at creation.

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

<br />

| Parameters ||
|---|---|
| `userHandle` | `UserHandle`: the user for which installed system packages are required. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | `https://developer.android.com/reference/java/util/List` of `https://developer.android.com/reference/java/lang/String`, representing the package name of the installed package. Can be empty but not null. <br /> |

### getPrivateSpaceSettingsIntent

Added in [API level 36](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public IntentSender getPrivateSpaceSettingsIntent ()
```

Returns `https://developer.android.com/reference/android/content/IntentSender` which can be used to start the Private Space Settings Activity.

Caller should have `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` and either of the
permissions required.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/IntentSender` | `https://developer.android.com/reference/android/content/IntentSender` object which launches the Private Space Settings Activity, if successful, null otherwise. <br /> |

### getProfiles

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<UserHandle> getProfiles ()
```

Return a list of profiles that the caller can access via the `https://developer.android.com/reference/android/content/pm/LauncherApps` APIs.

If the caller is running on a managed profile, it'll return only the current profile.
Otherwise it'll return the same list as `https://developer.android.com/reference/android/os/UserManager#getUserProfiles()` would.

To get hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/os/UserHandle>` | <br /> |

### getShortcutBadgedIconDrawable

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Drawable getShortcutBadgedIconDrawable (ShortcutInfo shortcut, 
                int density)
```

Returns the shortcut icon with badging appropriate for the profile.

The calling launcher application must be allowed to access the shortcut information,
as defined in `https://developer.android.com/reference/android/content/pm/LauncherApps#hasShortcutHostPermission()`.

The returned drawable is subject to the same size capping limits as described
in `https://developer.android.com/reference/android/content/pm/PackageManager#getApplicationIcon(android.content.pm.ApplicationInfo)`.

<br />

<br />

| Parameters ||
|---|---|
| `shortcut` | `ShortcutInfo` <br /> |
| `density` | `int`: Optional density for the icon, or 0 to use the default density. Use <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable` | A badged icon for the shortcut. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked, or when the `user` user is locked or not running. |

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager`
- `https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutIconDrawable(android.content.pm.ShortcutInfo,%20int)`
- `https://developer.android.com/reference/android/util/DisplayMetrics`

### getShortcutConfigActivityIntent

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public IntentSender getShortcutConfigActivityIntent (LauncherActivityInfo info)
```

Returns an intent sender which can be used to start the configure activity for creating
custom shortcuts. Use this method if the provider is in another profile as you are not
allowed to start an activity in another profile.

The caller should receive `https://developer.android.com/reference/android/content/pm/LauncherApps.PinItemRequest` in onActivityResult on
`https://developer.android.com/reference/android/app/Activity#RESULT_OK`.

Callers must be allowed to access the shortcut information, as defined in `https://developer.android.com/reference/android/content/pm/LauncherApps#hasShortcutHostPermission()`.

<br />

| Parameters ||
|---|---|
| `info` | `LauncherActivityInfo`: a configuration activity returned by `https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutConfigActivityList(java.lang.String,%20android.os.UserHandle)` This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/IntentSender` | This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked or not running. |
| `https://developer.android.com/reference/java/lang/SecurityException` | if `https://developer.android.com/reference/android/content/pm/LauncherApps#hasShortcutHostPermission()` is false. |

**See also:**

- `https://developer.android.com/reference/android/content/pm/LauncherApps#getPinItemRequest(android.content.Intent)`
- `https://developer.android.com/reference/android/content/Intent#ACTION_CREATE_SHORTCUT`
- `https://developer.android.com/reference/android/app/Activity#startIntentSenderForResult(android.content.IntentSender,%20int,%20android.content.Intent,%20int,%20int,%20int)`

### getShortcutConfigActivityList

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<LauncherActivityInfo> getShortcutConfigActivityList (String packageName, 
                UserHandle user)
```

Retrieves a list of config activities for creating `https://developer.android.com/reference/android/content/pm/ShortcutInfo`.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: The specific package to query. If null, it checks all installed packages in the profile. <br /> |
| `user` | `UserHandle`: The UserHandle of the profile. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/LauncherActivityInfo>` | List of config activities. Can be an empty list but will not be null. Empty list will be returned for user-profiles that have items restricted on home screen. <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/Intent#ACTION_CREATE_SHORTCUT`
- `https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutConfigActivityIntent(android.content.pm.LauncherActivityInfo)`

### getShortcutIconDrawable

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Drawable getShortcutIconDrawable (ShortcutInfo shortcut, 
                int density)
```

Returns the icon for this shortcut, without any badging for the profile.

The calling launcher application must be allowed to access the shortcut information,
as defined in `https://developer.android.com/reference/android/content/pm/LauncherApps#hasShortcutHostPermission()`.

The returned drawable is subject to the same size capping limits as described
in `https://developer.android.com/reference/android/content/pm/PackageManager#getApplicationIcon(android.content.pm.ApplicationInfo)`.

<br />

<br />

| Parameters ||
|---|---|
| `shortcut` | `ShortcutInfo`: This value cannot be `null`. <br /> |
| `density` | `int`: The preferred density of the icon, zero for default density. Use density DPI values from `https://developer.android.com/reference/android/util/DisplayMetrics`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable` | The drawable associated with the shortcut. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked, or when the `user` user is locked or not running. |

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager`
- `https://developer.android.com/reference/android/content/pm/LauncherApps#getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo,%20int)`
- `https://developer.android.com/reference/android/util/DisplayMetrics`

### getShortcutIntent

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public PendingIntent getShortcutIntent (String packageName, 
                String shortcutId, 
                Bundle opts, 
                UserHandle user)
```

Returns PendingIntent associated with specified shortcut.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: The packageName of the shortcut. This value cannot be `null`. <br /> |
| `shortcutId` | `String`: The id of the shortcut. This value cannot be `null`. <br /> |
| `opts` | `Bundle`: This parameter is no longer supported. This value may be `null`. <br /> |
| `user` | `UserHandle`: The UserHandle of the profile. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/PendingIntent` | This value may be `null`. <br /> |

### getShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<ShortcutInfo> getShortcuts (LauncherApps.ShortcutQuery query, 
                UserHandle user)
```

Returns `https://developer.android.com/reference/android/content/pm/ShortcutInfo`s that match `query`.

Callers must be allowed to access the shortcut information, as defined in `https://developer.android.com/reference/android/content/pm/LauncherApps#hasShortcutHostPermission()`.

<br />

| Parameters ||
|---|---|
| `query` | `LauncherApps.ShortcutQuery`: result includes shortcuts matching this query. This value cannot be `null`. <br /> |
| `user` | `UserHandle`: The UserHandle of the profile. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo>` | the IDs of `https://developer.android.com/reference/android/content/pm/ShortcutInfo`s that match the query. This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked, or when the `user` user is locked or not running. |

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager`

### getSuspendedPackageLauncherExtras

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Bundle getSuspendedPackageLauncherExtras (String packageName, 
                UserHandle user)
```

Gets the launcher extras supplied to the system when the given package was suspended via
`PackageManager#setPackagesSuspended(String[], boolean, PersistableBundle,
PersistableBundle, String)`.

The contents of this `https://developer.android.com/reference/android/os/Bundle` are supposed to be a contract between the suspending
app and the launcher.

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

Note: This just returns whatever extras were provided to the system, *which might
even be `null`.*

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: The package for which to fetch the launcher extras. <br /> |
| `user` | `UserHandle`: The `https://developer.android.com/reference/android/os/UserHandle` of the profile. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/Bundle` | A `https://developer.android.com/reference/android/os/Bundle` of launcher extras. Or `null` if the package is not currently suspended. <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/pm/LauncherApps.Callback#onPackagesSuspended(java.lang.String[],%20android.os.UserHandle,%20android.os.Bundle)`
- `https://developer.android.com/reference/android/content/pm/PackageManager#isPackageSuspended()`

### hasShortcutHostPermission

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasShortcutHostPermission ()
```

Returns whether the caller can access the shortcut information. Access is currently
available to:

- The current launcher (or default launcher if there is no set current launcher).
- The currently active voice interaction service.

Note when this method returns `false`, it may be a temporary situation because
the user is trying a new launcher application. The user may decide to change the default
launcher back to the calling application again, so even if a launcher application loses
this permission, it does **not** have to purge pinned shortcut information.
If the calling launcher application contains pinned shortcuts, they will still work,
even though the caller no longer has the shortcut host permission.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager`

### isActivityEnabled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isActivityEnabled (ComponentName component, 
                UserHandle user)
```

Checks if the activity exists and it enabled for a profile.

The activity may still not be exported, in which case `https://developer.android.com/reference/android/content/pm/LauncherApps#startMainActivity(android.content.ComponentName,%20android.os.UserHandle,%20android.graphics.Rect,%20android.os.Bundle)` will
throw a `https://developer.android.com/reference/java/lang/SecurityException` unless the caller has the same UID as the target app's.

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

<br />

| Parameters ||
|---|---|
| `component` | `ComponentName`: The activity to check. <br /> |
| `user` | `UserHandle`: The UserHandle of the profile. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the activity exists and is enabled. <br /> |

### isPackageEnabled

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isPackageEnabled (String packageName, 
                UserHandle user)
```

Checks if the package is installed and enabled for a profile.

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: The package to check. <br /> |
| `user` | `UserHandle`: The UserHandle of the profile. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the package exists and is enabled. <br /> |

### pinShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void pinShortcuts (String packageName, 
                List<String> shortcutIds, 
                UserHandle user)
```

Pin shortcuts on a package.

This API is **NOT** cumulative; this will replace all pinned shortcuts for the package.
However, different launchers may have different set of pinned shortcuts.

The calling launcher application must be allowed to access the shortcut information,
as defined in `https://developer.android.com/reference/android/content/pm/LauncherApps#hasShortcutHostPermission()`.

For user-profiles with items restricted on home screen, caller must have the required
permission.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: The target package name. This value cannot be `null`. <br /> |
| `shortcutIds` | `List`: The IDs of the shortcut to be pinned. This value cannot be `null`. <br /> |
| `user` | `UserHandle`: The UserHandle of the profile. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked, or when the `user` user is locked or not running. |

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager`

### registerCallback

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void registerCallback (LauncherApps.Callback callback)
```

Registers a callback for changes to packages in this user and managed profiles.

To receive callbacks for hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

This callback will also receive changes to the `https://developer.android.com/reference/android/content/pm/LauncherUserInfo#getUserConfig()`,
allowing clients to monitor updates to the user-specific configuration.

<br />

| Parameters ||
|---|---|
| `callback` | `LauncherApps.Callback`: The callback to register. <br /> |

### registerCallback

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void registerCallback (LauncherApps.Callback callback, 
                Handler handler)
```

Registers a callback for changes to packages in this user and managed profiles.

To receive callbacks for hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

This callback will also receive changes to the `https://developer.android.com/reference/android/content/pm/LauncherUserInfo#getUserConfig()`,
allowing clients to monitor updates to the user-specific configuration.

<br />

| Parameters ||
|---|---|
| `callback` | `LauncherApps.Callback`: The callback to register. <br /> |
| `handler` | `Handler`: that should be used to post callbacks on, may be null. <br /> |

### registerPackageInstallerSessionCallback

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void registerPackageInstallerSessionCallback (Executor executor, 
                PackageInstaller.SessionCallback callback)
```

Register a callback to watch for session lifecycle events in this user and managed profiles.
Callers need to either declare \<queries\> element with the specific package name in the
app's manifest, have the android.permission.QUERY_ALL_PACKAGES, or be the session owner to
watch for these events.

Session callbacks are not sent for user-profiles that have items restricted on home
screen.

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: `https://developer.android.com/reference/java/util/concurrent/Executor` to handle the callbacks, cannot be null. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `PackageInstaller.SessionCallback`: The callback to register. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/pm/PackageInstaller#registerSessionCallback(android.content.pm.PackageInstaller.SessionCallback)`

### resolveActivity

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LauncherActivityInfo resolveActivity (Intent intent, 
                UserHandle user)
```

Returns the activity info for a given intent and user handle, if it resolves. Otherwise it
returns null.

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

For the returned `https://developer.android.com/reference/android/content/pm/LauncherActivityInfo` object, the App Lock fields
(`https://developer.android.com/reference/android/content/pm/ApplicationInfo#isAppLockEnabled` and `https://developer.android.com/reference/android/content/pm/ApplicationInfo#isAppLockSupported`)
within the underlying `https://developer.android.com/reference/android/content/pm/ApplicationInfo` (retrieved via
`https://developer.android.com/reference/android/content/pm/LauncherActivityInfo#getApplicationInfo()`) are present if the caller has the
`https://developer.android.com/reference/android/Manifest.permission#LOCK_APPS` permission. See
`https://developer.android.com/reference/android/content/pm/PackageManager#getEnableAppLockIntentForPackage(java.lang.String,%20boolean)` for more information about App Lock.

<br />

| Parameters ||
|---|---|
| `intent` | `Intent`: The intent to find a match for. <br /> |
| `user` | `UserHandle`: The profile to look in for a match. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/pm/LauncherActivityInfo` | An activity info object if there is a match. <br /> |

### setArchiveCompatibility

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setArchiveCompatibility (LauncherApps.ArchiveCompatibilityParams params)
```

Disable different archive compatibility options of the launcher for the caller of this
method.

<br />

| Parameters ||
|---|---|
| `params` | `LauncherApps.ArchiveCompatibilityParams`: This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/pm/LauncherApps.ArchiveCompatibilityParams`

### shouldHideFromSuggestions

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean shouldHideFromSuggestions (String packageName, 
                UserHandle user)
```

Returns whether a package should be hidden from suggestions to the user. Currently, this
could be done because the package was marked as distracting to the user via
`PackageManager.setDistractingPackageRestrictions(String[], int)`.

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: The package for which to check. This value cannot be `null`. <br /> |
| `user` | `UserHandle`: the `https://developer.android.com/reference/android/os/UserHandle` of the profile. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### startAppDetailsActivity

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void startAppDetailsActivity (ComponentName component, 
                UserHandle user, 
                Rect sourceBounds, 
                Bundle opts)
```

Starts the settings activity to show the application details for a
package in the specified profile.

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

<br />

| Parameters ||
|---|---|
| `component` | `ComponentName`: The ComponentName of the package to launch settings for. <br /> |
| `user` | `UserHandle`: The UserHandle of the profile <br /> |
| `sourceBounds` | `Rect`: The Rect containing the source bounds of the clicked icon <br /> |
| `opts` | `Bundle`: Options to pass to startActivity <br /> |

### startMainActivity

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void startMainActivity (ComponentName component, 
                UserHandle user, 
                Rect sourceBounds, 
                Bundle opts)
```

Starts a Main activity in the specified profile.

If the user in question is a hidden profile `https://developer.android.com/reference/android/os/UserManager#USER_TYPE_PROFILE_PRIVATE`,
caller should have normal `https://developer.android.com/reference/android/Manifest.permission#ACCESS_HIDDEN_PROFILES`
permission and the `https://developer.android.com/reference/android/app/role/RoleManager#ROLE_HOME` role.

<br />

| Parameters ||
|---|---|
| `component` | `ComponentName`: The ComponentName of the activity to launch <br /> |
| `user` | `UserHandle`: The UserHandle of the profile <br /> |
| `sourceBounds` | `Rect`: The Rect containing the source bounds of the clicked icon <br /> |
| `opts` | `Bundle`: Options to pass to startActivity <br /> |

### startPackageInstallerSessionDetailsActivity

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void startPackageInstallerSessionDetailsActivity (PackageInstaller.SessionInfo sessionInfo, 
                Rect sourceBounds, 
                Bundle opts)
```

Starts an activity to show the details of the specified session.

<br />

| Parameters ||
|---|---|
| `sessionInfo` | `PackageInstaller.SessionInfo`: The SessionInfo of the session. This value cannot be `null`. <br /> |
| `sourceBounds` | `Rect`: The Rect containing the source bounds of the clicked icon. This value may be `null`. <br /> |
| `opts` | `Bundle`: Options to pass to startActivity. This value may be `null`. <br /> |

### startShortcut

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void startShortcut (String packageName, 
                String shortcutId, 
                Rect sourceBounds, 
                Bundle startActivityOptions, 
                UserHandle user)
```

Starts a shortcut.

The calling launcher application must be allowed to access the shortcut information,
as defined in `https://developer.android.com/reference/android/content/pm/LauncherApps#hasShortcutHostPermission()`.

<br />

| Parameters ||
|---|---|
| `packageName` | `String`: The target shortcut package name. This value cannot be `null`. <br /> |
| `shortcutId` | `String`: The target shortcut ID. This value cannot be `null`. <br /> |
| `sourceBounds` | `Rect`: The Rect containing the source bounds of the clicked icon. This value may be `null`. <br /> |
| `startActivityOptions` | `Bundle`: Options to pass to startActivity. This value may be `null`. <br /> |
| `user` | `UserHandle`: The UserHandle of the profile. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/ActivityNotFoundException` | failed to start shortcut. (e.g. the shortcut no longer exists, is disabled, the intent receiver activity doesn't exist, etc) |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked, or when the `user` user is locked or not running. |

### startShortcut

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void startShortcut (ShortcutInfo shortcut, 
                Rect sourceBounds, 
                Bundle startActivityOptions)
```

Launches a shortcut.

The calling launcher application must be allowed to access the shortcut information,
as defined in `https://developer.android.com/reference/android/content/pm/LauncherApps#hasShortcutHostPermission()`.

<br />

| Parameters ||
|---|---|
| `shortcut` | `ShortcutInfo`: The target shortcut. This value cannot be `null`. <br /> |
| `sourceBounds` | `Rect`: The Rect containing the source bounds of the clicked icon. This value may be `null`. <br /> |
| `startActivityOptions` | `Bundle`: Options to pass to startActivity. This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/ActivityNotFoundException` | failed to start shortcut. (e.g. the shortcut no longer exists, is disabled, the intent receiver activity doesn't exist, etc) |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked, or when the `user` user is locked or not running. |

### unregisterCallback

Added in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterCallback (LauncherApps.Callback callback)
```

Unregisters a callback that was previously registered.

<br />

| Parameters ||
|---|---|
| `callback` | `LauncherApps.Callback`: The callback to unregister. <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/pm/LauncherApps#registerCallback(android.content.pm.LauncherApps.Callback)`

### unregisterPackageInstallerSessionCallback

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterPackageInstallerSessionCallback (PackageInstaller.SessionCallback callback)
```

Unregisters a callback that was previously registered.

<br />

| Parameters ||
|---|---|
| `callback` | `PackageInstaller.SessionCallback`: The callback to unregister. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/pm/LauncherApps#registerPackageInstallerSessionCallback(java.util.concurrent.Executor,%20android.content.pm.PackageInstaller.SessionCallback)`