From af248c474dd619efbcdcc96e8635d6f68a4fa657 Mon Sep 17 00:00:00 2001 From: Aditya Rajput Date: Mon, 26 Jan 2026 03:39:44 +0530 Subject: [PATCH 1/2] Store DEBUG logs in nightly builds --- app/build.gradle.kts | 4 ++-- app/proguard/nightly.pro | 5 +++++ app/{proguard-rules.pro => proguard/release.pro} | 2 +- .../main/java/co/adityarajput/notifilter/utils/Logging.kt | 7 ++++++- 4 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 app/proguard/nightly.pro rename app/{proguard-rules.pro => proguard/release.pro} (87%) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ef335c9..689f0d7 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -35,7 +35,7 @@ android { isShrinkResources = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro", + "proguard/nightly.pro", ) applicationIdSuffix = ".nightly" resValue("string", "app_name_launcher", "NotiFilter Nightly") @@ -46,7 +46,7 @@ android { isShrinkResources = true proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro", + "proguard/release.pro", ) } } diff --git a/app/proguard/nightly.pro b/app/proguard/nightly.pro new file mode 100644 index 0000000..1acfa07 --- /dev/null +++ b/app/proguard/nightly.pro @@ -0,0 +1,5 @@ +-assumenosideeffects class android.util.Log { + public static int d(...); + public static int i(...); + public static int e(...); +} diff --git a/app/proguard-rules.pro b/app/proguard/release.pro similarity index 87% rename from app/proguard-rules.pro rename to app/proguard/release.pro index 1582e39..9456d1f 100644 --- a/app/proguard-rules.pro +++ b/app/proguard/release.pro @@ -5,5 +5,5 @@ } -assumenosideeffects class co.adityarajput.notifilter.utils.Logger { - public final int d(...); + public final void d(...); } diff --git a/app/src/main/java/co/adityarajput/notifilter/utils/Logging.kt b/app/src/main/java/co/adityarajput/notifilter/utils/Logging.kt index 441e2ec..d1d3892 100644 --- a/app/src/main/java/co/adityarajput/notifilter/utils/Logging.kt +++ b/app/src/main/java/co/adityarajput/notifilter/utils/Logging.kt @@ -6,7 +6,12 @@ import co.adityarajput.notifilter.Constants object Logger { val logs = ArrayDeque(Constants.LOG_SIZE) - fun d(tag: String, msg: String) = Log.d(tag, msg) + fun d(tag: String, msg: String) { + Log.d(tag, msg) + + if (logs.size >= Constants.LOG_SIZE) logs.removeFirst() + logs.addLast("[${System.currentTimeMillis()}][$tag][DEBUG] $msg") + } fun i(tag: String, msg: String) { Log.i(tag, msg) From 4272243a94f95ea3e3b87d5c486a5d515557a714 Mon Sep 17 00:00:00 2001 From: Aditya Rajput Date: Mon, 26 Jan 2026 16:24:18 +0530 Subject: [PATCH 2/2] Handle TAP_NOTIFICATION on Android 14 & 15 --- .../notifilter/services/NotificationListener.kt | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/co/adityarajput/notifilter/services/NotificationListener.kt b/app/src/main/java/co/adityarajput/notifilter/services/NotificationListener.kt index b52319d..1a89e21 100644 --- a/app/src/main/java/co/adityarajput/notifilter/services/NotificationListener.kt +++ b/app/src/main/java/co/adityarajput/notifilter/services/NotificationListener.kt @@ -7,6 +7,8 @@ import android.app.NotificationManager import android.content.pm.ApplicationInfo import android.content.pm.ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE import android.os.Build +import android.os.Build.VERSION_CODES.BAKLAVA +import android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE import android.service.notification.NotificationListenerService import android.service.notification.StatusBarNotification import androidx.core.app.NotificationCompat @@ -90,7 +92,7 @@ class NotificationListener : NotificationListenerService() { .setContentTitle(getString(R.string.app_name_launcher)) .setContentText(getString(R.string.foreground_notification_content)) .setOngoing(true).setSilent(true).build(), - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) FOREGROUND_SERVICE_TYPE_SPECIAL_USE else 0, + if (Build.VERSION.SDK_INT >= UPSIDE_DOWN_CAKE) FOREGROUND_SERVICE_TYPE_SPECIAL_USE else 0, ) Logger.i("NotificationListener.startForeground", "Promoted to foreground") } @@ -133,7 +135,7 @@ class NotificationListener : NotificationListenerService() { is Action.TAP_NOTIFICATION -> try { sbn.notification.contentIntent?.run { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.BAKLAVA) send() else + if (Build.VERSION.SDK_INT >= BAKLAVA) { send( ActivityOptions.makeBasic() .setPendingIntentBackgroundActivityStartMode( @@ -141,6 +143,16 @@ class NotificationListener : NotificationListenerService() { ) .toBundle(), ) + } else if (Build.VERSION.SDK_INT >= UPSIDE_DOWN_CAKE) { + @Suppress("DEPRECATION") + send( + ActivityOptions.makeBasic() + .setPendingIntentBackgroundActivityStartMode( + ActivityOptions.MODE_BACKGROUND_ACTIVITY_START_ALLOWED, + ) + .toBundle(), + ) + } else send() } } catch (e: Exception) { Logger.e(