diff options
| author | Dianne Hackborn <hackbod@google.com> | 2010-12-15 00:22:43 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-12-15 00:22:43 -0800 |
| commit | ee02d83e4963848efa0375ccfcde0455d47bb2ad (patch) | |
| tree | 37bf517c18aeaa150239e8aab66640bb53ad6b1b /core/java/android | |
| parent | a9a3511e47d4ed8cb90b6a5d93cb4cdb08086135 (diff) | |
| parent | 194157638ae59418b9d9cb4d73f7e285f59bc579 (diff) | |
Merge "Fix launching of activities that I broke."
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/ApplicationPackageManager.java | 13 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageManager.java | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java index 7589e9981d9e..4018703d72e3 100644 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -101,24 +101,23 @@ final class ApplicationPackageManager extends PackageManager { Intent intentToResolve = new Intent(Intent.ACTION_MAIN); intentToResolve.addCategory(Intent.CATEGORY_INFO); intentToResolve.setPackage(packageName); - ResolveInfo resolveInfo = resolveActivity(intentToResolve, 0); + List<ResolveInfo> ris = queryIntentActivities(intentToResolve, 0); // Otherwise, try to find a main launcher activity. - if (resolveInfo == null) { + if (ris == null || ris.size() <= 0) { // reuse the intent instance intentToResolve.removeCategory(Intent.CATEGORY_INFO); intentToResolve.addCategory(Intent.CATEGORY_LAUNCHER); intentToResolve.setPackage(packageName); - resolveInfo = resolveActivity(intentToResolve, 0); + ris = queryIntentActivities(intentToResolve, 0); } - if (resolveInfo == null) { + if (ris == null || ris.size() <= 0) { return null; } Intent intent = new Intent(intentToResolve); - // Note: we do NOT fill in the component name; we'll leave the - // Intent unspecified, so if there are multiple matches within the - // package something reasonable will happen. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.setClassName(ris.get(0).activityInfo.packageName, + ris.get(0).activityInfo.name); return intent; } diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index 2c2e7d7043fd..ac7a95ae7e2c 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -926,7 +926,7 @@ public abstract class PackageManager { * * @param packageName The name of the package to inspect. * - * @return Returns either an Intent that can be used to + * @return Returns either a fully-qualified Intent that can be used to * launch the main activity in the package, or null if the package does * not contain such an activity. */ |
