Adding support for updating the pinned shortcuts without updating

the ID map

Bug: 30654182
Change-Id: I30082bd87466a29b7bafe1e8cbf1446e1d1e4f3e
This commit is contained in:
Sunny Goyal 2016-08-04 12:03:52 -07:00
parent 49a1ab9006
commit 50941fb8a6
1 changed files with 17 additions and 8 deletions

View File

@ -1179,7 +1179,12 @@ public class LauncherModel extends BroadcastReceiver
@Override
public void onShortcutsChanged(String packageName, List<ShortcutInfoCompat> shortcuts,
UserHandleCompat user) {
enqueueItemUpdatedTask(new ShortcutsChangedTask(packageName, shortcuts, user));
enqueueItemUpdatedTask(new ShortcutsChangedTask(packageName, shortcuts, user, true));
}
public void updatePinnedShortcuts(String packageName, List<ShortcutInfoCompat> shortcuts,
UserHandleCompat user) {
enqueueItemUpdatedTask(new ShortcutsChangedTask(packageName, shortcuts, user, false));
}
/**
@ -3317,15 +3322,17 @@ public class LauncherModel extends BroadcastReceiver
}
private class ShortcutsChangedTask implements Runnable {
private String mPackageName;
private List<ShortcutInfoCompat> mShortcuts;
private UserHandleCompat mUser;
private final String mPackageName;
private final List<ShortcutInfoCompat> mShortcuts;
private final UserHandleCompat mUser;
private final boolean mUpdateIdMap;
public ShortcutsChangedTask(String packageName, List<ShortcutInfoCompat> shortcuts,
UserHandleCompat user) {
UserHandleCompat user, boolean updateIdMap) {
mPackageName = packageName;
mShortcuts = shortcuts;
mUser = user;
mUpdateIdMap = updateIdMap;
}
@Override
@ -3366,9 +3373,11 @@ public class LauncherModel extends BroadcastReceiver
}
bindUpdatedShortcuts(updatedShortcutInfos, mUser);
// Update the deep shortcut map, in case the list of ids has changed for an activity.
updateDeepShortcutMap(mPackageName, mUser, mShortcuts);
bindDeepShortcuts();
if (mUpdateIdMap) {
// Update the deep shortcut map if the list of ids has changed for an activity.
updateDeepShortcutMap(mPackageName, mUser, mShortcuts);
bindDeepShortcuts();
}
}
}