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
dc65a2b8
Commit
dc65a2b8
authored
May 15, 2022
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce new debug channel
parent
071ae79f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
8 deletions
+16
-8
Config.kt
app/src/main/java/com/topjohnwu/magisk/core/Config.kt
+3
-0
NetworkService.kt
...va/com/topjohnwu/magisk/data/repository/NetworkService.kt
+4
-2
arrays.xml
app/src/main/res/values/arrays.xml
+1
-0
build.py
build.py
+4
-4
DownloadActivity.java
.../src/main/java/com/topjohnwu/magisk/DownloadActivity.java
+4
-2
No files found.
app/src/main/java/com/topjohnwu/magisk/core/Config.kt
View file @
dc65a2b8
...
@@ -70,6 +70,7 @@ object Config : PreferenceModel, DBConfig {
...
@@ -70,6 +70,7 @@ object Config : PreferenceModel, DBConfig {
const
val
BETA_CHANNEL
=
1
const
val
BETA_CHANNEL
=
1
const
val
CUSTOM_CHANNEL
=
2
const
val
CUSTOM_CHANNEL
=
2
const
val
CANARY_CHANNEL
=
3
const
val
CANARY_CHANNEL
=
3
const
val
DEBUG_CHANNEL
=
4
// root access mode
// root access mode
const
val
ROOT_ACCESS_DISABLED
=
0
const
val
ROOT_ACCESS_DISABLED
=
0
...
@@ -106,6 +107,8 @@ object Config : PreferenceModel, DBConfig {
...
@@ -106,6 +107,8 @@ object Config : PreferenceModel, DBConfig {
private
val
defaultChannel
=
private
val
defaultChannel
=
if
(
BuildConfig
.
DEBUG
)
if
(
BuildConfig
.
DEBUG
)
Value
.
DEBUG_CHANNEL
else
if
(
Const
.
APP_IS_CANARY
)
Value
.
CANARY_CHANNEL
Value
.
CANARY_CHANNEL
else
else
Value
.
DEFAULT_CHANNEL
Value
.
DEFAULT_CHANNEL
...
...
app/src/main/java/com/topjohnwu/magisk/data/repository/NetworkService.kt
View file @
dc65a2b8
...
@@ -4,6 +4,7 @@ import com.topjohnwu.magisk.core.Config
...
@@ -4,6 +4,7 @@ import com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Config.Value.BETA_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.BETA_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.CANARY_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.CANARY_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.CUSTOM_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.CUSTOM_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.DEBUG_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.DEFAULT_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.DEFAULT_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.STABLE_CHANNEL
import
com.topjohnwu.magisk.core.Config.Value.STABLE_CHANNEL
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.Info
...
@@ -24,12 +25,12 @@ class NetworkService(
...
@@ -24,12 +25,12 @@ class NetworkService(
DEFAULT_CHANNEL
,
STABLE_CHANNEL
->
fetchStableUpdate
()
DEFAULT_CHANNEL
,
STABLE_CHANNEL
->
fetchStableUpdate
()
BETA_CHANNEL
->
fetchBetaUpdate
()
BETA_CHANNEL
->
fetchBetaUpdate
()
CANARY_CHANNEL
->
fetchCanaryUpdate
()
CANARY_CHANNEL
->
fetchCanaryUpdate
()
DEBUG_CHANNEL
->
fetchDebugUpdate
()
CUSTOM_CHANNEL
->
fetchCustomUpdate
(
Config
.
customChannelUrl
)
CUSTOM_CHANNEL
->
fetchCustomUpdate
(
Config
.
customChannelUrl
)
else
->
throw
IllegalArgumentException
()
else
->
throw
IllegalArgumentException
()
}
}
if
(
info
.
magisk
.
versionCode
<
Info
.
env
.
versionCode
&&
if
(
info
.
magisk
.
versionCode
<
Info
.
env
.
versionCode
&&
Config
.
updateChannel
==
DEFAULT_CHANNEL
Config
.
updateChannel
==
DEFAULT_CHANNEL
)
{
)
{
Config
.
updateChannel
=
BETA_CHANNEL
Config
.
updateChannel
=
BETA_CHANNEL
info
=
fetchBetaUpdate
()
info
=
fetchBetaUpdate
()
}
}
...
@@ -40,6 +41,7 @@ class NetworkService(
...
@@ -40,6 +41,7 @@ class NetworkService(
private
suspend
fun
fetchStableUpdate
()
=
pages
.
fetchUpdateJSON
(
"stable.json"
)
private
suspend
fun
fetchStableUpdate
()
=
pages
.
fetchUpdateJSON
(
"stable.json"
)
private
suspend
fun
fetchBetaUpdate
()
=
pages
.
fetchUpdateJSON
(
"beta.json"
)
private
suspend
fun
fetchBetaUpdate
()
=
pages
.
fetchUpdateJSON
(
"beta.json"
)
private
suspend
fun
fetchCanaryUpdate
()
=
pages
.
fetchUpdateJSON
(
"canary.json"
)
private
suspend
fun
fetchCanaryUpdate
()
=
pages
.
fetchUpdateJSON
(
"canary.json"
)
private
suspend
fun
fetchDebugUpdate
()
=
pages
.
fetchUpdateJSON
(
"debug.json"
)
private
suspend
fun
fetchCustomUpdate
(
url
:
String
)
=
raw
.
fetchCustomUpdate
(
url
)
private
suspend
fun
fetchCustomUpdate
(
url
:
String
)
=
raw
.
fetchCustomUpdate
(
url
)
private
inline
fun
<
T
>
safe
(
factory
:
()
->
T
):
T
?
{
private
inline
fun
<
T
>
safe
(
factory
:
()
->
T
):
T
?
{
...
...
app/src/main/res/values/arrays.xml
View file @
dc65a2b8
...
@@ -65,6 +65,7 @@
...
@@ -65,6 +65,7 @@
<item>
@string/settings_update_beta
</item>
<item>
@string/settings_update_beta
</item>
<item>
@string/settings_update_custom
</item>
<item>
@string/settings_update_custom
</item>
<item>
Canary
</item>
<item>
Canary
</item>
<item>
Debug
</item>
</string-array>
</string-array>
</resources>
</resources>
build.py
View file @
dc65a2b8
...
@@ -275,8 +275,8 @@ def write_if_diff(file_name, text):
...
@@ -275,8 +275,8 @@ def write_if_diff(file_name, text):
f
.
write
(
text
)
f
.
write
(
text
)
def
dump_bin_header
():
def
dump_bin_header
(
args
):
stub
=
op
.
join
(
config
[
'outdir'
],
'stub-release
.apk'
)
stub
=
op
.
join
(
config
[
'outdir'
],
f
'stub-{"release" if args.release else "debug"}
.apk'
)
if
not
op
.
exists
(
stub
):
if
not
op
.
exists
(
stub
):
error
(
'Build stub APK before building "magiskinit"'
)
error
(
'Build stub APK before building "magiskinit"'
)
mkdir_p
(
native_gen_path
)
mkdir_p
(
native_gen_path
)
...
@@ -353,7 +353,7 @@ def build_binary(args):
...
@@ -353,7 +353,7 @@ def build_binary(args):
flag
=
''
flag
=
''
if
'magiskinit'
in
args
.
target
:
if
'magiskinit'
in
args
.
target
:
dump_bin_header
()
dump_bin_header
(
args
)
flag
+=
' B_INIT=1'
flag
+=
' B_INIT=1'
if
'resetprop'
in
args
.
target
:
if
'resetprop'
in
args
.
target
:
...
@@ -370,7 +370,7 @@ def build_binary(args):
...
@@ -370,7 +370,7 @@ def build_binary(args):
def
build_apk
(
args
,
module
):
def
build_apk
(
args
,
module
):
build_type
=
'Release'
if
args
.
release
or
module
==
'stub'
else
'Debug'
build_type
=
'Release'
if
args
.
release
else
'Debug'
proc
=
execv
([
gradlew
,
f
'{module}:assemble{build_type}'
,
proc
=
execv
([
gradlew
,
f
'{module}:assemble{build_type}'
,
'-PconfigPath='
+
op
.
abspath
(
args
.
config
)])
'-PconfigPath='
+
op
.
abspath
(
args
.
config
)])
...
...
stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java
View file @
dc65a2b8
...
@@ -40,7 +40,9 @@ import io.michaelrocks.paranoid.Obfuscate;
...
@@ -40,7 +40,9 @@ import io.michaelrocks.paranoid.Obfuscate;
public
class
DownloadActivity
extends
Activity
{
public
class
DownloadActivity
extends
Activity
{
private
static
final
String
APP_NAME
=
"Magisk"
;
private
static
final
String
APP_NAME
=
"Magisk"
;
private
static
final
String
CANARY_URL
=
"https://topjohnwu.github.io/magisk-files/canary.json"
;
private
static
final
String
JSON_URL
=
BuildConfig
.
DEBUG
?
"https://topjohnwu.github.io/magisk-files/debug.json"
:
"https://topjohnwu.github.io/magisk-files/canary.json"
;
private
String
apkLink
=
BuildConfig
.
APK_URL
;
private
String
apkLink
=
BuildConfig
.
APK_URL
;
private
Context
themed
;
private
Context
themed
;
...
@@ -105,7 +107,7 @@ public class DownloadActivity extends Activity {
...
@@ -105,7 +107,7 @@ public class DownloadActivity extends Activity {
private
void
fetchCanary
()
{
private
void
fetchCanary
()
{
dialog
=
ProgressDialog
.
show
(
themed
,
""
,
""
,
true
);
dialog
=
ProgressDialog
.
show
(
themed
,
""
,
""
,
true
);
request
(
CANARY
_URL
).
getAsJSONObject
(
json
->
{
request
(
JSON
_URL
).
getAsJSONObject
(
json
->
{
dialog
.
dismiss
();
dialog
.
dismiss
();
try
{
try
{
apkLink
=
json
.
getJSONObject
(
"magisk"
).
getString
(
"link"
);
apkLink
=
json
.
getJSONObject
(
"magisk"
).
getString
(
"link"
);
...
...
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