summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuchi Amalapurapu <asuchitra@google.com>2010-03-11 00:42:02 -0800
committerSuchi Amalapurapu <asuchitra@google.com>2010-03-11 00:54:49 -0800
commitdc7d3d29d2d058e795ab7650a611027d981e4a71 (patch)
tree598446076f3928bb4c6a662060d9691bd1da34dd
parent72d7218e0753bdad73871a07e0537396fcb35653 (diff)
downloadandroid_packages_apps_PackageInstaller-dc7d3d29d2d058e795ab7650a611027d981e4a71.zip
android_packages_apps_PackageInstaller-dc7d3d29d2d058e795ab7650a611027d981e4a71.tar.gz
android_packages_apps_PackageInstaller-dc7d3d29d2d058e795ab7650a611027d981e4a71.tar.bz2
Check for resolvable activities before enabling launch button.
Change-Id: I6bbb6c079c53f09a3b92b4e2a50d17fbd4839a0e
-rwxr-xr-xsrc/com/android/packageinstaller/InstallAppProgress.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/com/android/packageinstaller/InstallAppProgress.java b/src/com/android/packageinstaller/InstallAppProgress.java
index ca49687..3fe6932 100755
--- a/src/com/android/packageinstaller/InstallAppProgress.java
+++ b/src/com/android/packageinstaller/InstallAppProgress.java
@@ -24,6 +24,7 @@ import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageInstallObserver;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
@@ -42,6 +43,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.List;
/**
* This activity corresponds to a download progress screen that is displayed
@@ -82,7 +84,15 @@ public class InstallAppProgress extends Activity implements View.OnClickListener
// Enable or disable launch button
mLaunchIntent = getPackageManager().getLaunchIntentForPackage(
mAppInfo.packageName);
+ boolean enabled = false;
if(mLaunchIntent != null) {
+ List<ResolveInfo> list = getPackageManager().
+ queryIntentActivities(mLaunchIntent, 0);
+ if (list != null && list.size() > 0) {
+ enabled = true;
+ }
+ }
+ if (enabled) {
mLaunchButton.setOnClickListener(InstallAppProgress.this);
} else {
mLaunchButton.setEnabled(false);