Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6be88a1 authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Adding support for apps to return PinItemRequest to launchers

as a result of Intent.ACTION_CREATE_SHORTCUT

> Adding API to allow launchers to query shortcut config activities in
  managed profiles.
> Adding API to allow the default Launcher to start the shortcut config
  activity in managed profiles.
> Updating the ACTION_CREATE_SHORTCUT documentation to represend changes
  in the expected result.

Test: Manual tests and all the unit tests
adb shell am instrument -e class com.android.server.pm.ShortcutManagerTest1 -w com.android.frameworks.servicestests
... to test10

Change-Id: I785c4f2fba782b864cc401ac7905330ea4498289
parent e5dfa979
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -8981,10 +8981,10 @@ package android.content {
    field public static final java.lang.String EXTRA_RESTRICTIONS_LIST = "android.intent.extra.restrictions_list";
    field public static final java.lang.String EXTRA_RESULT_RECEIVER = "android.intent.extra.RESULT_RECEIVER";
    field public static final java.lang.String EXTRA_RETURN_RESULT = "android.intent.extra.RETURN_RESULT";
    field public static final java.lang.String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON";
    field public static final java.lang.String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE";
    field public static final java.lang.String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT";
    field public static final java.lang.String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME";
    field public static final java.lang.String EXTRA_SHUTDOWN_USERSPACE_ONLY = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY";
    field public static final java.lang.String EXTRA_STREAM = "android.intent.extra.STREAM";
    field public static final java.lang.String EXTRA_SUBJECT = "android.intent.extra.SUBJECT";
@@ -9758,6 +9758,8 @@ package android.content.pm {
    method public android.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int, android.os.UserHandle);
    method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent);
    method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int);
    method public android.content.IntentSender getShortcutConfigActivityIntent(android.content.pm.LauncherActivityInfo);
    method public java.util.List<android.content.pm.LauncherActivityInfo> getShortcutConfigActivityList(java.lang.String, android.os.UserHandle);
    method public android.graphics.drawable.Drawable getShortcutIconDrawable(android.content.pm.ShortcutInfo, int);
    method public java.util.List<android.content.pm.ShortcutInfo> getShortcuts(android.content.pm.LauncherApps.ShortcutQuery, android.os.UserHandle);
    method public boolean hasShortcutHostPermission();
@@ -10356,6 +10358,7 @@ package android.content.pm {
  public class ShortcutManager {
    method public boolean addDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>);
    method public android.content.Intent createShortcutResultIntent(android.content.pm.ShortcutInfo);
    method public void disableShortcuts(java.util.List<java.lang.String>);
    method public void disableShortcuts(java.util.List<java.lang.String>, java.lang.CharSequence);
    method public void enableShortcuts(java.util.List<java.lang.String>);
+7 −4
Original line number Diff line number Diff line
@@ -9363,10 +9363,10 @@ package android.content {
    field public static final java.lang.String EXTRA_RESULT_NEEDED = "android.intent.extra.RESULT_NEEDED";
    field public static final java.lang.String EXTRA_RESULT_RECEIVER = "android.intent.extra.RESULT_RECEIVER";
    field public static final java.lang.String EXTRA_RETURN_RESULT = "android.intent.extra.RETURN_RESULT";
    field public static final java.lang.String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON";
    field public static final java.lang.String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE";
    field public static final java.lang.String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT";
    field public static final java.lang.String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME";
    field public static final java.lang.String EXTRA_SHUTDOWN_USERSPACE_ONLY = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY";
    field public static final java.lang.String EXTRA_SPLIT_NAME = "android.intent.extra.SPLIT_NAME";
    field public static final java.lang.String EXTRA_STREAM = "android.intent.extra.STREAM";
@@ -10175,6 +10175,8 @@ package android.content.pm {
    method public android.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int, android.os.UserHandle);
    method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent);
    method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int);
    method public android.content.IntentSender getShortcutConfigActivityIntent(android.content.pm.LauncherActivityInfo);
    method public java.util.List<android.content.pm.LauncherActivityInfo> getShortcutConfigActivityList(java.lang.String, android.os.UserHandle);
    method public android.graphics.drawable.Drawable getShortcutIconDrawable(android.content.pm.ShortcutInfo, int);
    method public java.util.List<android.content.pm.ShortcutInfo> getShortcuts(android.content.pm.LauncherApps.ShortcutQuery, android.os.UserHandle);
    method public boolean hasShortcutHostPermission();
