summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuchi Amalapurapu <asuchitra@google.com>2009-12-02 15:18:13 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-12-02 15:18:13 -0800
commite1f9c798520fe35693a905c5889fd3228b8e4bec (patch)
tree306ecf7512b2e578e70c568ab7e50dc216adeb90
parentac2d5a1d314436b063e481f6acda5fc6bf34010d (diff)
parent6e7f5426c6fca12c793c4efa0cfe19dcc271bacf (diff)
downloadandroid_packages_apps_PackageInstaller-e1f9c798520fe35693a905c5889fd3228b8e4bec.tar.gz
android_packages_apps_PackageInstaller-e1f9c798520fe35693a905c5889fd3228b8e4bec.tar.bz2
android_packages_apps_PackageInstaller-e1f9c798520fe35693a905c5889fd3228b8e4bec.zip
am 6e7f5426: am ccb4dda8: Fix for 2268060, 2251223 if conditional initializing package label. Also load the label from the new pkg for existing packages Use installer\'s metrics and configuration info when creating resources for new package
Merge commit '6e7f5426c6fca12c793c4efa0cfe19dcc271bacf' into eclair-mr2-plus-aosp * commit '6e7f5426c6fca12c793c4efa0cfe19dcc271bacf': Fix for 2268060, 2251223 if conditional initializing package label.
-rwxr-xr-xsrc/com/android/packageinstaller/InstallAppProgress.java8
-rw-r--r--src/com/android/packageinstaller/PackageUtil.java12
2 files changed, 7 insertions, 13 deletions
diff --git a/src/com/android/packageinstaller/InstallAppProgress.java b/src/com/android/packageinstaller/InstallAppProgress.java
index 43de6ded..1ecc1f1e 100755
--- a/src/com/android/packageinstaller/InstallAppProgress.java
+++ b/src/com/android/packageinstaller/InstallAppProgress.java
@@ -144,13 +144,9 @@ public class InstallAppProgress extends Activity implements View.OnClickListener
}
if((installFlags & PackageManager.INSTALL_REPLACE_EXISTING )!= 0) {
Log.w(TAG, "Replacing package:" + mAppInfo.packageName);
- // Initialize views
- PackageUtil.initSnippetForInstalledApp(this, mAppInfo,
- R.id.app_snippet);
- } else {
- PackageUtil.initSnippetForNewApp(this, mAppInfo,
- R.id.app_snippet, mPackageURI);
}
+ PackageUtil.initSnippetForNewApp(this, mAppInfo,
+ R.id.app_snippet, mPackageURI);
mStatusTextView = (TextView)findViewById(R.id.center_text);
mStatusTextView.setText(R.string.installing);
mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
diff --git a/src/com/android/packageinstaller/PackageUtil.java b/src/com/android/packageinstaller/PackageUtil.java
index 1e80204c..5b31062c 100644
--- a/src/com/android/packageinstaller/PackageUtil.java
+++ b/src/com/android/packageinstaller/PackageUtil.java
@@ -115,11 +115,10 @@ public class PackageUtil {
int snippetId, Uri packageURI) {
View appSnippet = pContext.findViewById(snippetId);
final String archiveFilePath = packageURI.getPath();
- DisplayMetrics metrics = new DisplayMetrics();
- metrics.setToDefaults();
+ Resources pRes = pContext.getResources();
AssetManager assmgr = new AssetManager();
assmgr.addAssetPath(archiveFilePath);
- Resources res = new Resources(assmgr, metrics, null);
+ Resources res = new Resources(assmgr, pRes.getDisplayMetrics(), pRes.getConfiguration());
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.
@@ -129,10 +128,9 @@ public class PackageUtil {
} catch (Resources.NotFoundException e) {
}
}
- if ((label == null) && (appInfo.nonLocalizedLabel != null)) {
- label = appInfo.nonLocalizedLabel;
- } else {
- label = appInfo.packageName;
+ if (label == null) {
+ label = (appInfo.nonLocalizedLabel != null) ?
+ appInfo.nonLocalizedLabel : appInfo.packageName;
}
Drawable icon = null;
// Try to load the icon from the package's resources. If an app has not explicitly