OSDN Git Service

Fallback to the default values when indexing from local resource.
authorSvetoslav <svetoslavganov@google.com>
Fri, 11 Apr 2014 22:59:17 +0000 (15:59 -0700)
committerSvetoslav <svetoslavganov@google.com>
Fri, 11 Apr 2014 23:06:41 +0000 (16:06 -0700)
If we are indexing from a local resource and the indexable resource does
not provide icon or class name or rank we fall back to the defaults.

Change-Id: Ibbed8b2a92e28799c26f5f80b3f058737535739d

src/com/android/settings/search/Index.java

index 1aeb1ff..ce273b6 100644 (file)
@@ -751,8 +751,13 @@ public class Index {
                     continue;
                 }
 
+                final int itemIconResId = (item.iconResId == 0) ? iconResId : item.iconResId;
+                final int itemRank = (item.rank == 0) ? rank : item.rank;
+                String itemClassName = (TextUtils.isEmpty(item.className))
+                        ? className : item.className;
+
                 indexFromResource(context, database, localeStr,
-                        item.xmlResId, item.className, item.iconResId, item.rank,
+                        item.xmlResId, itemClassName, itemIconResId, itemRank,
                         item.intentAction, item.intentTargetPackage,
                         item.intentTargetClass, doNotIndexKeys);
             }