List of usage examples for android.content.pm ApplicationInfo loadDescription
public CharSequence loadDescription(PackageManager pm)
From source file:com.android.leanlauncher.IconCache.java
/** * Gets an entry for the package, which can be used as a fallback entry for various components. * This method is not thread safe, it must be called from a synchronized method. *//*from w w w. j av a 2 s . c om*/ private CacheEntry getEntryForPackage(String packageName, UserHandleCompat user) { ComponentName cn = new ComponentName(packageName, EMPTY_CLASS_NAME); CacheKey cacheKey = new CacheKey(cn, user); CacheEntry entry = mCache.get(cacheKey); if (entry == null || entry.icon == null) { entry = new CacheEntry(); try { ApplicationInfo info = mPackageManager.getApplicationInfo(packageName, 0); entry.title = info.loadLabel(mPackageManager); entry.contentDescription = info.loadDescription(mPackageManager); Drawable defaultDrawable = info.loadIcon(mPackageManager); if (!TextUtils.isEmpty(mCurrentIconTheme)) { entry.icon = createNewIconBitmap(null, packageName, null, defaultDrawable); } if (entry.icon == null) { // pick default icon Log.d(TAG, packageName + " icon NOT FOUND in theme = " + mCurrentIconTheme); entry.icon = Utilities.createIconBitmap(defaultDrawable, mContext); } mCache.put(cacheKey, entry); } catch (NameNotFoundException e) { if (DEBUG) Log.d(TAG, "Application not installed " + packageName); } } return entry; }