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
397f7326
Commit
397f7326
authored
Jun 30, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update SafetyNet UI to show evalType
parent
4bbd7989
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
82 additions
and
117 deletions
+82
-117
SafetynetFragment.kt
...va/com/topjohnwu/magisk/ui/safetynet/SafetynetFragment.kt
+13
-0
SafetynetViewModel.kt
...a/com/topjohnwu/magisk/ui/safetynet/SafetynetViewModel.kt
+5
-0
fragment_safetynet_md2.xml
app/src/main/res/layout/fragment_safetynet_md2.xml
+64
-117
No files found.
app/src/main/java/com/topjohnwu/magisk/ui/safetynet/SafetynetFragment.kt
View file @
397f7326
package
com.topjohnwu.magisk.ui.safetynet
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.databinding.FragmentSafetynetMd2Binding
import
com.topjohnwu.magisk.ui.base.BaseUIFragment
...
...
@@ -15,4 +19,13 @@ class SafetynetFragment : BaseUIFragment<SafetynetViewModel, FragmentSafetynetMd
activity
.
setTitle
(
R
.
string
.
safetynet
)
}
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
super
.
onCreateView
(
inflater
,
container
,
savedInstanceState
)
// Set barrier reference IDs in code, since resource IDs will be stripped in release mode
binding
.
snetBarrier
.
referencedIds
=
intArrayOf
(
R
.
id
.
basic_text
,
R
.
id
.
cts_text
)
return
binding
.
root
}
}
app/src/main/java/com/topjohnwu/magisk/ui/safetynet/SafetynetViewModel.kt
View file @
397f7326
...
...
@@ -28,6 +28,7 @@ class SafetynetViewModel(
val
safetyNetTitle
=
KObservableField
(
R
.
string
.
empty
)
val
ctsState
=
KObservableField
(
false
)
val
basicIntegrityState
=
KObservableField
(
false
)
val
evalType
=
KObservableField
(
""
)
val
isChecking
@Bindable
get
()
=
currentState
==
LOADING
val
isFailed
@Bindable
get
()
=
currentState
==
FAILED
...
...
@@ -67,10 +68,12 @@ class SafetynetViewModel(
runCatching
{
val
cts
=
getBoolean
(
"ctsProfileMatch"
)
val
basic
=
getBoolean
(
"basicIntegrity"
)
val
eval
=
optString
(
"evaluationType"
)
val
result
=
cts
&&
basic
cachedResult
=
this
ctsState
.
value
=
cts
basicIntegrityState
.
value
=
basic
evalType
.
value
=
if
(
eval
.
contains
(
"HARDWARE"
))
"HARDWARE"
else
"BASIC"
currentState
=
if
(
result
)
PASS
else
FAILED
safetyNetTitle
.
value
=
if
(
result
)
R
.
string
.
safetynet_attest_success
...
...
@@ -79,12 +82,14 @@ class SafetynetViewModel(
currentState
=
FAILED
ctsState
.
value
=
false
basicIntegrityState
.
value
=
false
evalType
.
value
=
"N/A"
safetyNetTitle
.
value
=
R
.
string
.
safetynet_res_invalid
}
}
?:
{
currentState
=
FAILED
ctsState
.
value
=
false
basicIntegrityState
.
value
=
false
evalType
.
value
=
"N/A"
safetyNetTitle
.
value
=
R
.
string
.
safetynet_api_error
}()
}
...
...
app/src/main/res/layout/fragment_safetynet_md2.xml
View file @
397f7326
This diff is collapsed.
Click to expand it.
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