Show package name if the title is empty
See comment #33 on b/245517507
Fix: 245517507
Test: verify that if title is empty, packagename is shown instead
Flag: no flag
Change-Id: I86e5fa6710f00448ce69df74f26d5ca7bafd0f48
diff --git a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
index bdc4410..04816f2 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
@@ -329,9 +329,11 @@
if (entry.bitmap.isNullOrLowRes()) return;
CharSequence entryTitle = cachingLogic.getLabel(object);
- if (entryTitle == null) {
- Log.wtf(TAG, "No label returned from caching logic instance: " + cachingLogic);
- entryTitle = "";
+ if (TextUtils.isEmpty(entryTitle)) {
+ if (entryTitle == null) {
+ Log.wtf(TAG, "No label returned from caching logic instance: " + cachingLogic);
+ }
+ entryTitle = componentName.getPackageName();;
}
entry.title = entryTitle;
@@ -490,6 +492,9 @@
@NonNull final T object, @NonNull final CacheEntry entry,
@NonNull final CachingLogic<T> cachingLogic, @NonNull final UserHandle user) {
entry.title = cachingLogic.getLabel(object);
+ if (TextUtils.isEmpty(entry.title)) {
+ entry.title = cachingLogic.getComponent(object).getPackageName();
+ }
entry.contentDescription = getUserBadgedLabel(
cachingLogic.getDescription(object, entry.title), user);
}