@@ -10846,6 +10848,7 @@ package android.content.pm {
  public class ShortcutManager {
    method public boolean addDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>);
    method public android.content.Intent createShortcutResultIntent(android.content.pm.ShortcutInfo);
    method public void disableShortcuts(java.util.List<java.lang.String>);
    method public void disableShortcuts(java.util.List<java.lang.String>, java.lang.CharSequence);
    method public void enableShortcuts(java.util.List<java.lang.String>);
+7 −4
Original line number Diff line number Diff line
@@ -9006,10 +9006,10 @@ package android.content {
    field public static final java.lang.String EXTRA_RESTRICTIONS_LIST = "android.intent.extra.restrictions_list";
    field public static final java.lang.String EXTRA_RESULT_RECEIVER = "android.intent.extra.RESULT_RECEIVER";
    field public static final java.lang.String EXTRA_RETURN_RESULT = "android.intent.extra.RETURN_RESULT";
    field public static final java.lang.String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON";
    field public static final java.lang.String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE";
    field public static final java.lang.String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT";
    field public static final java.lang.String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT";
    field public static final deprecated java.lang.String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME";
    field public static final java.lang.String EXTRA_SHUTDOWN_USERSPACE_ONLY = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY";
    field public static final java.lang.String EXTRA_STREAM = "android.intent.extra.STREAM";
    field public static final java.lang.String EXTRA_SUBJECT = "android.intent.extra.SUBJECT";
@@ -9786,6 +9786,8 @@ package android.content.pm {
    method public android.content.pm.ApplicationInfo getApplicationInfo(java.lang.String, int, android.os.UserHandle);
    method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent);
    method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int);
    method public android.content.IntentSender getShortcutConfigActivityIntent(android.content.pm.LauncherActivityInfo);
    method public java.util.List<android.content.pm.LauncherActivityInfo> getShortcutConfigActivityList(java.lang.String, android.os.UserHandle);
    method public android.graphics.drawable.Drawable getShortcutIconDrawable(android.content.pm.ShortcutInfo, int);
    method public java.util.List<android.content.pm.ShortcutInfo> getShortcuts(android.content.pm.LauncherApps.ShortcutQuery, android.os.UserHandle);
    method public boolean hasShortcutHostPermission();
@@ -10387,6 +10389,7 @@ package android.content.pm {
  public class ShortcutManager {
    ctor public ShortcutManager(android.content.Context);
    method public boolean addDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>);
    method public android.content.Intent createShortcutResultIntent(android.content.pm.ShortcutInfo);
    method public void disableShortcuts(java.util.List<java.lang.String>);
    method public void disableShortcuts(java.util.List<java.lang.String>, java.lang.CharSequence);
    method public void enableShortcuts(java.util.List<java.lang.String>);
+11 −1
Original line number Diff line number Diff line
@@ -715,11 +715,13 @@ public class Intent implements Parcelable, Cloneable {
    /**
     * Activity Action: Creates a shortcut.
     * <p>Input: Nothing.</p>
     * <p>Output: An Intent representing the shortcut. The intent must contain three
     * <p>Output: An Intent representing the {@link android.content.pm.ShortcutInfo} result.</p>
     * <p>For compatibility with older versions of android the intent may also contain three
     * extras: SHORTCUT_INTENT (value: Intent), SHORTCUT_NAME (value: String),
     * and SHORTCUT_ICON (value: Bitmap) or SHORTCUT_ICON_RESOURCE
     * (value: ShortcutIconResource).</p>
     *
     * @see android.content.pm.ShortcutManager#createShortcutResultIntent
     * @see #EXTRA_SHORTCUT_INTENT
     * @see #EXTRA_SHORTCUT_NAME
     * @see #EXTRA_SHORTCUT_ICON
@@ -733,26 +735,34 @@ public class Intent implements Parcelable, Cloneable {
     * The name of the extra used to define the Intent of a shortcut.
     *
     * @see #ACTION_CREATE_SHORTCUT
     * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent}
     */
    @Deprecated
    public static final String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT";
    /**
     * The name of the extra used to define the name of a shortcut.
     *
     * @see #ACTION_CREATE_SHORTCUT
     * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent}
     */
    @Deprecated
    public static final String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME";
    /**
     * The name of the extra used to define the icon, as a Bitmap, of a shortcut.
     *
     * @see #ACTION_CREATE_SHORTCUT
     * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent}
     */
    @Deprecated
    public static final String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON";
    /**
     * The name of the extra used to define the icon, as a ShortcutIconResource, of a shortcut.
     *
     * @see #ACTION_CREATE_SHORTCUT
     * @see android.content.Intent.ShortcutIconResource
     * @deprecated Replaced with {@link android.content.pm.ShortcutManager#createShortcutResultIntent}
     */
    @Deprecated
    public static final String EXTRA_SHORTCUT_ICON_RESOURCE =
            "android.intent.extra.shortcut.ICON_RESOURCE";

+5 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.content.pm;

import android.content.ComponentName;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.IOnAppsChangedListener;
@@ -60,4 +61,8 @@ interface ILauncherApps {
            int userId);

    boolean hasShortcutHostPermission(String callingPackage);

    ParceledListSlice getShortcutConfigActivities(String packageName, in UserHandle user);
    IntentSender getShortcutConfigActivityIntent(String callingPackage, in ComponentName component,
            in UserHandle user);
}
Loading