diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2016-07-20 12:35:16 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2016-07-20 15:04:23 -0700 |
commit | 860538df1d72b3840811b7a39940a224f3326066 (patch) | |
tree | 66dbe65254f01b4d386cc26bad019b669501537d /src/com/android/launcher3/LauncherModel.java | |
parent | 1f418d236122910df26f0893ba8e239989a5ee6c (diff) | |
download | android_packages_apps_Trebuchet-860538df1d72b3840811b7a39940a224f3326066.tar.gz android_packages_apps_Trebuchet-860538df1d72b3840811b7a39940a224f3326066.tar.bz2 android_packages_apps_Trebuchet-860538df1d72b3840811b7a39940a224f3326066.zip |
Fixing missing user check when updating shortcuts for an app
Change-Id: I889c555d3402fd71098af29b78eb6d959a071080
Diffstat (limited to 'src/com/android/launcher3/LauncherModel.java')
-rw-r--r-- | src/com/android/launcher3/LauncherModel.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index a75edb715..ddd60c89c 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -2782,7 +2782,7 @@ public class LauncherModel extends BroadcastReceiver for (UserHandleCompat user : mUserManager.getUserProfiles()) { List<ShortcutInfoCompat> shortcuts = mDeepShortcutManager .queryForAllShortcuts(user); - updateDeepShortcutMap(null, shortcuts); + updateDeepShortcutMap(null, user, shortcuts); } synchronized (LoaderTask.this) { if (mStopped) { @@ -2804,13 +2804,17 @@ public class LauncherModel extends BroadcastReceiver } } - // Clear all the shortcuts for the given package, and re-add the new shortcuts. - private void updateDeepShortcutMap(String packageName, List<ShortcutInfoCompat> shortcuts) { - // Remove all keys associated with the given package. + /** + * Clear all the shortcuts for the given package, and re-add the new shortcuts. + */ + private void updateDeepShortcutMap( + String packageName, UserHandleCompat user, List<ShortcutInfoCompat> shortcuts) { if (packageName != null) { Iterator<ComponentKey> keysIter = mBgDeepShortcutMap.keySet().iterator(); while (keysIter.hasNext()) { - if (keysIter.next().componentName.getPackageName().equals(packageName)) { + ComponentKey next = keysIter.next(); + if (next.componentName.getPackageName().equals(packageName) + && next.user.equals(user)) { keysIter.remove(); } } @@ -3336,7 +3340,7 @@ 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, mShortcuts); + updateDeepShortcutMap(mPackageName, mUser, mShortcuts); bindDeepShortcuts(); } } |