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
50e2f33d
Commit
50e2f33d
authored
May 30, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More debug indication in UI
Close #5874
parent
5e6eb8dd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
8 deletions
+22
-8
Info.kt
app/src/main/java/com/topjohnwu/magisk/core/Info.kt
+8
-4
HomeViewModel.kt
...c/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+4
-2
daemon.cpp
native/jni/core/daemon.cpp
+5
-1
magisk.cpp
native/jni/core/magisk.cpp
+5
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/core/Info.kt
View file @
50e2f33d
...
...
@@ -52,13 +52,17 @@ object Info {
}
}
private
fun
loadState
()
=
Env
(
fastCmd
(
"magisk -v"
).
split
(
":"
.
toRegex
())[
0
],
runCatching
{
fastCmd
(
"magisk -V"
).
toInt
()
}.
getOrDefault
(-
1
)
)
private
fun
loadState
():
Env
{
val
v
=
fastCmd
(
"magisk -v"
).
split
(
":"
.
toRegex
())
return
Env
(
v
[
0
],
v
.
size
>=
3
&&
v
[
2
]
==
"D"
,
runCatching
{
fastCmd
(
"magisk -V"
).
toInt
()
}.
getOrDefault
(-
1
)
)
}
class
Env
(
val
versionString
:
String
=
""
,
val
isDebug
:
Boolean
=
false
,
code
:
Int
=
-
1
)
{
val
versionCode
=
when
{
...
...
app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
View file @
50e2f33d
...
...
@@ -57,7 +57,7 @@ class HomeViewModel(
val
magiskInstalledVersion
get
()
=
Info
.
env
.
run
{
if
(
isActive
)
"$versionString ($versionCode)"
.
asText
()
(
"$versionString ($versionCode)"
+
if
(
isDebug
)
" (D)"
else
""
)
.
asText
()
else
R
.
string
.
not_available
.
asText
()
}
...
...
@@ -93,8 +93,10 @@ class HomeViewModel(
else
->
MagiskState
.
UP_TO_DATE
}
val
isDebug
=
Config
.
updateChannel
==
Config
.
Value
.
DEBUG_CHANNEL
managerRemoteVersion
=
"${magisk.version} (${magisk.versionCode}) (${stub.versionCode})"
.
asText
()
(
"${magisk.version} (${magisk.versionCode}) (${stub.versionCode})"
+
if
(
isDebug
)
" (D)"
else
""
).
asText
()
}
?:
run
{
state
=
State
.
LOADING_FAILED
managerRemoteVersion
=
R
.
string
.
not_available
.
asText
()
...
...
native/jni/core/daemon.cpp
View file @
50e2f33d
...
...
@@ -174,7 +174,11 @@ static void handle_request_async(int client, int code, const sock_cred &cred) {
static
void
handle_request_sync
(
int
client
,
int
code
)
{
switch
(
code
)
{
case
MainRequest
:
:
CHECK_VERSION
:
write_string
(
client
,
MAGISK_VERSION
":MAGISK"
);
#if MAGISK_DEBUG
write_string
(
client
,
MAGISK_VERSION
":MAGISK:D"
);
#else
write_string
(
client
,
MAGISK_VERSION
":MAGISK:R"
);
#endif
break
;
case
MainRequest
:
:
CHECK_VERSION_CODE
:
write_int
(
client
,
MAGISK_VER_CODE
);
...
...
native/jni/core/magisk.cpp
View file @
50e2f33d
...
...
@@ -52,7 +52,11 @@ int magisk_main(int argc, char *argv[]) {
if
(
argc
<
2
)
usage
();
if
(
argv
[
1
]
==
"-c"
sv
)
{
printf
(
MAGISK_VERSION
":MAGISK ("
str
(
MAGISK_VER_CODE
)
")
\n
"
);
#if MAGISK_DEBUG
printf
(
MAGISK_VERSION
":MAGISK:D ("
str
(
MAGISK_VER_CODE
)
")
\n
"
);
#else
printf
(
MAGISK_VERSION
":MAGISK:R ("
str
(
MAGISK_VER_CODE
)
")
\n
"
);
#endif
return
0
;
}
else
if
(
argv
[
1
]
==
"-v"
sv
)
{
int
fd
=
connect_daemon
(
MainRequest
::
CHECK_VERSION
);
...
...
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