This commit is contained in:
Mark Finkle 2014-08-21 00:38:17 -04:00
Родитель 41bdc5d9ec
Коммит 7abe500e25
1 изменённых файлов: 27 добавлений и 17 удалений

Просмотреть файл

@ -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) {