diff options
| -rw-r--r-- | core/java/android/content/pm/ShortcutManager.java | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/core/java/android/content/pm/ShortcutManager.java b/core/java/android/content/pm/ShortcutManager.java index 6cf6627f7941..c0b82b4dfee3 100644 --- a/core/java/android/content/pm/ShortcutManager.java +++ b/core/java/android/content/pm/ShortcutManager.java @@ -25,6 +25,7 @@ import android.app.usage.UsageStatsManager; import android.content.Context; import android.content.Intent; import android.content.IntentSender; +import android.graphics.drawable.AdaptiveIconDrawable; import android.os.Build.VERSION_CODES; import android.os.RemoteException; import android.os.ServiceManager; @@ -336,6 +337,14 @@ import java.util.List; * {@link #isRequestPinShortcutSupported()}. Based on this return value, you might decide to hide * the option in your app that allows users to pin a shortcut. * + * <p class="note"><strong>Note:</strong> See also the support library APIs + * {@link android.support.v4.content.pm.ShortcutManagerCompat#isRequestPinShortcutSupported( + * Context)} and + * {@link android.support.v4.content.pm.ShortcutManagerCompat#requestPinShortcut( + * Context, ShortcutInfoCompat, IntentSender)}, which works on Android versions lower than + * {@link VERSION_CODES#O} by falling back to the deprecated private intent + * {@code com.android.launcher.action.INSTALL_SHORTCUT}. + * * <h4>Custom Activity for Pinning Shortcuts</h4> * * <p>You can also create a specialized activity that helps users create shortcuts, complete with @@ -891,7 +900,7 @@ public class ShortcutManager { * * <p> Note that this method returns max width of icon's visible part. Hence, it does not take * into account the inset introduced by {@link AdaptiveIconDrawable}. To calculate bitmap image - * to function as {@link AcaptiveIconDrawable}, multiply + * to function as {@link AdaptiveIconDrawable}, multiply * 1 + 2 * {@link AdaptiveIconDrawable#getExtraInsetFraction()} to the returned size. */ public int getIconMaxWidth() { @@ -940,8 +949,15 @@ public class ShortcutManager { * Return {@code TRUE} if the app is running on a device whose default launcher supports * {@link #requestPinShortcut(ShortcutInfo, IntentSender)}. * - * <p><b>Note:</b> The return value may change in subsequent calls, if the user changes - * the default launcher app. + * <p>The return value may change in subsequent calls if the user changes the default launcher + * app. + * + * <p><b>Note:</b> See also the support library counterpart + * {@link android.support.v4.content.pm.ShortcutManagerCompat#isRequestPinShortcutSupported( + * Context)}, which supports Android versions lower than {@link VERSION_CODES#O} using the + * legacy private intent {@code com.android.launcher.action.INSTALL_SHORTCUT}. + * + * @see #requestPinShortcut(ShortcutInfo, IntentSender) */ public boolean isRequestPinShortcutSupported() { try { @@ -965,6 +981,12 @@ public class ShortcutManager { * package calls this API multiple times in a row. One possible strategy is to ignore any * previous requests. * + * <p><b>Note:</b> See also the support library counterpart + * {@link android.support.v4.content.pm.ShortcutManagerCompat#requestPinShortcut( + * Context, ShortcutInfoCompat, IntentSender)}, + * which supports Android versions lower than {@link VERSION_CODES#O} using the + * legacy private intent {@code com.android.launcher.action.INSTALL_SHORTCUT}. + * * @param shortcut Shortcut to pin. If an app wants to pin an existing (either static * or dynamic) shortcut, then it only needs to have an ID. Although other fields don't have * to be set, the target shortcut must be enabled. |