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

Commit 7f7372ae authored by Sunny Goyal's avatar Sunny Goyal
Browse files

Adding AppWidgetManager.isRequestPinAppWidgetSupported

Launchers can choose to implement support pin shortcut or pin appwidget
or both by specifying different actions in the intent filter

Test: Automated tests and CTS
Bug: 34174006
Change-Id: I4456dbb943cfba11d465556f0732f0ed629ab3ba
parent 29d20fc0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -6841,6 +6841,7 @@ package android.appwidget {
    method public java.util.List<android.appwidget.AppWidgetProviderInfo> getInstalledProviders();
    method public java.util.List<android.appwidget.AppWidgetProviderInfo> getInstalledProvidersForProfile(android.os.UserHandle);
    method public static android.appwidget.AppWidgetManager getInstance(android.content.Context);
    method public boolean isRequestPinAppWidgetSupported();
    method public void notifyAppWidgetViewDataChanged(int[], int);
    method public void notifyAppWidgetViewDataChanged(int, int);
    method public void partiallyUpdateAppWidget(int[], android.widget.RemoteViews);
@@ -9836,7 +9837,8 @@ package android.content.pm {
    method public void startShortcut(java.lang.String, java.lang.String, android.graphics.Rect, android.os.Bundle, android.os.UserHandle);
    method public void startShortcut(android.content.pm.ShortcutInfo, android.graphics.Rect, android.os.Bundle);
    method public void unregisterCallback(android.content.pm.LauncherApps.Callback);
    field public static final java.lang.String ACTION_CONFIRM_PIN_ITEM = "android.content.pm.action.CONFIRM_PIN_ITEM";
    field public static final java.lang.String ACTION_CONFIRM_PIN_APPWIDGET = "android.content.pm.action.CONFIRM_PIN_APPWIDGET";
    field public static final java.lang.String ACTION_CONFIRM_PIN_SHORTCUT = "android.content.pm.action.CONFIRM_PIN_SHORTCUT";
    field public static final java.lang.String EXTRA_PIN_ITEM_REQUEST = "android.content.pm.extra.PIN_ITEM_REQUEST";
  }
+3 −1
Original line number Diff line number Diff line
@@ -7177,6 +7177,7 @@ package android.appwidget {
    method public java.util.List<android.appwidget.AppWidgetProviderInfo> getInstalledProviders();
    method public java.util.List<android.appwidget.AppWidgetProviderInfo> getInstalledProvidersForProfile(android.os.UserHandle);
    method public static android.appwidget.AppWidgetManager getInstance(android.content.Context);
    method public boolean isRequestPinAppWidgetSupported();
    method public void notifyAppWidgetViewDataChanged(int[], int);
    method public void notifyAppWidgetViewDataChanged(int, int);
    method public void partiallyUpdateAppWidget(int[], android.widget.RemoteViews);
@@ -10269,7 +10270,8 @@ package android.content.pm {
    method public void startShortcut(java.lang.String, java.lang.String, android.graphics.Rect, android.os.Bundle, android.os.UserHandle);
    method public void startShortcut(android.content.pm.ShortcutInfo, android.graphics.Rect, android.os.Bundle);
    method public void unregisterCallback(android.content.pm.LauncherApps.Callback);
    field public static final java.lang.String ACTION_CONFIRM_PIN_ITEM = "android.content.pm.action.CONFIRM_PIN_ITEM";
    field public static final java.lang.String ACTION_CONFIRM_PIN_APPWIDGET = "android.content.pm.action.CONFIRM_PIN_APPWIDGET";
    field public static final java.lang.String ACTION_CONFIRM_PIN_SHORTCUT = "android.content.pm.action.CONFIRM_PIN_SHORTCUT";
    field public static final java.lang.String EXTRA_PIN_ITEM_REQUEST = "android.content.pm.extra.PIN_ITEM_REQUEST";
  }
+3 −1
Original line number Diff line number Diff line
@@ -6863,6 +6863,7 @@ package android.appwidget {
    method public java.util.List<android.appwidget.AppWidgetProviderInfo> getInstalledProviders();
    method public java.util.List<android.appwidget.AppWidgetProviderInfo> getInstalledProvidersForProfile(android.os.UserHandle);
    method public static android.appwidget.AppWidgetManager getInstance(android.content.Context);
    method public boolean isRequestPinAppWidgetSupported();
    method public void notifyAppWidgetViewDataChanged(int[], int);
    method public void notifyAppWidgetViewDataChanged(int, int);
    method public void partiallyUpdateAppWidget(int[], android.widget.RemoteViews);
@@ -9864,7 +9865,8 @@ package android.content.pm {
    method public void startShortcut(java.lang.String, java.lang.String, android.graphics.Rect, android.os.Bundle, android.os.UserHandle);
    method public void startShortcut(android.content.pm.ShortcutInfo, android.graphics.Rect, android.os.Bundle);
    method public void unregisterCallback(android.content.pm.LauncherApps.Callback);
    field public static final java.lang.String ACTION_CONFIRM_PIN_ITEM = "android.content.pm.action.CONFIRM_PIN_ITEM";
    field public static final java.lang.String ACTION_CONFIRM_PIN_APPWIDGET = "android.content.pm.action.CONFIRM_PIN_APPWIDGET";
    field public static final java.lang.String ACTION_CONFIRM_PIN_SHORTCUT = "android.content.pm.action.CONFIRM_PIN_SHORTCUT";
    field public static final java.lang.String EXTRA_PIN_ITEM_REQUEST = "android.content.pm.extra.PIN_ITEM_REQUEST";
  }
+13 −0
Original line number Diff line number Diff line
@@ -1071,6 +1071,18 @@ public class AppWidgetManager {
        }
    }

    /**
     * Return {@code TRUE} if the default launcher supports
     * {@link #requestPinAppWidget(ComponentName, PendingIntent)}
     */
    public boolean isRequestPinAppWidgetSupported() {
        try {
            return mService.isRequestPinAppWidgetSupported();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Request to pin an app widget on the current launcher. It's up to the launcher to accept this
     * request (optionally showing a user confirmation). If the request is accepted, the caller will
@@ -1095,6 +1107,7 @@ public class AppWidgetManager {
     *
     * @see android.content.pm.ShortcutManager#isRequestPinShortcutSupported()
     * @see android.content.pm.ShortcutManager#requestPinShortcut(ShortcutInfo, IntentSender)
     * @see #isRequestPinAppWidgetSupported()
     *
     * @throws IllegalStateException The caller doesn't have a foreground activity or a foreground
     * service or when the user is locked.
+1 −1
Original line number Diff line number Diff line
@@ -71,5 +71,5 @@ interface IShortcutService {

    void applyRestore(in byte[] payload, int user);

    boolean isRequestPinShortcutSupported(int user);
    boolean isRequestPinItemSupported(int user, int requestType);
}
 No newline at end of file
Loading