From 59a6eaac56144accf3a79a84e38d88d27c6ef5b8 Mon Sep 17 00:00:00 2001 From: Mygod Date: Wed, 15 Nov 2017 00:10:53 -0800 Subject: [PATCH] Remove ACTION_USER_PRESENT listener on API 26+ This is removed since we can't change notification priority dynamically since API 26 and this also prevents an extraneous system notification. NB: After this change, `visible` doesn't have any observable effect on API 26+. --- .../scala/com/github/shadowsocks/bg/ServiceNotification.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mobile/src/main/scala/com/github/shadowsocks/bg/ServiceNotification.scala b/mobile/src/main/scala/com/github/shadowsocks/bg/ServiceNotification.scala index 252e5853..0c8458f2 100644 --- a/mobile/src/main/scala/com/github/shadowsocks/bg/ServiceNotification.scala +++ b/mobile/src/main/scala/com/github/shadowsocks/bg/ServiceNotification.scala @@ -72,7 +72,7 @@ class ServiceNotification(private val service: BaseService, profileName: String, val screenFilter = new IntentFilter() screenFilter.addAction(Intent.ACTION_SCREEN_ON) screenFilter.addAction(Intent.ACTION_SCREEN_OFF) - if (visible && Utils.isLollipopOrAbove) screenFilter.addAction(Intent.ACTION_USER_PRESENT) + if (visible && 21 until 26 contains Build.VERSION.SDK_INT) screenFilter.addAction(Intent.ACTION_USER_PRESENT) service.registerReceiver(lockReceiver, screenFilter) private def update(action: String, forceShow: Boolean = false) =