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
71136d73
Commit
71136d73
authored
Oct 22, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Manually trigger broadcast tests if necessary
parent
a18c552d
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
4 deletions
+20
-4
Const.kt
app/src/main/java/com/topjohnwu/magisk/Const.kt
+2
-1
Info.kt
app/src/main/java/com/topjohnwu/magisk/Info.kt
+6
-2
GeneralReceiver.kt
...va/com/topjohnwu/magisk/model/receiver/GeneralReceiver.kt
+2
-0
SplashActivity.kt
app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
+1
-1
RootInit.kt
app/src/main/java/com/topjohnwu/magisk/utils/RootInit.kt
+9
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/Const.kt
View file @
71136d73
...
...
@@ -22,8 +22,9 @@ object Const {
const
val
MANAGER_CONFIGS
=
".tmp.magisk.config"
val
USER_ID
=
Process
.
myUid
()
/
100000
object
Magisk
Version
{
object
Version
{
const
val
MIN_SUPPORT
=
18000
const
val
CONNECT_MODE
=
20002
}
object
ID
{
...
...
app/src/main/java/com/topjohnwu/magisk/Info.kt
View file @
71136d73
...
...
@@ -20,13 +20,17 @@ object Info {
val
str
=
ShellUtils
.
fastCmd
(
"magisk -v"
).
split
(
":"
.
toRegex
())[
0
]
val
code
=
ShellUtils
.
fastCmd
(
"magisk -V"
).
toInt
()
val
hide
=
Shell
.
su
(
"magiskhide --status"
).
exec
().
isSuccess
Env
(
code
,
str
,
hide
)
var
mode
=
Int
.
MAX_VALUE
if
(
code
>=
Const
.
Version
.
CONNECT_MODE
)
mode
=
Shell
.
su
(
"magisk --connect-mode"
).
exec
().
code
Env
(
code
,
str
,
hide
,
mode
)
}.
getOrElse
{
Env
()
}
class
Env
(
val
magiskVersionCode
:
Int
=
-
1
,
val
magiskVersionString
:
String
=
""
,
hide
:
Boolean
=
false
hide
:
Boolean
=
false
,
var
connectionMode
:
Int
=
Int
.
MAX_VALUE
)
{
val
magiskHide
get
()
=
Config
.
magiskHide
...
...
app/src/main/java/com/topjohnwu/magisk/model/receiver/GeneralReceiver.kt
View file @
71136d73
...
...
@@ -79,6 +79,8 @@ open class GeneralReceiver : BaseReceiver() {
NOTIFY
->
SuLogger
.
handleNotify
(
context
,
intent
)
TEST
->
{
val
mode
=
intent
.
getIntExtra
(
"mode"
,
1
shl
1
)
if
(
mode
>
Info
.
env
.
connectionMode
)
Info
.
env
.
connectionMode
=
mode
Shell
.
su
(
"magisk --connect-mode $mode"
).
submit
()
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/ui/SplashActivity.kt
View file @
71136d73
...
...
@@ -21,7 +21,7 @@ open class SplashActivity : Activity() {
super
.
onCreate
(
savedInstanceState
)
Shell
.
getShell
{
if
(
Info
.
env
.
magiskVersionCode
>
0
&&
Info
.
env
.
magiskVersionCode
<
Const
.
Magisk
Version
.
MIN_SUPPORT
)
{
if
(
Info
.
env
.
magiskVersionCode
>
0
&&
Info
.
env
.
magiskVersionCode
<
Const
.
Version
.
MIN_SUPPORT
)
{
AlertDialog
.
Builder
(
this
)
.
setTitle
(
R
.
string
.
unsupport_magisk_title
)
.
setMessage
(
R
.
string
.
unsupport_magisk_message
)
...
...
app/src/main/java/com/topjohnwu/magisk/utils/RootInit.kt
View file @
71136d73
...
...
@@ -17,6 +17,9 @@ class RootInit : Shell.Initializer() {
}
fun
init
(
context
:
Context
,
shell
:
Shell
):
Boolean
{
// Invalidate env state if shell is recreated
Info
.
envRef
.
invalidate
()
val
job
=
shell
.
newJob
()
if
(
shell
.
isRoot
)
{
job
.
add
(
context
.
rawResource
(
R
.
raw
.
util_functions
))
...
...
@@ -35,6 +38,12 @@ class RootInit : Shell.Initializer() {
Info
.
keepVerity
=
ShellUtils
.
fastCmd
(
"echo \$KEEPVERITY"
).
toBoolean
()
Info
.
keepEnc
=
ShellUtils
.
fastCmd
(
"echo \$KEEPFORCEENCRYPT"
).
toBoolean
()
Info
.
recovery
=
ShellUtils
.
fastCmd
(
"echo \$RECOVERYMODE"
).
toBoolean
()
if
(
Info
.
env
.
connectionMode
==
0
)
{
// Manually trigger broadcast test
Shell
.
su
(
"magisk --broadcast-test"
).
exec
()
}
return
true
}
}
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