Implement ranking for shortcuts.

- Manifest shortcuts are closest to the original icon, in rank order,
  followed by dynamic shortcuts in rank order.
- Also prevent pinned shortcuts from showing in container if they
  aren't also dynamic (only manifest and dynamic show in container).

Bug: 29822383
Bug: 29946657
Change-Id: I5cdb2ef3700daedca01987f64c245beb3f4aa5ee
This commit is contained in:
Tony Wickham
2016-07-13 17:05:52 -07:00
committed by Tony
parent 2f3b0b7e3b
commit 2c99d2ceeb
3 changed files with 40 additions and 4 deletions
@@ -81,11 +81,13 @@ public class DeepShortcutManager {
}
/**
* Gets all the shortcuts associated with the given package and user.
* Gets all the manifest and dynamic shortcuts associated with the given package and user,
* to be displayed in the shortcuts container on long press.
*/
public List<ShortcutInfoCompat> queryForAllAppShortcuts(ComponentName activity,
public List<ShortcutInfoCompat> queryForShortcutsContainer(ComponentName activity,
List<String> ids, UserHandleCompat user) {
return query(FLAG_GET_ALL, activity.getPackageName(), activity, ids, user);
return query(FLAG_MATCH_MANIFEST | FLAG_MATCH_DYNAMIC,
activity.getPackageName(), activity, ids, user);
}
/**