diff options
author | Suchi Amalapurapu <asuchitra@google.com> | 2009-11-11 16:43:59 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-11-11 16:43:59 -0800 |
commit | 07e05d0122f9161c5862fa8a93223e704b1be0f3 (patch) | |
tree | bc00d67e4426721674fa0a50e99af543325a6303 /src/com/android/packageinstaller/PackageUtil.java | |
parent | b3c0ea150748f03b748de825fadef17fe89a725b (diff) | |
parent | f075068817434dbb5e861d00f5ed23d6405ab4d9 (diff) | |
download | android_packages_apps_PackageInstaller-07e05d0122f9161c5862fa8a93223e704b1be0f3.tar.gz android_packages_apps_PackageInstaller-07e05d0122f9161c5862fa8a93223e704b1be0f3.tar.bz2 android_packages_apps_PackageInstaller-07e05d0122f9161c5862fa8a93223e704b1be0f3.zip |
am f0750688: Use nonlocalized label when installing packages. Also invoke the right method based on if its an installed application or not. just move the if condition prior to initializing the view
Merge commit 'f075068817434dbb5e861d00f5ed23d6405ab4d9' into eclair-plus-aosp
* commit 'f075068817434dbb5e861d00f5ed23d6405ab4d9':
Use nonlocalized label when installing packages.
Diffstat (limited to 'src/com/android/packageinstaller/PackageUtil.java')
-rw-r--r-- | src/com/android/packageinstaller/PackageUtil.java | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/com/android/packageinstaller/PackageUtil.java b/src/com/android/packageinstaller/PackageUtil.java index 362c9636..1e80204c 100644 --- a/src/com/android/packageinstaller/PackageUtil.java +++ b/src/com/android/packageinstaller/PackageUtil.java @@ -123,17 +123,27 @@ public class PackageUtil { CharSequence label = null; // Try to load the label from the package's resources. If an app has not explicitly // specified any label, just use the package name. - try { - label = res.getText(appInfo.labelRes); - } catch (Resources.NotFoundException e) { + if (appInfo.labelRes != 0) { + try { + label = res.getText(appInfo.labelRes); + } catch (Resources.NotFoundException e) { + } + } + if ((label == null) && (appInfo.nonLocalizedLabel != null)) { + label = appInfo.nonLocalizedLabel; + } else { label = appInfo.packageName; } Drawable icon = null; // Try to load the icon from the package's resources. If an app has not explicitly // specified any resource, just use the default icon for now. - try { - icon = res.getDrawable(appInfo.icon); - } catch (Resources.NotFoundException e) { + if (appInfo.icon != 0) { + try { + icon = res.getDrawable(appInfo.icon); + } catch (Resources.NotFoundException e) { + } + } + if (icon == null) { icon = pContext.getPackageManager().getDefaultActivityIcon(); } ((ImageView)appSnippet.findViewById(R.id.app_icon)).setImageDrawable(icon); |