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
e6d3c557
Commit
e6d3c557
authored
Jul 14, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce thread pool nos
parent
ae222a10
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
19 deletions
+30
-19
core/src/main/java/com/github/shadowsocks/Core.kt
core/src/main/java/com/github/shadowsocks/Core.kt
+6
-1
core/src/main/java/com/github/shadowsocks/database/PrivateDatabase.kt
...n/java/com/github/shadowsocks/database/PrivateDatabase.kt
+13
-10
core/src/main/java/com/github/shadowsocks/database/PublicDatabase.kt
...in/java/com/github/shadowsocks/database/PublicDatabase.kt
+11
-8
No files found.
core/src/main/java/com/github/shadowsocks/Core.kt
View file @
e6d3c557
...
@@ -53,6 +53,8 @@ import com.google.firebase.analytics.FirebaseAnalytics
...
@@ -53,6 +53,8 @@ import com.google.firebase.analytics.FirebaseAnalytics
import
io.fabric.sdk.android.Fabric
import
io.fabric.sdk.android.Fabric
import
kotlinx.coroutines.DEBUG_PROPERTY_NAME
import
kotlinx.coroutines.DEBUG_PROPERTY_NAME
import
kotlinx.coroutines.DEBUG_PROPERTY_VALUE_ON
import
kotlinx.coroutines.DEBUG_PROPERTY_VALUE_ON
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
import
java.io.File
import
java.io.File
import
java.io.IOException
import
java.io.IOException
import
kotlin.reflect.KClass
import
kotlin.reflect.KClass
...
@@ -105,7 +107,10 @@ object Core {
...
@@ -105,7 +107,10 @@ object Core {
System
.
setProperty
(
DEBUG_PROPERTY_NAME
,
DEBUG_PROPERTY_VALUE_ON
)
System
.
setProperty
(
DEBUG_PROPERTY_NAME
,
DEBUG_PROPERTY_VALUE_ON
)
Fabric
.
with
(
deviceStorage
,
Crashlytics
())
// multiple processes needs manual set-up
Fabric
.
with
(
deviceStorage
,
Crashlytics
())
// multiple processes needs manual set-up
FirebaseApp
.
initializeApp
(
deviceStorage
)
FirebaseApp
.
initializeApp
(
deviceStorage
)
WorkManager
.
initialize
(
deviceStorage
,
Configuration
.
Builder
().
build
())
WorkManager
.
initialize
(
deviceStorage
,
Configuration
.
Builder
().
apply
{
setExecutor
{
GlobalScope
.
launch
{
it
.
run
()
}
}
setTaskExecutor
{
GlobalScope
.
launch
{
it
.
run
()
}
}
}.
build
())
// handle data restored/crash
// handle data restored/crash
if
(
Build
.
VERSION
.
SDK_INT
>=
24
&&
DataStore
.
directBootAware
&&
if
(
Build
.
VERSION
.
SDK_INT
>=
24
&&
DataStore
.
directBootAware
&&
...
...
core/src/main/java/com/github/shadowsocks/database/PrivateDatabase.kt
View file @
e6d3c557
...
@@ -28,21 +28,24 @@ import androidx.sqlite.db.SupportSQLiteDatabase
...
@@ -28,21 +28,24 @@ import androidx.sqlite.db.SupportSQLiteDatabase
import
com.github.shadowsocks.Core.app
import
com.github.shadowsocks.Core.app
import
com.github.shadowsocks.database.migration.RecreateSchemaMigration
import
com.github.shadowsocks.database.migration.RecreateSchemaMigration
import
com.github.shadowsocks.utils.Key
import
com.github.shadowsocks.utils.Key
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
@Database
(
entities
=
[
Profile
::
class
,
KeyValuePair
::
class
],
version
=
28
)
@Database
(
entities
=
[
Profile
::
class
,
KeyValuePair
::
class
],
version
=
28
)
abstract
class
PrivateDatabase
:
RoomDatabase
()
{
abstract
class
PrivateDatabase
:
RoomDatabase
()
{
companion
object
{
companion
object
{
private
val
instance
by
lazy
{
private
val
instance
by
lazy
{
Room
.
databaseBuilder
(
app
,
PrivateDatabase
::
class
.
java
,
Key
.
DB_PROFILE
)
Room
.
databaseBuilder
(
app
,
PrivateDatabase
::
class
.
java
,
Key
.
DB_PROFILE
)
.
apply
{
.
addMigrations
(
addMigrations
(
Migration26
,
Migration26
,
Migration27
,
Migration27
,
Migration28
Migration28
)
)
.
enableMultiInstanceInvalidation
()
allowMainThreadQueries
()
.
fallbackToDestructiveMigration
()
enableMultiInstanceInvalidation
()
.
allowMainThreadQueries
()
fallbackToDestructiveMigration
()
.
build
()
setQueryExecutor
{
GlobalScope
.
launch
{
it
.
run
()
}
}
}.
build
()
}
}
val
profileDao
get
()
=
instance
.
profileDao
()
val
profileDao
get
()
=
instance
.
profileDao
()
...
...
core/src/main/java/com/github/shadowsocks/database/PublicDatabase.kt
View file @
e6d3c557
...
@@ -26,19 +26,22 @@ import androidx.room.RoomDatabase
...
@@ -26,19 +26,22 @@ import androidx.room.RoomDatabase
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.database.migration.RecreateSchemaMigration
import
com.github.shadowsocks.database.migration.RecreateSchemaMigration
import
com.github.shadowsocks.utils.Key
import
com.github.shadowsocks.utils.Key
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
@Database
(
entities
=
[
KeyValuePair
::
class
],
version
=
3
)
@Database
(
entities
=
[
KeyValuePair
::
class
],
version
=
3
)
abstract
class
PublicDatabase
:
RoomDatabase
()
{
abstract
class
PublicDatabase
:
RoomDatabase
()
{
companion
object
{
companion
object
{
private
val
instance
by
lazy
{
private
val
instance
by
lazy
{
Room
.
databaseBuilder
(
Core
.
deviceStorage
,
PublicDatabase
::
class
.
java
,
Key
.
DB_PUBLIC
)
Room
.
databaseBuilder
(
Core
.
deviceStorage
,
PublicDatabase
::
class
.
java
,
Key
.
DB_PUBLIC
).
apply
{
.
allowMainThreadQueries
()
addMigrations
(
.
addMigrations
(
Migration3
Migration3
)
)
.
enableMultiInstanceInvalidation
()
allowMainThreadQueries
()
.
fallbackToDestructiveMigration
()
enableMultiInstanceInvalidation
()
.
build
()
fallbackToDestructiveMigration
()
setQueryExecutor
{
GlobalScope
.
launch
{
it
.
run
()
}
}
}.
build
()
}
}
val
kvPairDao
get
()
=
instance
.
keyValuePairDao
()
val
kvPairDao
get
()
=
instance
.
keyValuePairDao
()
...
...
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