Merge "Address API council feedback (continued)" into nyc-mr1-dev
This commit is contained in:
@@ -41,12 +41,12 @@ interface IShortcutService {
|
||||
|
||||
boolean updateShortcuts(String packageName, in ParceledListSlice shortcuts, int userId);
|
||||
|
||||
void disableShortcuts(String packageName, in List shortcutIds, String disabledMessage,
|
||||
void disableShortcuts(String packageName, in List shortcutIds, CharSequence disabledMessage,
|
||||
int disabledMessageResId, int userId);
|
||||
|
||||
void enableShortcuts(String packageName, in List shortcutIds, int userId);
|
||||
|
||||
int getMaxShortcutCountForActivity(String packageName, int userId);
|
||||
int getMaxShortcutCountPerActivity(String packageName, int userId);
|
||||
|
||||
int getRemainingCallCount(String packageName, int userId);
|
||||
|
||||
|
||||
@@ -651,13 +651,11 @@ public class LauncherApps {
|
||||
* @param sourceBounds The Rect containing the source bounds of the clicked icon.
|
||||
* @param startActivityOptions Options to pass to startActivity.
|
||||
* @param user The UserHandle of the profile.
|
||||
* @return {@code false} when the shortcut is no longer valid (e.g. the creator application
|
||||
* has been uninstalled). {@code true} when the shortcut is still valid.
|
||||
*/
|
||||
public boolean startShortcut(@NonNull String packageName, @NonNull String shortcutId,
|
||||
public void startShortcut(@NonNull String packageName, @NonNull String shortcutId,
|
||||
@Nullable Rect sourceBounds, @Nullable Bundle startActivityOptions,
|
||||
@NonNull UserHandle user) {
|
||||
return startShortcut(packageName, shortcutId, sourceBounds, startActivityOptions,
|
||||
startShortcut(packageName, shortcutId, sourceBounds, startActivityOptions,
|
||||
user.getIdentifier());
|
||||
}
|
||||
|
||||
@@ -670,21 +668,19 @@ public class LauncherApps {
|
||||
* @param shortcut The target shortcut.
|
||||
* @param sourceBounds The Rect containing the source bounds of the clicked icon.
|
||||
* @param startActivityOptions Options to pass to startActivity.
|
||||
* @return {@code false} when the shortcut is no longer valid (e.g. the creator application
|
||||
* has been uninstalled). {@code true} when the shortcut is still valid.
|
||||
*/
|
||||
public boolean startShortcut(@NonNull ShortcutInfo shortcut,
|
||||
public void startShortcut(@NonNull ShortcutInfo shortcut,
|
||||
@Nullable Rect sourceBounds, @Nullable Bundle startActivityOptions) {
|
||||
return startShortcut(shortcut.getPackage(), shortcut.getId(),
|
||||
startShortcut(shortcut.getPackage(), shortcut.getId(),
|
||||
sourceBounds, startActivityOptions,
|
||||
shortcut.getUserId());
|
||||
}
|
||||
|
||||
private boolean startShortcut(@NonNull String packageName, @NonNull String shortcutId,
|
||||
private void startShortcut(@NonNull String packageName, @NonNull String shortcutId,
|
||||
@Nullable Rect sourceBounds, @Nullable Bundle startActivityOptions,
|
||||
int userId) {
|
||||
try {
|
||||
return mService.startShortcut(mContext.getPackageName(), packageName, shortcutId,
|
||||
mService.startShortcut(mContext.getPackageName(), packageName, shortcutId,
|
||||
sourceBounds, startActivityOptions, userId);
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
|
||||
@@ -38,7 +38,7 @@ import java.util.List;
|
||||
*
|
||||
* An application can publish shortcuts with {@link #setDynamicShortcuts(List)} and
|
||||
* {@link #addDynamicShortcuts(List)}. There can be at most
|
||||
* {@link #getMaxShortcutCountForActivity()} number of dynamic shortcuts at a time from the
|
||||
* {@link #getMaxShortcutCountPerActivity()} number of dynamic shortcuts at a time from the
|
||||
* same application.
|
||||
* A dynamic shortcut can be deleted with {@link #removeDynamicShortcuts(List)}, and apps
|
||||
* can also use {@link #removeAllDynamicShortcuts()} to delete all dynamic shortcuts.
|
||||
@@ -53,7 +53,7 @@ import java.util.List;
|
||||
* <p>The number of pinned shortcuts does not affect the number of dynamic shortcuts that can be
|
||||
* published by an application at a time.
|
||||
* No matter how many pinned shortcuts that Launcher has for an application, the
|
||||
* application can still always publish {@link #getMaxShortcutCountForActivity()} number of
|
||||
* application can still always publish {@link #getMaxShortcutCountPerActivity()} number of
|
||||
* dynamic
|
||||
* shortcuts.
|
||||
*
|
||||
@@ -135,7 +135,7 @@ public class ShortcutManager {
|
||||
* @return {@code true} if the call has succeeded. {@code false} if the call is rate-limited.
|
||||
*
|
||||
* @throws IllegalArgumentException if {@code shortcutInfoList} contains more than
|
||||
* {@link #getMaxShortcutCountForActivity()} shortcuts.
|
||||
* {@link #getMaxShortcutCountPerActivity()} shortcuts.
|
||||
*/
|
||||
public boolean setDynamicShortcuts(@NonNull List<ShortcutInfo> shortcutInfoList) {
|
||||
try {
|
||||
@@ -148,7 +148,7 @@ public class ShortcutManager {
|
||||
|
||||
/**
|
||||
* Return all dynamic shortcuts from the caller application. The number of result items
|
||||
* will not exceed the value returned by {@link #getMaxShortcutCountForActivity()}.
|
||||
* will not exceed the value returned by {@link #getMaxShortcutCountPerActivity()}.
|
||||
*/
|
||||
@NonNull
|
||||
public List<ShortcutInfo> getDynamicShortcuts() {
|
||||
@@ -259,7 +259,7 @@ public class ShortcutManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Javadoc
|
||||
* @hide old signature, kept for unit testing.
|
||||
*/
|
||||
public void disableShortcuts(@NonNull List<String> shortcutIds, int disabledMessageResId) {
|
||||
try {
|
||||
@@ -272,9 +272,16 @@ public class ShortcutManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Javadoc
|
||||
* @hide old signature, kept for unit testing.
|
||||
*/
|
||||
public void disableShortcuts(@NonNull List<String> shortcutIds, String disabledMessage) {
|
||||
disableShortcuts(shortcutIds, (CharSequence) disabledMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO Javadoc
|
||||
*/
|
||||
public void disableShortcuts(@NonNull List<String> shortcutIds, CharSequence disabledMessage) {
|
||||
try {
|
||||
mService.disableShortcuts(mContext.getPackageName(), shortcutIds,
|
||||
disabledMessage, /* disabledMessageResId =*/ 0,
|
||||
@@ -295,13 +302,21 @@ public class ShortcutManager {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @hide old signature, kept for unit testing.
|
||||
*/
|
||||
public int getMaxShortcutCountForActivity() {
|
||||
return getMaxShortcutCountPerActivity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the max number of dynamic shortcuts + manifest shortcuts that each launcher icon
|
||||
* can have at a time.
|
||||
*/
|
||||
public int getMaxShortcutCountForActivity() {
|
||||
public int getMaxShortcutCountPerActivity() {
|
||||
try {
|
||||
return mService.getMaxShortcutCountForActivity(
|
||||
return mService.getMaxShortcutCountPerActivity(
|
||||
mContext.getPackageName(), injectMyUserId());
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowFromSystemServer();
|
||||
|
||||
Reference in New Issue
Block a user