File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
java/com/ismartcoding/plain/services Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -41,9 +41,9 @@ android {
4141 else -> 0
4242 }
4343
44- val vCode = 433
44+ val vCode = 436
4545 versionCode = vCode - singleAbiNum
46- versionName = " 2.1.16 "
46+ versionName = " 2.1.17 "
4747
4848 ndk {
4949 // noinspection ChromeOsAbiSupport
Original file line number Diff line number Diff line change 181181
182182 <service
183183 android : name =" .services.PNotificationListenerService"
184- android : exported =" true "
184+ android : exported =" false "
185185 android : permission =" android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" >
186186 <intent-filter >
187187 <action android : name =" android.service.notification.NotificationListenerService" />
Original file line number Diff line number Diff line change @@ -129,6 +129,11 @@ class PNotificationListenerService : NotificationListenerService() {
129129 LogCat .w(" PNotificationListenerService: not connected, ignoring cancel request" )
130130 return @receiveEventHandler
131131 }
132+ if (! Permission .NOTIFICATION_LISTENER .can(applicationContext)) {
133+ LogCat .w(" PNotificationListenerService: permission not granted, ignoring cancel request" )
134+ isConnected = false
135+ return @receiveEventHandler
136+ }
132137
133138 try {
134139 if (event.ids.size == TempData .notifications.size) {
@@ -166,6 +171,11 @@ class PNotificationListenerService : NotificationListenerService() {
166171 } catch (ex: Exception ) {
167172 LogCat .e(" Error cleaning up events: ${ex.message} " )
168173 }
174+ try {
175+ requestRebind(ComponentName (applicationContext, PNotificationListenerService ::class .java))
176+ } catch (ex: Exception ) {
177+ LogCat .e(" Error requesting rebind: ${ex.message} " )
178+ }
169179 }
170180
171181 companion object {
You can’t perform that action at this time.
0 commit comments