Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
8454975a
Commit
8454975a
authored
Aug 17, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix NAT notifications on Android 4.4
parent
69cb86a7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
src/main/scala/com/github/shadowsocks/ShadowsocksNotification.scala
...cala/com/github/shadowsocks/ShadowsocksNotification.scala
+4
-5
No files found.
src/main/scala/com/github/shadowsocks/ShadowsocksNotification.scala
View file @
8454975a
...
...
@@ -49,7 +49,6 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str
case
_
=>
}
private
lazy
val
style
=
new
BigTextStyle
(
builder
)
private
val
showOnUnlock
=
visible
&&
Utils
.
isLollipopOrAbove
private
var
isVisible
=
true
update
(
if
(
service
.
getSystemService
(
Context
.
POWER_SERVICE
).
asInstanceOf
[
PowerManager
].
isScreenOn
)
Intent
.
ACTION_SCREEN_ON
else
Intent
.
ACTION_SCREEN_OFF
,
true
)
...
...
@@ -57,19 +56,19 @@ class ShadowsocksNotification(private val service: BaseService, profileName: Str
val
screenFilter
=
new
IntentFilter
()
screenFilter
.
addAction
(
Intent
.
ACTION_SCREEN_ON
)
screenFilter
.
addAction
(
Intent
.
ACTION_SCREEN_OFF
)
if
(
showOnUnlock
)
screenFilter
.
addAction
(
Intent
.
ACTION_USER_PRESENT
)
if
(
visible
&&
Utils
.
isLollipopOrAbove
)
screenFilter
.
addAction
(
Intent
.
ACTION_USER_PRESENT
)
service
.
registerReceiver
(
lockReceiver
,
screenFilter
)
private
def
update
(
action
:
String
,
forceShow
:
Boolean
=
false
)
=
if
(
forceShow
||
service
.
getState
==
State
.
CONNECTED
)
action
match
{
case
Intent
.
ACTION_SCREEN_OFF
=>
setVisible
(
fals
e
,
forceShow
)
setVisible
(
visible
&&
!
Utils
.
isLollipopOrAbov
e
,
forceShow
)
unregisterCallback
// unregister callback to save battery
case
Intent
.
ACTION_SCREEN_ON
=>
setVisible
(
showOnUnlock
&&
!
keyGuard
.
inKeyguardRestrictedInputMode
,
forceShow
)
setVisible
(
visible
&&
Utils
.
isLollipopOrAbove
&&
!
keyGuard
.
inKeyguardRestrictedInputMode
,
forceShow
)
service
.
binder
.
registerCallback
(
callback
)
callbackRegistered
=
true
case
Intent
.
ACTION_USER_PRESENT
=>
setVisible
(
showOnUnlock
,
forceShow
)
case
Intent
.
ACTION_USER_PRESENT
=>
setVisible
(
true
,
forceShow
)
}
private
def
unregisterCallback
=
if
(
callbackRegistered
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment