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 { try {
// Get application name // Get application name
List<String> names = Util.getApplicationNames(uid, this); 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 // Get application info
PackageManager pm = getPackageManager(); PackageManager pm = getPackageManager();

View File

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