summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-06-26 15:27:14 -0700
committerSunny Goyal <sunnygoyal@google.com>2014-06-27 08:20:23 -0700
commit2a6cf09be968f71f23d520f1dc3f339feb61b269 (patch)
tree20359ccafc91c3c558323043ae2aa6d7fd9fa9d2 /src/com
parent03f20ba3b2cf55d337473a200a3fd300d15f4a69 (diff)
downloadandroid_packages_apps_Trebuchet-2a6cf09be968f71f23d520f1dc3f339feb61b269.tar.gz
android_packages_apps_Trebuchet-2a6cf09be968f71f23d520f1dc3f339feb61b269.tar.bz2
android_packages_apps_Trebuchet-2a6cf09be968f71f23d520f1dc3f339feb61b269.zip
Fix issue where sometimes duplicate icons are added on homescreen when
installing a package Shortcuts placed by the user have no package in their intent. Ensure that this is accounted for when searching for duplicates. issue: 12888844 Change-Id: I2fb8b7c2b8f7cb74926904bf49a96aeb59a5a9f8
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher3/LauncherModel.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 141368c20..07389c9a7 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -842,9 +842,26 @@ public class LauncherModel extends BroadcastReceiver
*/
static boolean shortcutExists(Context context, String title, Intent intent) {
final ContentResolver cr = context.getContentResolver();
+ final Intent intentWithPkg, intentWithoutPkg;
+
+ if (intent.getComponent() != null) {
+ // If component is not null, an intent with null package will produce
+ // the same result and should also be a match.
+ if (intent.getPackage() != null) {
+ intentWithPkg = intent;
+ intentWithoutPkg = new Intent(intent).setPackage(null);
+ } else {
+ intentWithPkg = new Intent(intent).setPackage(
+ intent.getComponent().getPackageName());
+ intentWithoutPkg = intent;
+ }
+ } else {
+ intentWithPkg = intent;
+ intentWithoutPkg = intent;
+ }
Cursor c = cr.query(LauncherSettings.Favorites.CONTENT_URI,
- new String[] { "title", "intent" }, "title=? and intent=?",
- new String[] { title, intent.toUri(0) }, null);
+ new String[] { "title", "intent" }, "title=? and (intent=? or intent=?)",
+ new String[] { title, intentWithPkg.toUri(0), intentWithoutPkg.toUri(0) }, null);
boolean result = false;
try {
result = c.moveToFirst();