Loading core/java/android/content/pm/ShortcutManager.java +25 −3 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.app.usage.UsageStatsManager; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.IntentSender; import android.content.IntentSender; import android.graphics.drawable.AdaptiveIconDrawable; import android.os.Build.VERSION_CODES; import android.os.Build.VERSION_CODES; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; Loading Loading @@ -336,6 +337,14 @@ import java.util.List; * {@link #isRequestPinShortcutSupported()}. Based on this return value, you might decide to hide * {@link #isRequestPinShortcutSupported()}. Based on this return value, you might decide to hide * the option in your app that allows users to pin a shortcut. * 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> * <h4>Custom Activity for Pinning Shortcuts</h4> * * * <p>You can also create a specialized activity that helps users create shortcuts, complete with * <p>You can also create a specialized activity that helps users create shortcuts, complete with Loading Loading @@ -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 * <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 * 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. * 1 + 2 * {@link AdaptiveIconDrawable#getExtraInsetFraction()} to the returned size. */ */ public int getIconMaxWidth() { public int getIconMaxWidth() { Loading Loading @@ -940,8 +949,15 @@ public class ShortcutManager { * Return {@code TRUE} if the app is running on a device whose default launcher supports * Return {@code TRUE} if the app is running on a device whose default launcher supports * {@link #requestPinShortcut(ShortcutInfo, IntentSender)}. * {@link #requestPinShortcut(ShortcutInfo, IntentSender)}. * * * <p><b>Note:</b> The return value may change in subsequent calls, if the user changes * <p>The return value may change in subsequent calls if the user changes the default launcher * the default launcher app. * 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() { public boolean isRequestPinShortcutSupported() { try { try { Loading @@ -965,6 +981,12 @@ public class ShortcutManager { * package calls this API multiple times in a row. One possible strategy is to ignore any * package calls this API multiple times in a row. One possible strategy is to ignore any * previous requests. * 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 * @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 * 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. * to be set, the target shortcut must be enabled. Loading Loading
core/java/android/content/pm/ShortcutManager.java +25 −3 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.app.usage.UsageStatsManager; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.content.IntentSender; import android.content.IntentSender; import android.graphics.drawable.AdaptiveIconDrawable; import android.os.Build.VERSION_CODES; import android.os.Build.VERSION_CODES; import android.os.RemoteException; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceManager; Loading Loading @@ -336,6 +337,14 @@ import java.util.List; * {@link #isRequestPinShortcutSupported()}. Based on this return value, you might decide to hide * {@link #isRequestPinShortcutSupported()}. Based on this return value, you might decide to hide * the option in your app that allows users to pin a shortcut. * 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> * <h4>Custom Activity for Pinning Shortcuts</h4> * * * <p>You can also create a specialized activity that helps users create shortcuts, complete with * <p>You can also create a specialized activity that helps users create shortcuts, complete with Loading Loading @@ -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 * <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 * 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. * 1 + 2 * {@link AdaptiveIconDrawable#getExtraInsetFraction()} to the returned size. */ */ public int getIconMaxWidth() { public int getIconMaxWidth() { Loading Loading @@ -940,8 +949,15 @@ public class ShortcutManager { * Return {@code TRUE} if the app is running on a device whose default launcher supports * Return {@code TRUE} if the app is running on a device whose default launcher supports * {@link #requestPinShortcut(ShortcutInfo, IntentSender)}. * {@link #requestPinShortcut(ShortcutInfo, IntentSender)}. * * * <p><b>Note:</b> The return value may change in subsequent calls, if the user changes * <p>The return value may change in subsequent calls if the user changes the default launcher * the default launcher app. * 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() { public boolean isRequestPinShortcutSupported() { try { try { Loading @@ -965,6 +981,12 @@ public class ShortcutManager { * package calls this API multiple times in a row. One possible strategy is to ignore any * package calls this API multiple times in a row. One possible strategy is to ignore any * previous requests. * 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 * @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 * 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. * to be set, the target shortcut must be enabled. Loading