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
f381ad63
Commit
f381ad63
authored
Dec 17, 2017
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash when no profile is selected
parent
b25e9a09
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
9 deletions
+10
-9
mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt
...le/src/main/java/com/github/shadowsocks/bg/BaseService.kt
+3
-3
mobile/src/main/java/com/github/shadowsocks/bg/ProxyService.kt
...e/src/main/java/com/github/shadowsocks/bg/ProxyService.kt
+3
-2
mobile/src/main/java/com/github/shadowsocks/bg/TransproxyService.kt
.../main/java/com/github/shadowsocks/bg/TransproxyService.kt
+2
-2
mobile/src/main/java/com/github/shadowsocks/bg/VpnService.kt
mobile/src/main/java/com/github/shadowsocks/bg/VpnService.kt
+2
-2
No files found.
mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt
View file @
f381ad63
...
...
@@ -258,7 +258,7 @@ object BaseService {
data
.
sslocalProcess
=
GuardedProcess
(
cmd
).
start
()
}
fun
createNotification
():
ServiceNotification
fun
createNotification
(
profileName
:
String
):
ServiceNotification
fun
startRunner
()
{
this
as
Context
...
...
@@ -318,11 +318,11 @@ object BaseService {
val
profile
=
app
.
currentProfile
this
as
Context
if
(
profile
==
null
)
{
data
.
notification
=
createNotification
(
""
)
// gracefully shutdown: https://stackoverflow.com/questions/47337857/context-startforegroundservice-did-not-then-call-service-startforeground-eve
stopRunner
(
true
,
getString
(
R
.
string
.
profile_empty
))
return
Service
.
START_NOT_STICKY
}
data
.
profile
=
profile
profile
.
name
=
profile
.
formattedName
TrafficMonitor
.
reset
()
val
thread
=
TrafficMonitorThread
()
...
...
@@ -339,7 +339,7 @@ object BaseService {
data
.
closeReceiverRegistered
=
true
}
data
.
notification
=
createNotification
()
data
.
notification
=
createNotification
(
profile
.
formattedName
)
app
.
track
(
tag
,
"start"
)
data
.
changeState
(
CONNECTING
)
...
...
mobile/src/main/java/com/github/shadowsocks/bg/ProxyService.kt
View file @
f381ad63
...
...
@@ -23,6 +23,7 @@ package com.github.shadowsocks.bg
import
android.app.Service
import
android.content.Intent
import
android.os.IBinder
import
com.github.shadowsocks.database.Profile
/**
* Shadowsocks service at its minimum.
...
...
@@ -33,8 +34,8 @@ class ProxyService : Service(), BaseService.Interface {
}
override
val
tag
:
String
get
()
=
"ShadowsocksProxyService"
override
fun
createNotification
():
ServiceNotification
=
ServiceNotification
(
this
,
data
.
profile
!!
.
formatted
Name
,
"service-proxy"
,
true
)
override
fun
createNotification
(
profileName
:
String
):
ServiceNotification
=
ServiceNotification
(
this
,
profile
Name
,
"service-proxy"
,
true
)
override
fun
onBind
(
intent
:
Intent
):
IBinder
?
=
super
.
onBind
(
intent
)
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
=
...
...
mobile/src/main/java/com/github/shadowsocks/bg/TransproxyService.kt
View file @
f381ad63
...
...
@@ -33,8 +33,8 @@ class TransproxyService : Service(), LocalDnsService.Interface {
}
override
val
tag
:
String
get
()
=
"ShadowsocksTransproxyService"
override
fun
createNotification
():
ServiceNotification
=
ServiceNotification
(
this
,
data
.
profile
!!
.
formatted
Name
,
"service-transproxy"
,
true
)
override
fun
createNotification
(
profileName
:
String
):
ServiceNotification
=
ServiceNotification
(
this
,
profile
Name
,
"service-transproxy"
,
true
)
override
fun
onBind
(
intent
:
Intent
):
IBinder
?
=
super
.
onBind
(
intent
)
override
fun
onStartCommand
(
intent
:
Intent
?,
flags
:
Int
,
startId
:
Int
):
Int
=
...
...
mobile/src/main/java/com/github/shadowsocks/bg/VpnService.kt
View file @
f381ad63
...
...
@@ -76,8 +76,8 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
}
override
val
tag
:
String
get
()
=
"ShadowsocksVpnService"
override
fun
createNotification
():
ServiceNotification
=
ServiceNotification
(
this
,
data
.
profile
!!
.
formatted
Name
,
"service-vpn"
)
override
fun
createNotification
(
profileName
:
String
):
ServiceNotification
=
ServiceNotification
(
this
,
profile
Name
,
"service-vpn"
)
private
var
conn
:
ParcelFileDescriptor
?
=
null
private
var
worker
:
ProtectWorker
?
=
null
...
...
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