Bug 1048387 r=snorp

This commit is contained in:
Mark Finkle 2014-08-21 00:38:17 -04:00
parent b6b7b24a4b
commit dbb9414e04

View File

@ -979,27 +979,37 @@ public class GeckoAppShell
}
static boolean hasHandlersForIntent(Intent intent) {
PackageManager pm = getContext().getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
return !list.isEmpty();
try {
PackageManager pm = getContext().getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
return !list.isEmpty();
} catch (Exception ex) {
Log.e(LOGTAG, "Exception in GeckoAppShell.hasHandlersForIntent");
return false;
}
}
static String[] getHandlersForIntent(Intent intent) {
PackageManager pm = getContext().getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
int numAttr = 4;
String[] ret = new String[list.size() * numAttr];
for (int i = 0; i < list.size(); i++) {
ResolveInfo resolveInfo = list.get(i);
ret[i * numAttr] = resolveInfo.loadLabel(pm).toString();
if (resolveInfo.isDefault)
ret[i * numAttr + 1] = "default";
else
ret[i * numAttr + 1] = "";
ret[i * numAttr + 2] = resolveInfo.activityInfo.applicationInfo.packageName;
ret[i * numAttr + 3] = resolveInfo.activityInfo.name;
try {
PackageManager pm = getContext().getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
int numAttr = 4;
String[] ret = new String[list.size() * numAttr];
for (int i = 0; i < list.size(); i++) {
ResolveInfo resolveInfo = list.get(i);
ret[i * numAttr] = resolveInfo.loadLabel(pm).toString();
if (resolveInfo.isDefault)
ret[i * numAttr + 1] = "default";
else
ret[i * numAttr + 1] = "";
ret[i * numAttr + 2] = resolveInfo.activityInfo.applicationInfo.packageName;
ret[i * numAttr + 3] = resolveInfo.activityInfo.name;
}
return ret;
} catch (Exception ex) {
Log.e(LOGTAG, "Exception in GeckoAppShell.getHandlersForIntent");
return new String[0];
}
return ret;
}
static Intent getIntentForActionString(String aAction) {