Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
15b12159
Commit
15b12159
authored
Aug 09, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only show SafetyNet when GMS exists
parent
11222c89
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
11 deletions
+22
-11
Networking.java
...ed/src/main/java/com/topjohnwu/magisk/net/Networking.java
+1
-2
Info.kt
app/src/main/java/com/topjohnwu/magisk/core/Info.kt
+3
-4
NetworkingModule.kt
...src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt
+5
-1
HomeViewModel.kt
...c/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+6
-1
fragment_home_md2.xml
app/src/main/res/layout/fragment_home_md2.xml
+7
-3
No files found.
app/shared/src/main/java/com/topjohnwu/magisk/net/Networking.java
View file @
15b12159
...
...
@@ -47,10 +47,9 @@ public class Networking {
}
catch
(
Exception
e
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
21
)
{
// Failed to update SSL provider, use NoSSLv3SocketFactory on SDK < 21
// and return false to notify potential issues
HttpsURLConnection
.
setDefaultSSLSocketFactory
(
new
NoSSLv3SocketFactory
());
return
false
;
}
return
false
;
}
return
true
;
}
...
...
app/src/main/java/com/topjohnwu/magisk/core/Info.kt
View file @
15b12159
...
...
@@ -18,11 +18,9 @@ object Info {
val
envRef
=
CachedValue
{
loadState
()
}
@JvmStatic
val
env
by
envRef
// Local
@JvmStatic
val
env
by
envRef
// Local
@JvmStatic
var
stub
:
DynAPK
.
Data
?
=
null
// Stub
var
remote
=
UpdateInfo
()
// Remote
@JvmStatic
var
stub
:
DynAPK
.
Data
?
=
null
// Stub
// Toggle-able options
@JvmStatic
var
keepVerity
=
false
...
...
@@ -33,6 +31,7 @@ object Info {
@JvmStatic
var
isSAR
=
false
@JvmStatic
var
isAB
=
false
@JvmStatic
var
ramdisk
=
false
@JvmStatic
var
hasGMS
=
true
val
isConnected
by
lazy
{
ObservableBoolean
(
false
).
also
{
field
->
...
...
app/src/main/java/com/topjohnwu/magisk/di/NetworkingModule.kt
View file @
15b12159
package
com.topjohnwu.magisk.di
import
android.content.Context
import
android.os.Build
import
com.squareup.moshi.Moshi
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.data.network.GithubApiServices
import
com.topjohnwu.magisk.data.network.GithubRawServices
import
com.topjohnwu.magisk.net.Networking
...
...
@@ -40,7 +42,9 @@ fun createOkHttpClient(context: Context): OkHttpClient {
// builder.addInterceptor(httpLoggingInterceptor)
if
(!
Networking
.
init
(
context
))
{
builder
.
sslSocketFactory
(
NoSSLv3SocketFactory
())
Info
.
hasGMS
=
false
if
(
Build
.
VERSION
.
SDK_INT
<
21
)
builder
.
sslSocketFactory
(
NoSSLv3SocketFactory
())
}
val
doh
=
DnsOverHttps
.
Builder
().
client
(
builder
.
build
())
...
...
app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
View file @
15b12159
...
...
@@ -46,7 +46,7 @@ class HomeViewModel(
@get
:
Bindable
var
stateMagisk
=
MagiskState
.
LOADING
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
stateMagisk
)
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
stateMagisk
,
BR
.
showUninstall
)
@get
:
Bindable
var
stateManager
=
MagiskState
.
LOADING
...
...
@@ -73,6 +73,10 @@ class HomeViewModel(
var
stateManagerProgress
=
0
set
(
value
)
=
set
(
value
,
field
,
{
field
=
it
},
BR
.
stateManagerProgress
)
@get
:
Bindable
val
showUninstall
get
()
=
Info
.
env
.
magiskVersionCode
>
0
&&
stateMagisk
!=
MagiskState
.
LOADING
&&
isConnected
.
get
()
val
items
=
listOf
(
DeveloperItem
.
Mainline
,
DeveloperItem
.
App
,
DeveloperItem
.
Project
)
val
itemBinding
=
itemBindingOf
<
HomeItem
>
{
it
.
bindExtra
(
BR
.
viewModel
,
this
)
...
...
@@ -92,6 +96,7 @@ class HomeViewModel(
}
override
fun
refresh
()
=
viewModelScope
.
launch
{
notifyPropertyChanged
(
BR
.
showUninstall
)
repoMagisk
.
fetchUpdate
()
?.
apply
{
stateMagisk
=
when
{
!
Info
.
env
.
isActive
->
MagiskState
.
NOT_INSTALLED
...
...
app/src/main/res/layout/fragment_home_md2.xml
View file @
15b12159
...
...
@@ -103,17 +103,22 @@
android:layout_marginTop=
"@dimen/l1"
app:layout_constraintTop_toBottomOf=
"@+id/home_magisk_wrapper"
/>
<Space
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/l1"
gone=
"@{!Info.hasGMS && !viewModel.showUninstall}"
/>
<com.google.android.material.button.MaterialButton
style=
"@style/WidgetFoundation.Button.Outlined"
android:layout_marginStart=
"@dimen/l1"
android:layout_marginEnd=
"@dimen/l1"
android:layout_marginTop=
"@dimen/l1"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/home_check_safetynet"
android:textAllCaps=
"false"
android:textSize=
"12sp"
android:onClick=
"@{() -> viewModel.onSafetyNetPressed()}"
gone=
"@{!Info.hasGMS}"
app:cornerRadius=
"@dimen/r1"
app:icon=
"@drawable/ic_safetynet_md2"
/>
...
...
@@ -121,14 +126,13 @@
style=
"@style/WidgetFoundation.Button.Outlined.Error"
android:layout_marginStart=
"@dimen/l1"
android:layout_marginEnd=
"@dimen/l1"
android:layout_marginTop=
"@dimen/l_125"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/uninstall_magisk_title"
android:textAllCaps=
"false"
android:textSize=
"12sp"
android:onClick=
"@{() -> viewModel.onDeletePressed()}"
gone=
"@{
Info.env.magiskVersionCode < 0 || viewModel.stateMagisk == MagiskState.LOADING || !viewModel.isConnected
}"
gone=
"@{
!viewModel.showUninstall
}"
app:cornerRadius=
"@dimen/r1"
app:icon=
"@drawable/ic_delete_md2"
/>
...
...
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