Skip new app notifications without names

This commit is contained in:
M66B 2023-11-02 14:18:34 +01:00
parent 1b344292f3
commit 336c5d67d9
2 changed files with 5 additions and 2 deletions

View File

@ -2398,7 +2398,9 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
try {
// Get application name
List<String> names = Util.getApplicationNames(uid, this);
String name = (names.size() == 0 ? Integer.toString(uid) : TextUtils.join(", ", names));
if (names.size() == 0)
return;
String name = TextUtils.join(", ", names);
// Get application info
PackageManager pm = getPackageManager();

View File

@ -402,7 +402,8 @@ public class Util {
try {
ApplicationInfo info = pm.getApplicationInfo(pkg, 0);
String name = pm.getApplicationLabel(info).toString();
listResult.add(TextUtils.isEmpty(name) ? pkg : name);
if (!TextUtils.isEmpty(name))
listResult.add(name);
} catch (PackageManager.NameNotFoundException ignored) {
}
Collections.sort(listResult);