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
02fc0b88
Commit
02fc0b88
authored
Aug 19, 2013
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix speed info
parent
6139e52a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
src/main/res/values/strings.xml
src/main/res/values/strings.xml
+1
-1
src/main/scala/com/github/shadowsocks/ShadowsocksService.scala
...ain/scala/com/github/shadowsocks/ShadowsocksService.scala
+6
-5
No files found.
src/main/res/values/strings.xml
View file @
02fc0b88
...
...
@@ -46,7 +46,7 @@
<!-- notification category -->
<string
name=
"forward_success"
>
Shadowsocks started.
</string>
<string
name=
"service_running"
>
Running in the background.
</string>
<string
name=
"service_status"
formatted=
"false"
>
Upload: %d KB/s\t|\tDownloa
d: %d KB/s
</string>
<string
name=
"service_status"
formatted=
"false"
>
Current Spee
d: %d KB/s
</string>
<string
name=
"forward_fail"
>
Shadowsocks failed to start.
</string>
<string
name=
"service_stopped"
>
Shadowsocks stopped.
</string>
<string
name=
"forward_stop"
>
Shadowsocks stopped.
</string>
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksService.scala
View file @
02fc0b88
...
...
@@ -95,6 +95,7 @@ class ShadowsocksService extends Service {
var
config
:
Config
=
null
var
hasRedirectSupport
=
false
var
apps
:
Array
[
ProxiedApp
]
=
null
val
uid
=
Process
.
myUid
()
private
var
mSetForeground
:
Method
=
null
private
var
mStartForeground
:
Method
=
null
...
...
@@ -200,8 +201,8 @@ class ShadowsocksService extends Service {
val
task
=
new
TimerTask
{
def
run
()
{
val
pm
=
getSystemService
(
Context
.
POWER_SERVICE
).
asInstanceOf
[
PowerManager
]
val
now
=
new
TrafficStat
(
TrafficStats
.
get
TotalTxBytes
,
TrafficStats
.
get
TotalRxBytes
,
java
.
lang
.
System
.
currentTimeMillis
())
val
now
=
new
TrafficStat
(
TrafficStats
.
get
UidTxBytes
(
uid
)
,
TrafficStats
.
get
UidRxBytes
(
uid
)
,
java
.
lang
.
System
.
currentTimeMillis
())
val
txRate
=
((
now
.
tx
-
last
.
tx
)
/
1024
/
TIMER_INTERVAL
).
toInt
val
rxRate
=
((
now
.
rx
-
last
.
rx
)
/
1024
/
TIMER_INTERVAL
).
toInt
last
=
now
...
...
@@ -213,12 +214,12 @@ class ShadowsocksService extends Service {
}
if
(
pm
.
isScreenOn
&&
state
==
State
.
CONNECTED
)
{
notifyForegroundAlert
(
getString
(
R
.
string
.
forward_success
),
getString
(
R
.
string
.
service_status
).
format
(
txRate
,
rxRate
),
txRate
+
rxRate
)
getString
(
R
.
string
.
service_status
).
format
(
math
.
max
(
txRate
,
rxRate
)),
math
.
max
(
txRate
,
rxRate
)
)
}
}
}
last
=
new
TrafficStat
(
TrafficStats
.
get
TotalTxBytes
,
TrafficStats
.
get
TotalRxBytes
,
java
.
lang
.
System
.
currentTimeMillis
())
last
=
new
TrafficStat
(
TrafficStats
.
get
UidTxBytes
(
uid
)
,
TrafficStats
.
get
UidRxBytes
(
uid
)
,
java
.
lang
.
System
.
currentTimeMillis
())
timer
=
new
Timer
(
true
)
timer
.
schedule
(
task
,
TIMER_INTERVAL
*
1000
,
TIMER_INTERVAL
*
1000
)
}
...
...
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