diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2009-02-27 16:53:12 -0800 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2009-02-27 16:53:12 -0800 |
commit | da4093923903a53273c7ba86daaa5af0d1cf3d97 (patch) | |
tree | 09e4baf7346abb46970f73624acae443bb54cd3a /src | |
parent | 17e1fece639f129081d53a65d12fdeeca6322605 (diff) | |
download | android_packages_providers_DownloadProvider-da4093923903a53273c7ba86daaa5af0d1cf3d97.tar.gz android_packages_providers_DownloadProvider-da4093923903a53273c7ba86daaa5af0d1cf3d97.tar.bz2 android_packages_providers_DownloadProvider-da4093923903a53273c7ba86daaa5af0d1cf3d97.zip |
Optimize call to queryIntentActivities()
Replace a call to queryIntentActivities() with a calls to
resolveActivity(). This is done since the only purpose of the call
is to check if the returned list is empty or non-empty. It's
inefficient to move an entire list across the process boundary,
only to discard it.
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/providers/downloads/Helpers.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/com/android/providers/downloads/Helpers.java b/src/com/android/providers/downloads/Helpers.java index 0226eba4..866cddcb 100644 --- a/src/com/android/providers/downloads/Helpers.java +++ b/src/com/android/providers/downloads/Helpers.java @@ -38,7 +38,6 @@ import android.webkit.MimeTypeMap; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; -import java.util.List; import java.util.Random; import java.util.Set; import java.util.regex.Matcher; @@ -115,11 +114,10 @@ public class Helpers { PackageManager pm = context.getPackageManager(); intent.setDataAndType(Uri.fromParts("file", "", null), mimeType); - List<ResolveInfo> list = pm.queryIntentActivities(intent, - PackageManager.MATCH_DEFAULT_ONLY); + ResolveInfo ri = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); //Log.i(Constants.TAG, "*** FILENAME QUERY " + intent + ": " + list); - if (list.size() == 0) { + if (ri == null) { if (Config.LOGD) { Log.d(Constants.TAG, "no handler found for type " + mimeType); } |