From 9083a3038a45d7ba09bf2bf24faa1d4dee5b1578 Mon Sep 17 00:00:00 2001 From: ajp_anton Date: Tue, 7 Jul 2026 09:41:38 +0000 Subject: [PATCH] Support mixed-case notification packages --- .../runtime/NotificationKeyReflection.java | 17 +++++++++++++++++ .../shell/settings/AppIconRules.java | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/se/ajpanton/statusbartweak/runtime/NotificationKeyReflection.java b/app/src/main/java/se/ajpanton/statusbartweak/runtime/NotificationKeyReflection.java index 39847fe..831baa1 100644 --- a/app/src/main/java/se/ajpanton/statusbartweak/runtime/NotificationKeyReflection.java +++ b/app/src/main/java/se/ajpanton/statusbartweak/runtime/NotificationKeyReflection.java @@ -80,6 +80,10 @@ public final class NotificationKeyReflection { return null; } String normalized = key.trim(); + String pipePackage = packageFromPipeNotificationKey(normalized); + if (pipePackage != null) { + return pipePackage; + } int suffix = normalized.indexOf('@'); if (suffix >= 0) { normalized = normalized.substring(0, suffix); @@ -91,6 +95,19 @@ public final class NotificationKeyReflection { return AppIconRules.isValidPackageName(normalized) ? normalized : null; } + private static String packageFromPipeNotificationKey(String key) { + int firstPipe = key.indexOf('|'); + if (firstPipe < 0) { + return null; + } + int secondPipe = key.indexOf('|', firstPipe + 1); + if (secondPipe <= firstPipe + 1) { + return null; + } + String packageName = key.substring(firstPipe + 1, secondPipe); + return AppIconRules.isValidPackageName(packageName) ? packageName : null; + } + private static String nonEmptyStringFromMethod(Object target, String methodName) { Object value = ReflectionSupport.invokeMethod(target, methodName); return value instanceof String string && !string.isEmpty() ? string : null; diff --git a/app/src/main/java/se/ajpanton/statusbartweak/shell/settings/AppIconRules.java b/app/src/main/java/se/ajpanton/statusbartweak/shell/settings/AppIconRules.java index 81ffbda..1ca64e2 100644 --- a/app/src/main/java/se/ajpanton/statusbartweak/shell/settings/AppIconRules.java +++ b/app/src/main/java/se/ajpanton/statusbartweak/shell/settings/AppIconRules.java @@ -17,7 +17,7 @@ import java.util.regex.Pattern; public final class AppIconRules { private static final Pattern PACKAGE_NAME_PATTERN = - Pattern.compile("^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"); + Pattern.compile("^[A-Za-z][A-Za-z0-9_]*(\\.[A-Za-z][A-Za-z0-9_]*)+$"); public static final String PREF_KEY_BLOCKED_MODES = "app_icon_blocked_modes"; public static final String PREF_KEY_EXCEPTION_RULES = "app_icon_exception_rules";