Add support for launcher shortcuts.

- This CL has no UI but provides the necessary backing for one.
- Adds new item type: ITEM_TYPE_DEEP_SHORTCUT, to distinguish from
  ITEM_TYPE_SHORTCUT. We can reconsider these names.
- Adds ShortcutCache, using LruCache for up to 30 dynamic shortcuts
  (pinned shortcuts are always cached in a HashMap).
- DeepShortcutManager queries for shortcuts and other things like
  pin them. In a future CL it will use the cache, but for now it
  simply makes an RPC for all queries.
- LauncherModel maintains counts for pinned shortcuts, pinning and
  unpinning when counts reach 1 or 0, respectively.
- LauncherModel maintains a map of components to lists of shortcut ids,
  which Launcher gets a copy of after it is changed in the background.
  This will allow us to know how many shortcuts an app has immediately,
  and query for details as the UI is animating.

Change-Id: Ic526f374dd10d72a261bae67f07f098fca8d8bca
This commit is contained in:
Tony Wickham
2016-05-19 11:19:39 -07:00
parent ae50284e0a
commit bfbf7f9f4a
23 changed files with 954 additions and 68 deletions

View File

@@ -641,10 +641,11 @@ public class GridSizeMigrationTask {
// calculate weight
switch (entry.itemType) {
case Favorites.ITEM_TYPE_SHORTCUT:
case Favorites.ITEM_TYPE_DEEP_SHORTCUT:
case Favorites.ITEM_TYPE_APPLICATION: {
verifyIntent(c.getString(indexIntent));
entry.weight = entry.itemType == Favorites.ITEM_TYPE_SHORTCUT
? WT_SHORTCUT : WT_APPLICATION;
entry.weight = entry.itemType == Favorites.ITEM_TYPE_APPLICATION ?
WT_APPLICATION : WT_SHORTCUT;
break;
}
case Favorites.ITEM_TYPE_FOLDER: {
@@ -715,10 +716,11 @@ public class GridSizeMigrationTask {
// calculate weight
switch (entry.itemType) {
case Favorites.ITEM_TYPE_SHORTCUT:
case Favorites.ITEM_TYPE_DEEP_SHORTCUT:
case Favorites.ITEM_TYPE_APPLICATION: {
verifyIntent(c.getString(indexIntent));
entry.weight = entry.itemType == Favorites.ITEM_TYPE_SHORTCUT
? WT_SHORTCUT : WT_APPLICATION;
entry.weight = entry.itemType == Favorites.ITEM_TYPE_APPLICATION ?
WT_APPLICATION : WT_SHORTCUT;
break;
}
case Favorites.ITEM_TYPE_APPWIDGET: {