1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-21 23:33:21 +00:00

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) {
if (uid < 0)
return;
if (uid == Process.myUid())
return;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
try {
// 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
PackageManager pm = getPackageManager();

View file

@ -410,7 +410,8 @@ public class Util {
for (String pkg : pkgs)
try {
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) {
}
Collections.sort(listResult);