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
92b9c529
Commit
92b9c529
authored
Dec 27, 2015
by
Max Lv
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:shadowsocks/shadowsocks-android
parents
7d01ca81
4f3ebf93
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
27 deletions
+20
-27
src/main/scala/com/github/shadowsocks/BaseService.scala
src/main/scala/com/github/shadowsocks/BaseService.scala
+12
-11
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+0
-3
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
...in/scala/com/github/shadowsocks/ShadowsocksSettings.scala
+6
-8
src/main/scala/com/github/shadowsocks/database/DBHelper.scala
...main/scala/com/github/shadowsocks/database/DBHelper.scala
+2
-5
No files found.
src/main/scala/com/github/shadowsocks/BaseService.scala
View file @
92b9c529
...
@@ -56,6 +56,7 @@ trait BaseService extends Service {
...
@@ -56,6 +56,7 @@ trait BaseService extends Service {
var
trafficMonitorThread
:
TrafficMonitorThread
=
null
var
trafficMonitorThread
:
TrafficMonitorThread
=
null
final
val
callbacks
=
new
RemoteCallbackList
[
IShadowsocksServiceCallback
]
final
val
callbacks
=
new
RemoteCallbackList
[
IShadowsocksServiceCallback
]
var
callbacksCount
:
Int
=
_
val
binder
=
new
IShadowsocksService
.
Stub
{
val
binder
=
new
IShadowsocksService
.
Stub
{
override
def
getMode
:
Int
=
{
override
def
getMode
:
Int
=
{
...
@@ -67,19 +68,19 @@ trait BaseService extends Service {
...
@@ -67,19 +68,19 @@ trait BaseService extends Service {
}
}
override
def
unregisterCallback
(
cb
:
IShadowsocksServiceCallback
)
{
override
def
unregisterCallback
(
cb
:
IShadowsocksServiceCallback
)
{
if
(
cb
!=
null
)
{
if
(
cb
!=
null
&&
callbacks
.
unregister
(
cb
)
)
{
callbacks
.
unregister
(
cb
)
callbacks
Count
-=
1
}
if
(
callbacksCount
==
0
&&
timer
!=
null
)
{
if
(
callbacks
.
getRegisteredCallbackCount
==
0
&&
timer
!=
null
)
{
timer
.
cancel
()
timer
.
cancel
()
timer
=
null
timer
=
null
}
}
}
}
}
override
def
registerCallback
(
cb
:
IShadowsocksServiceCallback
)
{
override
def
registerCallback
(
cb
:
IShadowsocksServiceCallback
)
{
if
(
cb
!=
null
)
{
if
(
cb
!=
null
&&
callbacks
.
register
(
cb
)
)
{
callbacks
.
register
(
cb
)
callbacks
Count
+=
1
if
(
callbacks
.
getRegisteredCallback
Count
!=
0
&&
timer
==
null
)
{
if
(
callbacksCount
!=
0
&&
timer
==
null
)
{
val
task
=
new
TimerTask
{
val
task
=
new
TimerTask
{
def
run
{
def
run
{
if
(
TrafficMonitor
.
updateRate
())
updateTrafficRate
()
if
(
TrafficMonitor
.
updateRate
())
updateTrafficRate
()
...
@@ -160,7 +161,7 @@ trait BaseService extends Service {
...
@@ -160,7 +161,7 @@ trait BaseService extends Service {
def
updateTrafficRate
()
{
def
updateTrafficRate
()
{
val
handler
=
new
Handler
(
getContext
.
getMainLooper
)
val
handler
=
new
Handler
(
getContext
.
getMainLooper
)
handler
.
post
(()
=>
{
handler
.
post
(()
=>
{
if
(
callbacks
.
getRegisteredCallback
Count
>
0
)
{
if
(
callbacksCount
>
0
)
{
val
txRate
=
TrafficMonitor
.
getTxRate
val
txRate
=
TrafficMonitor
.
getTxRate
val
rxRate
=
TrafficMonitor
.
getRxRate
val
rxRate
=
TrafficMonitor
.
getRxRate
val
txTotal
=
TrafficMonitor
.
getTxTotal
val
txTotal
=
TrafficMonitor
.
getTxTotal
...
@@ -181,7 +182,7 @@ trait BaseService extends Service {
...
@@ -181,7 +182,7 @@ trait BaseService extends Service {
protected
def
changeState
(
s
:
Int
,
msg
:
String
)
{
protected
def
changeState
(
s
:
Int
,
msg
:
String
)
{
val
handler
=
new
Handler
(
getContext
.
getMainLooper
)
val
handler
=
new
Handler
(
getContext
.
getMainLooper
)
handler
.
post
(()
=>
if
(
state
!=
s
)
{
handler
.
post
(()
=>
if
(
state
!=
s
)
{
if
(
callbacks
.
getRegisteredCallback
Count
>
0
)
{
if
(
callbacksCount
>
0
)
{
val
n
=
callbacks
.
beginBroadcast
()
val
n
=
callbacks
.
beginBroadcast
()
for
(
i
<-
0
until
n
)
{
for
(
i
<-
0
until
n
)
{
try
{
try
{
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
92b9c529
...
@@ -104,7 +104,6 @@ class Shadowsocks
...
@@ -104,7 +104,6 @@ class Shadowsocks
var
progressDialog
:
ProgressDialog
=
_
var
progressDialog
:
ProgressDialog
=
_
var
progressTag
=
-
1
var
progressTag
=
-
1
var
state
=
State
.
STOPPED
var
state
=
State
.
STOPPED
var
prepared
=
false
var
currentProfile
=
new
Profile
var
currentProfile
=
new
Profile
var
vpnEnabled
=
-
1
var
vpnEnabled
=
-
1
var
trafficCache
:
String
=
_
var
trafficCache
:
String
=
_
...
@@ -402,7 +401,6 @@ class Shadowsocks
...
@@ -402,7 +401,6 @@ class Shadowsocks
protected
override
def
onPause
()
{
protected
override
def
onPause
()
{
super
.
onPause
()
super
.
onPause
()
ShadowsocksApplication
.
profileManager
.
save
ShadowsocksApplication
.
profileManager
.
save
prepared
=
false
}
}
private
def
stateUpdate
()
{
private
def
stateUpdate
()
{
...
@@ -517,7 +515,6 @@ class Shadowsocks
...
@@ -517,7 +515,6 @@ class Shadowsocks
override
def
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
)
=
resultCode
match
{
override
def
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
)
=
resultCode
match
{
case
Activity
.
RESULT_OK
=>
case
Activity
.
RESULT_OK
=>
prepared
=
true
serviceStart
()
serviceStart
()
case
_
=>
case
_
=>
cancelStart
()
cancelStart
()
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksSettings.scala
View file @
92b9c529
...
@@ -166,18 +166,16 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
...
@@ -166,18 +166,16 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
isProxyApps
.
setChecked
(
ShadowsocksApplication
.
settings
.
getBoolean
(
Key
.
isProxyApps
,
false
))
// update
isProxyApps
.
setChecked
(
ShadowsocksApplication
.
settings
.
getBoolean
(
Key
.
isProxyApps
,
false
))
// update
}
}
override
def
on
Pause
{
override
def
on
Destroy
{
super
.
on
Pause
()
super
.
on
Destroy
()
ShadowsocksApplication
.
settings
.
unregisterOnSharedPreferenceChangeListener
(
this
)
ShadowsocksApplication
.
settings
.
unregisterOnSharedPreferenceChangeListener
(
this
)
}
}
def
onSharedPreferenceChanged
(
sharedPreferences
:
SharedPreferences
,
key
:
String
)
=
key
match
{
def
onSharedPreferenceChanged
(
sharedPreferences
:
SharedPreferences
,
key
:
String
)
=
key
match
{
case
Key
.
isNAT
=>
case
Key
.
isNAT
=>
activity
.
handler
.
post
(()
=>
{
activity
.
handler
.
post
(()
=>
{
activity
.
deattachService
activity
.
deattachService
activity
.
attachService
activity
.
attachService
})
})
setEnabled
(
enabled
)
case
_
=>
case
_
=>
}
}
...
...
src/main/scala/com/github/shadowsocks/database/DBHelper.scala
View file @
92b9c529
...
@@ -105,17 +105,14 @@ class DBHelper(val context: Context)
...
@@ -105,17 +105,14 @@ class DBHelper(val context: Context)
" ipv6, individual FROM `tmp`;"
)
" ipv6, individual FROM `tmp`;"
)
profileDao
.
executeRawNoArgs
(
"DROP TABLE `tmp`;"
)
profileDao
.
executeRawNoArgs
(
"DROP TABLE `tmp`;"
)
profileDao
.
executeRawNoArgs
(
"COMMIT;"
)
profileDao
.
executeRawNoArgs
(
"COMMIT;"
)
return
}
else
if
(
oldVersion
<
13
)
{
}
if
(
oldVersion
<
13
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN tx LONG;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN tx LONG;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN rx LONG;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN rx LONG;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN date VARCHAR;"
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN date VARCHAR;"
)
}
}
if
(
oldVersion
<
15
)
{
if
(
oldVersion
<
15
)
{
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN userOrder LONG;"
)
if
(
oldVersion
>=
12
)
profileDao
.
executeRawNoArgs
(
"ALTER TABLE `profile` ADD COLUMN userOrder LONG;"
)
var
i
=
0
var
i
=
0
for
(
profile
<-
profileDao
.
queryForAll
.
asScala
)
{
for
(
profile
<-
profileDao
.
queryForAll
.
asScala
)
{
if
(
oldVersion
<
14
)
profile
.
individual
=
updateProxiedApps
(
context
,
profile
.
individual
)
if
(
oldVersion
<
14
)
profile
.
individual
=
updateProxiedApps
(
context
,
profile
.
individual
)
...
...
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