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
d755e473
Commit
d755e473
authored
Aug 14, 2018
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1909
parent
96fd4e75
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
9 deletions
+43
-9
mobile/src/main/AndroidManifest.xml
mobile/src/main/AndroidManifest.xml
+31
-0
mobile/src/main/java/com/github/shadowsocks/acl/AclSyncer.kt
mobile/src/main/java/com/github/shadowsocks/acl/AclSyncer.kt
+12
-9
No files found.
mobile/src/main/AndroidManifest.xml
View file @
d755e473
...
...
@@ -164,5 +164,36 @@
<action
android:name=
"com.twofortyfouram.locale.intent.action.FIRE_SETTING"
/>
</intent-filter>
</receiver>
<!-- https://android.googlesource.com/platform/frameworks/support/+/androidx-master-dev/work/workmanager/src/main/AndroidManifest.xml -->
<provider
android:name=
"androidx.work.impl.WorkManagerInitializer"
tools:node=
"remove"
/>
<service
android:name=
"androidx.work.impl.background.systemalarm.SystemAlarmService"
android:process=
":bg"
android:directBootAware=
"true"
/>
<service
android:name=
"androidx.work.impl.background.systemjob.SystemJobService"
android:process=
":bg"
android:directBootAware=
"true"
/>
<receiver
android:name=
"androidx.work.impl.utils.ForceStopRunnable$BroadcastReceiver"
android:process=
":bg"
android:directBootAware=
"true"
/>
<receiver
android:name=
"androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryChargingProxy"
android:process=
":bg"
android:directBootAware=
"true"
/>
<receiver
android:name=
"androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryNotLowProxy"
android:process=
":bg"
android:directBootAware=
"true"
/>
<receiver
android:name=
"androidx.work.impl.background.systemalarm.ConstraintProxy$StorageNotLowProxy"
android:process=
":bg"
android:directBootAware=
"true"
/>
<receiver
android:name=
"androidx.work.impl.background.systemalarm.ConstraintProxy$NetworkStateProxy"
android:process=
":bg"
android:directBootAware=
"true"
/>
<receiver
android:name=
"androidx.work.impl.background.systemalarm.RescheduleReceiver"
android:process=
":bg"
android:directBootAware=
"true"
/>
<receiver
android:name=
"androidx.work.impl.background.systemalarm.ConstraintProxyUpdateReceiver"
android:process=
":bg"
android:directBootAware=
"true"
/>
</application>
</manifest>
mobile/src/main/java/com/github/shadowsocks/acl/AclSyncer.kt
View file @
d755e473
...
...
@@ -27,18 +27,21 @@ import java.util.concurrent.TimeUnit
class
AclSyncer
:
Worker
()
{
companion
object
{
fun
schedule
(
route
:
String
)
=
WorkManager
.
getInstance
().
enqueue
(
OneTimeWorkRequestBuilder
<
AclSyncer
>()
.
addTag
(
route
)
.
setConstraints
(
Constraints
.
Builder
()
private
const
val
KEY_ROUTE
=
"route"
fun
schedule
(
route
:
String
)
=
WorkManager
.
getInstance
().
enqueue
(
OneTimeWorkRequestBuilder
<
AclSyncer
>().
run
{
setInputData
(
Data
.
Builder
().
putString
(
KEY_ROUTE
,
route
).
build
())
setConstraints
(
Constraints
.
Builder
()
.
setRequiredNetworkType
(
NetworkType
.
UNMETERED
)
.
setRequiresCharging
(
true
)
.
build
())
.
setInitialDelay
(
10
,
TimeUnit
.
SECONDS
)
.
build
())
setInitialDelay
(
10
,
TimeUnit
.
SECONDS
)
build
()
})
}
override
fun
doWork
():
Result
=
try
{
val
route
=
tags
.
asIterable
().
single
(
)
!!
val
route
=
inputData
.
getString
(
KEY_ROUTE
)
!!
val
acl
=
URL
(
"https://shadowsocks.org/acl/android/v1/$route.acl"
).
openStream
().
bufferedReader
()
.
use
{
it
.
readText
()
}
Acl
.
getFile
(
route
).
printWriter
().
use
{
it
.
write
(
acl
)
}
...
...
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