summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuchi Amalapurapu <asuchitra@google.com>2009-11-11 17:32:59 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2009-11-11 17:32:59 -0800
commit641290ae9a25122ff7fb72dcb8ecfd65e6e98487 (patch)
treebc00d67e4426721674fa0a50e99af543325a6303
parentdeb9b16939dee7a9c3ed9168400b4c5745068644 (diff)
parent51c225966a8d9c82c369ccc765650658e6c90e66 (diff)
downloadandroid_packages_apps_PackageInstaller-641290ae9a25122ff7fb72dcb8ecfd65e6e98487.tar.gz
android_packages_apps_PackageInstaller-641290ae9a25122ff7fb72dcb8ecfd65e6e98487.tar.bz2
android_packages_apps_PackageInstaller-641290ae9a25122ff7fb72dcb8ecfd65e6e98487.zip
am 51c22596: am 13ed5aa1: 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 '51c225966a8d9c82c369ccc765650658e6c90e66' * commit '51c225966a8d9c82c369ccc765650658e6c90e66': Use nonlocalized label when installing packages.
-rwxr-xr-xsrc/com/android/packageinstaller/InstallAppProgress.java28
-rw-r--r--src/com/android/packageinstaller/PackageUtil.java22
2 files changed, 32 insertions, 18 deletions
diff --git a/src/com/android/packageinstaller/InstallAppProgress.java b/src/com/android/packageinstaller/InstallAppProgress.java
index c5a3c5b5..0bd38023 100755
--- a/src/com/android/packageinstaller/InstallAppProgress.java
+++ b/src/com/android/packageinstaller/InstallAppProgress.java
@@ -123,18 +123,6 @@ public class InstallAppProgress extends Activity implements View.OnClickListener
public void initView() {
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.op_progress);
- // Initialize views
- PackageUtil.initSnippetForInstalledApp(this, mAppInfo, R.id.app_snippet);
- mStatusTextView = (TextView)findViewById(R.id.center_text);
- mStatusTextView.setText(R.string.installing);
- mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
- mProgressBar.setIndeterminate(true);
- // Hide button till progress is being displayed
- mOkPanel = (View)findViewById(R.id.buttons_panel);
- mDoneButton = (Button)findViewById(R.id.done_button);
- mLaunchButton = (Button)findViewById(R.id.launch_button);
- mOkPanel.setVisibility(View.INVISIBLE);
- // Set flag to replace package if already existing
int installFlags = 0;
PackageManager pm = getPackageManager();
try {
@@ -147,7 +135,23 @@ 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);
}
+ mStatusTextView = (TextView)findViewById(R.id.center_text);
+ mStatusTextView.setText(R.string.installing);
+ mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
+ mProgressBar.setIndeterminate(true);
+ // Hide button till progress is being displayed
+ mOkPanel = (View)findViewById(R.id.buttons_panel);
+ mDoneButton = (Button)findViewById(R.id.done_button);
+ mLaunchButton = (Button)findViewById(R.id.launch_button);
+ mOkPanel.setVisibility(View.INVISIBLE);
+
String installerPackageName = getIntent().getStringExtra(
Intent.EXTRA_INSTALLER_PACKAGE_NAME);
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);