0
0
mirror of https://github.com/TrianguloY/UrlChecker.git synced 2024-09-19 20:02:16 +02:00

use old queryIntentActivities instead of queryIntentActivityOptions (some apps were not shown)

This commit is contained in:
TrianguloY 2024-06-01 20:17:44 +02:00
parent 977a88e199
commit 8d7e3cdaf4
2 changed files with 15 additions and 8 deletions

View File

@ -2,6 +2,7 @@ package com.trianguloy.urlchecker.modules.list;
import static java.util.Objects.requireNonNullElse; import static java.util.Objects.requireNonNullElse;
import android.content.ComponentName;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.os.Build; import android.os.Build;
import android.view.View; import android.view.View;
@ -91,12 +92,17 @@ class DebugDialog extends AModuleDialog {
SEPARATOR, SEPARATOR,
"queryIntentActivities:", "queryIntentActivities:",
getActivity().getPackageManager().queryIntentActivities(UrlUtils.getViewIntent(urlData.url, null), Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PackageManager.MATCH_ALL : 0).toString(), IntentApp.getOtherPackages(UrlUtils.getViewIntent(urlData.url, null), getActivity()).toString(),
SEPARATOR, SEPARATOR,
"queryIntentActivityOptions:", "queryIntentActivityOptions:",
IntentApp.getOtherPackages(UrlUtils.getViewIntent(urlData.url, null), getActivity()).toString(), getActivity().getPackageManager().queryIntentActivityOptions(
new ComponentName(getActivity(), MainDialog.class.getName()),
null,
UrlUtils.getViewIntent(urlData.url, null),
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PackageManager.MATCH_ALL : 0
).toString(),
SEPARATOR, SEPARATOR,

View File

@ -8,8 +8,6 @@ import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import com.trianguloy.urlchecker.dialogs.MainDialog;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -27,14 +25,17 @@ public class IntentApp {
*/ */
public static List<IntentApp> getOtherPackages(Intent baseIntent, Context cntx) { public static List<IntentApp> getOtherPackages(Intent baseIntent, Context cntx) {
// get all packages // get all packages
var resolveInfos = cntx.getPackageManager().queryIntentActivityOptions( var resolveInfos = cntx.getPackageManager().queryIntentActivities(
new ComponentName(cntx, MainDialog.class.getName()),
null,
baseIntent, baseIntent,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PackageManager.MATCH_ALL : 0); Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PackageManager.MATCH_ALL : 0);
var intentApps = new ArrayList<IntentApp>(); var intentApps = new ArrayList<IntentApp>();
for (var resolveInfo : resolveInfos) intentApps.add(new IntentApp(resolveInfo)); for (var resolveInfo : resolveInfos) {
// filter the current app
if (!resolveInfo.activityInfo.packageName.equals(cntx.getPackageName())) {
intentApps.add(new IntentApp(resolveInfo));
}
}
return intentApps; return intentApps;
} }