The Android 7.1.1 release allows developers to define action-specific shortcuts in their apps that can be displayed in a launcher. These app shortcuts let users quickly start common or recommended tasks within an app.

Overview

Each shortcut references an intent that launches a specific action in the app when users select the shortcut. Examples of actions you can express as app shortcuts include:

Examples and source

You can find the primary implementation of this feature in the following files:

frameworks/base/services/core/java/com/android/server/policy/ShortcutManager.java
frameworks/base/services/core/java/com/android/server/pm/ShortcutPackage.java
frameworks/base/services/core/java/com/android/server/pm/ShortcutUser.java
frameworks/base/services/core/java/com/android/server/pm/ShortcutPackageInfo.java
frameworks/base/services/core/java/com/android/server/pm/ShortcutLauncher.java
frameworks/base/services/core/java/com/android/server/pm/ShortcutParser.java
frameworks/base/services/core/java/com/android/server/pm/ShortcutService.java
frameworks/base/services/core/java/com/android/server/pm/LauncherAppsService.java
frameworks/base/services/core/java/com/android/server/pm/ShortcutPackageItem.java
frameworks/base/core/java/com/android/server/backup/ShortcutBackupHelper.java
frameworks/base/core/java/android/content/pm/ShortcutManager.java
frameworks/base/core/java/android/content/pm/ShortcutServiceInternal.java
frameworks/base/core/java/android/content/pm/ShortcutInfo.java
frameworks/base/core/java/android/content/pm/LauncherApps.java

With the following files providing supporting features (called hidden APIs in ShortcutManager.java):

packages/apps/Settings/src/com/android/settings/DevelopmentSettings.java
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java

And, for an example, the Android Open Source Project Launcher version 3 supports shortcuts:

packages/apps/Launcher3/

Finally, see the following files for public Javadoc.

frameworks/base/core/java/android/content/pm/ShortcutManager.java
frameworks/base/core/java/android/content/pm/ShortcutInfo.java
frameworks/base/core/java/android/content/pm/LauncherApps.java

Implementation

The AOSP Launcher3 supports shortcuts already. In cases where a partner has its own launcher, that launcher should support shortcuts too.

In addition, some Google Mobile Services (GMS) apps have shortcuts. The OEM launcher should show shortcuts for them and ideally support "pinning" (or creating a shortcut icon) too.

See the Launcher3 source for details on how to interact with the framework for the above operations.

Validation

Use the following Android Compatibility Test Suite (CTS) tests to ensure your version of the feature (ShortcutManager and LauncherApps) works as intended:

cts/tests/tests/shortcutmanager/
cts/hostsidetests/shortcuts/

And find the unit tests for the AOSP implementation here:

frameworks/base/services/tests/servicestests/

Which includes:

src/com/android/server/pm/ShortcutManagerTest*.java

You may also employ the CTS Verifier test for shortcut manager:

cts/apps/CtsVerifier/src/com/android/cts/verifier/notifications/ShortcutThrottlingResetActivity.java