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
32e7d8d2
Commit
32e7d8d2
authored
Jun 20, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix direct boot yet again
parent
6bce1366
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
16 deletions
+15
-16
core/src/main/java/com/github/shadowsocks/Core.kt
core/src/main/java/com/github/shadowsocks/Core.kt
+3
-6
core/src/main/java/com/github/shadowsocks/utils/DeviceStorageApp.kt
...ain/java/com/github/shadowsocks/utils/DeviceStorageApp.kt
+6
-4
mobile/src/main/java/com/github/shadowsocks/App.kt
mobile/src/main/java/com/github/shadowsocks/App.kt
+3
-3
tv/src/main/java/com/github/shadowsocks/tv/App.kt
tv/src/main/java/com/github/shadowsocks/tv/App.kt
+3
-3
No files found.
core/src/main/java/com/github/shadowsocks/Core.kt
View file @
32e7d8d2
...
@@ -37,7 +37,6 @@ import android.os.UserManager
...
@@ -37,7 +37,6 @@ import android.os.UserManager
import
androidx.annotation.RequiresApi
import
androidx.annotation.RequiresApi
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
androidx.core.content.getSystemService
import
androidx.core.content.getSystemService
import
androidx.work.Configuration
import
com.crashlytics.android.Crashlytics
import
com.crashlytics.android.Crashlytics
import
com.github.shadowsocks.acl.Acl
import
com.github.shadowsocks.acl.Acl
import
com.github.shadowsocks.aidl.ShadowsocksConnection
import
com.github.shadowsocks.aidl.ShadowsocksConnection
...
@@ -56,14 +55,14 @@ import java.io.File
...
@@ -56,14 +55,14 @@ import java.io.File
import
java.io.IOException
import
java.io.IOException
import
kotlin.reflect.KClass
import
kotlin.reflect.KClass
object
Core
:
Configuration
.
Provider
{
object
Core
{
const
val
TAG
=
"Core"
const
val
TAG
=
"Core"
lateinit
var
app
:
Application
lateinit
var
app
:
Application
lateinit
var
configureIntent
:
(
Context
)
->
PendingIntent
lateinit
var
configureIntent
:
(
Context
)
->
PendingIntent
val
connectivity
by
lazy
{
app
.
getSystemService
<
ConnectivityManager
>()
!!
}
val
connectivity
by
lazy
{
app
.
getSystemService
<
ConnectivityManager
>()
!!
}
val
packageInfo
:
PackageInfo
by
lazy
{
getPackageInfo
(
app
.
packageName
)
}
val
packageInfo
:
PackageInfo
by
lazy
{
getPackageInfo
(
app
.
packageName
)
}
val
deviceStorage
by
lazy
{
if
(
Build
.
VERSION
.
SDK_INT
<
24
)
app
else
DeviceStorageApp
(
app
)
}
val
deviceStorage
by
lazy
{
DeviceStorageApp
(
app
)
}
val
analytics
:
FirebaseAnalytics
by
lazy
{
FirebaseAnalytics
.
getInstance
(
deviceStorage
)
}
val
analytics
:
FirebaseAnalytics
by
lazy
{
FirebaseAnalytics
.
getInstance
(
deviceStorage
)
}
val
directBootSupported
by
lazy
{
val
directBootSupported
by
lazy
{
Build
.
VERSION
.
SDK_INT
>=
24
&&
app
.
getSystemService
<
DevicePolicyManager
>()
?.
storageEncryptionStatus
==
Build
.
VERSION
.
SDK_INT
>=
24
&&
app
.
getSystemService
<
DevicePolicyManager
>()
?.
storageEncryptionStatus
==
...
@@ -84,7 +83,7 @@ object Core : Configuration.Provider {
...
@@ -84,7 +83,7 @@ object Core : Configuration.Provider {
return
result
return
result
}
}
fun
<
T
>
init
(
app
:
T
,
configureClass
:
KClass
<
out
Any
>)
where
T
:
Application
,
T
:
Configuration
.
Provider
{
fun
init
(
app
:
Application
,
configureClass
:
KClass
<
out
Any
>)
{
this
.
app
=
app
this
.
app
=
app
this
.
configureIntent
=
{
this
.
configureIntent
=
{
PendingIntent
.
getActivity
(
it
,
0
,
Intent
(
it
,
configureClass
.
java
)
PendingIntent
.
getActivity
(
it
,
0
,
Intent
(
it
,
configureClass
.
java
)
...
@@ -137,8 +136,6 @@ object Core : Configuration.Provider {
...
@@ -137,8 +136,6 @@ object Core : Configuration.Provider {
}
}
}
}
override
fun
getWorkManagerConfiguration
()
=
Configuration
.
Builder
().
build
()
fun
getPackageInfo
(
packageName
:
String
)
=
app
.
packageManager
.
getPackageInfo
(
packageName
,
fun
getPackageInfo
(
packageName
:
String
)
=
app
.
packageManager
.
getPackageInfo
(
packageName
,
if
(
Build
.
VERSION
.
SDK_INT
>=
28
)
PackageManager
.
GET_SIGNING_CERTIFICATES
if
(
Build
.
VERSION
.
SDK_INT
>=
28
)
PackageManager
.
GET_SIGNING_CERTIFICATES
else
@Suppress
(
"DEPRECATION"
)
PackageManager
.
GET_SIGNATURES
)
!!
else
@Suppress
(
"DEPRECATION"
)
PackageManager
.
GET_SIGNATURES
)
!!
...
...
core/src/main/java/com/github/shadowsocks/utils/DeviceStorageApp.kt
View file @
32e7d8d2
...
@@ -21,15 +21,15 @@
...
@@ -21,15 +21,15 @@
package
com.github.shadowsocks.utils
package
com.github.shadowsocks.utils
import
android.annotation.SuppressLint
import
android.annotation.SuppressLint
import
android.annotation.TargetApi
import
android.app.Application
import
android.app.Application
import
android.content.Context
import
android.content.Context
import
android.os.Build
import
androidx.work.Configuration
@SuppressLint
(
"Registered"
)
@SuppressLint
(
"Registered"
)
@TargetApi
(
24
)
class
DeviceStorageApp
(
context
:
Context
)
:
Application
(),
Configuration
.
Provider
{
class
DeviceStorageApp
(
context
:
Context
)
:
Application
()
{
init
{
init
{
attachBaseContext
(
context
.
createDeviceProtectedStorageContext
()
)
attachBaseContext
(
if
(
Build
.
VERSION
.
SDK_INT
>=
24
)
context
.
createDeviceProtectedStorageContext
()
else
context
)
}
}
/**
/**
...
@@ -37,4 +37,6 @@ class DeviceStorageApp(context: Context) : Application() {
...
@@ -37,4 +37,6 @@ class DeviceStorageApp(context: Context) : Application() {
* protected storage.
* protected storage.
*/
*/
override
fun
getApplicationContext
()
=
this
override
fun
getApplicationContext
()
=
this
override
fun
getWorkManagerConfiguration
()
=
Configuration
.
Builder
().
build
()
}
}
mobile/src/main/java/com/github/shadowsocks/App.kt
View file @
32e7d8d2
...
@@ -21,17 +21,17 @@
...
@@ -21,17 +21,17 @@
package
com.github.shadowsocks
package
com.github.shadowsocks
import
android.app.Application
import
android.app.Application
import
android.content.res.Configuration
import
androidx.appcompat.app.AppCompatDelegate
import
androidx.appcompat.app.AppCompatDelegate
import
androidx.work.Configuration
class
App
:
Application
()
,
Configuration
.
Provider
by
Core
{
class
App
:
Application
()
{
override
fun
onCreate
()
{
override
fun
onCreate
()
{
super
.
onCreate
()
super
.
onCreate
()
Core
.
init
(
this
,
MainActivity
::
class
)
Core
.
init
(
this
,
MainActivity
::
class
)
AppCompatDelegate
.
setCompatVectorFromResourcesEnabled
(
true
)
AppCompatDelegate
.
setCompatVectorFromResourcesEnabled
(
true
)
}
}
override
fun
onConfigurationChanged
(
newConfig
:
android
.
content
.
res
.
Configuration
)
{
override
fun
onConfigurationChanged
(
newConfig
:
Configuration
)
{
super
.
onConfigurationChanged
(
newConfig
)
super
.
onConfigurationChanged
(
newConfig
)
Core
.
updateNotificationChannels
()
Core
.
updateNotificationChannels
()
}
}
...
...
tv/src/main/java/com/github/shadowsocks/tv/App.kt
View file @
32e7d8d2
...
@@ -21,16 +21,16 @@
...
@@ -21,16 +21,16 @@
package
com.github.shadowsocks.tv
package
com.github.shadowsocks.tv
import
android.app.Application
import
android.app.Application
import
android
x.work
.Configuration
import
android
.content.res
.Configuration
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.Core
class
App
:
Application
()
,
Configuration
.
Provider
by
Core
{
class
App
:
Application
()
{
override
fun
onCreate
()
{
override
fun
onCreate
()
{
super
.
onCreate
()
super
.
onCreate
()
Core
.
init
(
this
,
MainActivity
::
class
)
Core
.
init
(
this
,
MainActivity
::
class
)
}
}
override
fun
onConfigurationChanged
(
newConfig
:
android
.
content
.
res
.
Configuration
)
{
override
fun
onConfigurationChanged
(
newConfig
:
Configuration
)
{
super
.
onConfigurationChanged
(
newConfig
)
super
.
onConfigurationChanged
(
newConfig
)
Core
.
updateNotificationChannels
()
Core
.
updateNotificationChannels
()
}
}
...
...
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