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
a70c0174
Commit
a70c0174
authored
Oct 26, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added device info card
parent
da707afa
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
281 additions
and
9 deletions
+281
-9
Config.kt
app/src/main/java/com/topjohnwu/magisk/Config.kt
+1
-0
XAndroid.kt
...src/main/java/com/topjohnwu/magisk/extensions/XAndroid.kt
+32
-1
XJava.kt
app/src/main/java/com/topjohnwu/magisk/extensions/XJava.kt
+6
-1
XSU.kt
app/src/main/java/com/topjohnwu/magisk/extensions/XSU.kt
+3
-1
HomeViewModel.kt
.../java/com/topjohnwu/magisk/redesign/home/HomeViewModel.kt
+1
-0
ic_device.xml
app/src/main/res/drawable/ic_device.xml
+10
-0
fragment_home_md2.xml
app/src/main/res/layout/fragment_home_md2.xml
+217
-6
strings_md2.xml
app/src/main/res/values/strings_md2.xml
+11
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/Config.kt
View file @
a70c0174
...
...
@@ -121,6 +121,7 @@ object Config : PreferenceModel, DBConfig {
var
suReAuth
by
preference
(
Key
.
SU_REAUTH
,
false
)
var
checkUpdate
by
preference
(
Key
.
CHECK_UPDATES
,
true
)
var
magiskHide
by
preference
(
Key
.
MAGISKHIDE
,
true
)
@JvmStatic
var
coreOnly
by
preference
(
Key
.
COREONLY
,
false
)
var
showSystemApp
by
preference
(
Key
.
SHOW_SYSTEM_APP
,
false
)
...
...
app/src/main/java/com/topjohnwu/magisk/extensions/XAndroid.kt
View file @
a70c0174
...
...
@@ -24,8 +24,10 @@ import com.topjohnwu.magisk.utils.DynamicClassLoader
import
com.topjohnwu.magisk.utils.FileProvider
import
com.topjohnwu.magisk.utils.Utils
import
com.topjohnwu.magisk.utils.currentLocale
import
com.topjohnwu.superuser.ShellUtils
import
java.io.File
import
java.io.FileNotFoundException
import
java.text.SimpleDateFormat
import
java.util.*
val
packageName
:
String
get
()
=
get
<
Context
>().
packageName
...
...
@@ -280,4 +282,33 @@ fun Context.unwrap(): Context {
fun
Context
.
hasPermissions
(
vararg
permissions
:
String
)
=
permissions
.
all
{
ContextCompat
.
checkSelfPermission
(
this
,
it
)
==
PERMISSION_GRANTED
}
\ No newline at end of file
}
private
val
securityLevelFormatter
get
()
=
SimpleDateFormat
(
"yyyy-MM-dd"
,
currentLocale
)
/** Friendly reminder to seek newer roms or install oem updates. */
val
isDeviceSecure
:
Boolean
get
()
{
val
latestPermittedTime
=
Calendar
.
getInstance
().
apply
{
time
=
securityLevelDate
add
(
Calendar
.
MONTH
,
2
)
}.
time
.
time
return
now
in
0
..
latestPermittedTime
}
val
securityLevelDate
get
()
=
securityLevelFormatter
.
parseOrNull
(
securityLevel
)
?:
Date
(
0
)
val
securityLevel
get
()
=
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
Build
.
VERSION
.
SECURITY_PATCH
}
else
{
null
}
?:
"1970-01-01"
//never
val
isSAR
get
()
=
ShellUtils
.
fastCmd
(
"grep_prop ro.build.system_root_image"
)
.
let
{
it
.
isNotEmpty
()
&&
it
.
toBoolean
()
}
val
isAB
get
()
=
ShellUtils
.
fastCmd
(
"grep_prop ro.build.ab_update"
)
.
let
{
it
.
isNotEmpty
()
&&
it
.
toBoolean
()
}
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/extensions/XJava.kt
View file @
a70c0174
...
...
@@ -3,9 +3,11 @@ package com.topjohnwu.magisk.extensions
import
android.net.Uri
import
android.os.Build
import
androidx.core.net.toFile
import
timber.log.Timber
import
java.io.File
import
java.io.InputStream
import
java.io.OutputStream
import
java.text.SimpleDateFormat
import
java.util.*
import
java.util.zip.ZipEntry
import
java.util.zip.ZipInputStream
...
...
@@ -100,4 +102,7 @@ fun Locale.toLangTag(): String {
tag
.
append
(
'-'
).
append
(
variant
)
return
tag
.
toString
()
}
}
\ No newline at end of file
}
fun
SimpleDateFormat
.
parseOrNull
(
date
:
String
)
=
runCatching
{
parse
(
date
)
}.
onFailure
{
Timber
.
e
(
it
)
}.
getOrNull
()
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/extensions/XSU.kt
View file @
a70c0174
...
...
@@ -11,4 +11,6 @@ fun reboot(reason: String = if (Info.recovery) "recovery" else "") {
}
fun
File
.
suOutputStream
()
=
SuFileOutputStream
(
this
)
fun
File
.
suInputStream
()
=
SuFileInputStream
(
this
)
\ No newline at end of file
fun
File
.
suInputStream
()
=
SuFileInputStream
(
this
)
val
hasRoot
get
()
=
Shell
.
rootAccess
()
\ No newline at end of file
app/src/main/java/com/topjohnwu/magisk/redesign/home/HomeViewModel.kt
View file @
a70c0174
...
...
@@ -62,6 +62,7 @@ class HomeViewModel(
val
stateMagiskExpanded
=
KObservableField
(
false
)
val
stateManagerExpanded
=
KObservableField
(
false
)
val
stateDeviceExpanded
=
KObservableField
(
false
)
val
stateHideManagerName
=
R
.
string
.
manager
.
res
().
let
{
if
(!
statePackageOriginal
)
{
...
...
app/src/main/res/drawable/ic_device.xml
0 → 100644
View file @
a70c0174
<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24"
android:viewportHeight=
"24"
>
<path
android:fillColor=
"?colorOnSurface"
android:pathData=
"M17,19V5H7V19H17M17,1A2,2 0 0,1 19,3V21A2,2 0 0,1 17,23H7C5.89,23 5,22.1 5,21V3C5,1.89 5.89,1 7,1H17M9,7H15V9H9V7M9,11H13V13H9V11Z"
/>
</vector>
\ No newline at end of file
app/src/main/res/layout/fragment_home_md2.xml
View file @
a70c0174
This diff is collapsed.
Click to expand it.
app/src/main/res/values/strings_md2.xml
View file @
a70c0174
...
...
@@ -5,6 +5,9 @@
<string
name=
"magisk"
>
Magisk
</string>
<string
name=
"system"
>
System
</string>
<string
name=
"yes"
>
Yes
</string>
<string
name=
"no"
>
No
</string>
<string
name=
"no_connection"
>
No connection available
</string>
<string
name=
"section_home"
>
Home
</string>
...
...
@@ -28,6 +31,14 @@
<string
name=
"home_item_source"
>
Source
</string>
<string
name=
"home_item_xda"
>
XDA
</string>
<string
name=
"home_device_security"
>
Security
</string>
<string
name=
"home_device_system"
>
System
</string>
<string
name=
"home_device_build_style"
>
A/B
</string>
<string
name=
"home_device_build_type"
>
SAR
</string>
<string
name=
"home_device_security_secure"
>
Secure
</string>
<string
name=
"home_device_security_outdated"
>
Outdated
</string>
<string
name=
"home_extra_version"
>
Version
</string>
<string
name=
"home_extra_code"
>
Code
</string>
<string
name=
"home_extra_mode"
>
Mode
</string>
...
...
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