Always show app titles in notifications

This commit is contained in:
M66B 2023-11-01 07:34:02 +01:00
parent 2faf361591
commit 31249b815b
2 changed files with 6 additions and 2 deletions

View File

@ -2391,11 +2391,14 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
public void notifyNewApplication(int uid, boolean malware) { public void notifyNewApplication(int uid, boolean malware) {
if (uid < 0) if (uid < 0)
return; return;
if (uid == Process.myUid())
return;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
try { try {
// Get application name // Get application name
String name = TextUtils.join(", ", Util.getApplicationNames(uid, this)); List<String> names = Util.getApplicationNames(uid, this);
String name = (names.size() == 0 ? Integer.toString(uid) : TextUtils.join(", ", names));
// Get application info // Get application info
PackageManager pm = getPackageManager(); PackageManager pm = getPackageManager();

View File

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