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
ced9b4a8
Commit
ced9b4a8
authored
Apr 06, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default to beta channel if detected
parent
7af7910e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
24 deletions
+38
-24
Config.java
app/src/main/java/com/topjohnwu/magisk/Config.java
+2
-1
UpdateCheckService.java
...a/com/topjohnwu/magisk/components/UpdateCheckService.java
+1
-1
SettingsFragment.java
...java/com/topjohnwu/magisk/fragments/SettingsFragment.java
+9
-14
CheckUpdates.java
...rc/main/java/com/topjohnwu/magisk/tasks/CheckUpdates.java
+25
-7
strings.xml
app/src/main/res/values-sk/strings.xml
+1
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/Config.java
View file @
ced9b4a8
...
...
@@ -73,6 +73,7 @@ public class Config {
}
public
static
class
Value
{
public
static
final
int
DEFAULT_CHANNEL
=
-
1
;
public
static
final
int
STABLE_CHANNEL
=
0
;
public
static
final
int
BETA_CHANNEL
=
1
;
public
static
final
int
CUSTOM_CHANNEL
=
2
;
...
...
@@ -316,7 +317,7 @@ public class Config {
defs
.
put
(
Key
.
SU_AUTO_RESPONSE
,
Value
.
SU_PROMPT
);
defs
.
put
(
Key
.
SU_NOTIFICATION
,
Value
.
NOTIFICATION_TOAST
);
defs
.
put
(
Key
.
UPDATE_CHANNEL
,
Utils
.
isCanary
()
?
Value
.
CANARY_DEBUG_CHANNEL
:
Value
.
STABLE
_CHANNEL
);
Value
.
CANARY_DEBUG_CHANNEL
:
Value
.
DEFAULT
_CHANNEL
);
// prefs bool
defs
.
put
(
Key
.
CHECK_UPDATES
,
true
);
...
...
app/src/main/java/com/topjohnwu/magisk/components/UpdateCheckService.java
View file @
ced9b4a8
...
...
@@ -15,7 +15,7 @@ public class UpdateCheckService extends DelegateWorker {
@Override
public
ListenableWorker
.
Result
doWork
()
{
Shell
.
getShell
();
CheckUpdates
.
check
Now
(
this
::
onCheckDone
);
CheckUpdates
.
check
(
this
::
onCheckDone
);
return
ListenableWorker
.
Result
.
success
();
}
...
...
app/src/main/java/com/topjohnwu/magisk/fragments/SettingsFragment.java
View file @
ced9b4a8
...
...
@@ -239,39 +239,34 @@ public class SettingsFragment extends BasePreferenceFragment {
private
void
setSummary
(
String
key
)
{
switch
(
key
)
{
case
Config
.
Key
.
UPDATE_CHANNEL
:
int
ch
=
Config
.
get
(
key
);
ch
=
ch
<
0
?
Config
.
Value
.
STABLE_CHANNEL
:
ch
;
updateChannel
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
update_channel
)
[(
int
)
Config
.
get
(
Config
.
Key
.
UPDATE_CHANNEL
)]);
.
getStringArray
(
R
.
array
.
update_channel
)[
ch
]);
break
;
case
Config
.
Key
.
ROOT_ACCESS
:
rootConfig
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
su_access
)
[(
int
)
Config
.
get
(
Config
.
Key
.
ROOT_ACCESS
)]);
.
getStringArray
(
R
.
array
.
su_access
)[(
int
)
Config
.
get
(
key
)]);
break
;
case
Config
.
Key
.
SU_AUTO_RESPONSE
:
autoRes
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
auto_response
)
[(
int
)
Config
.
get
(
Config
.
Key
.
SU_AUTO_RESPONSE
)]);
.
getStringArray
(
R
.
array
.
auto_response
)[(
int
)
Config
.
get
(
key
)]);
break
;
case
Config
.
Key
.
SU_NOTIFICATION
:
suNotification
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
su_notification
)
[(
int
)
Config
.
get
(
Config
.
Key
.
SU_NOTIFICATION
)]);
.
getStringArray
(
R
.
array
.
su_notification
)[(
int
)
Config
.
get
(
key
)]);
break
;
case
Config
.
Key
.
SU_REQUEST_TIMEOUT
:
requestTimeout
.
setSummary
(
getString
(
R
.
string
.
request_timeout_summary
,
(
int
)
Config
.
get
(
Config
.
Key
.
SU_REQUEST_TIMEOUT
)));
getString
(
R
.
string
.
request_timeout_summary
,
(
int
)
Config
.
get
(
key
)));
break
;
case
Config
.
Key
.
SU_MULTIUSER_MODE
:
multiuserConfig
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
multiuser_summary
)
[(
int
)
Config
.
get
(
Config
.
Key
.
SU_MULTIUSER_MODE
)]);
.
getStringArray
(
R
.
array
.
multiuser_summary
)[(
int
)
Config
.
get
(
key
)]);
break
;
case
Config
.
Key
.
SU_MNT_NS
:
nsConfig
.
setSummary
(
getResources
()
.
getStringArray
(
R
.
array
.
namespace_summary
)
[(
int
)
Config
.
get
(
Config
.
Key
.
SU_MNT_NS
)]);
.
getStringArray
(
R
.
array
.
namespace_summary
)[(
int
)
Config
.
get
(
key
)]);
break
;
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/tasks/CheckUpdates.java
View file @
ced9b4a8
...
...
@@ -8,6 +8,7 @@ import com.topjohnwu.magisk.utils.Event;
import
com.topjohnwu.net.Networking
;
import
com.topjohnwu.net.Request
;
import
com.topjohnwu.net.ResponseListener
;
import
com.topjohnwu.superuser.ShellUtils
;
import
com.topjohnwu.superuser.internal.UiThreadHandler
;
import
org.json.JSONException
;
...
...
@@ -30,7 +31,6 @@ public class CheckUpdates {
case
Config
.
Value
.
CANARY_DEBUG_CHANNEL
:
url
=
Const
.
Url
.
CANARY_DEBUG_URL
;
break
;
case
Config
.
Value
.
STABLE_CHANNEL
:
default
:
url
=
Const
.
Url
.
STABLE_URL
;
break
;
...
...
@@ -39,13 +39,19 @@ public class CheckUpdates {
}
public
static
void
check
()
{
getRequest
().
getAsJSONObject
(
new
UpdateListener
(
null
)
);
check
(
null
);
}
public
static
void
checkNow
(
Runnable
cb
)
{
JSONObject
json
=
getRequest
().
execForJSONObject
().
getResult
();
if
(
json
!=
null
)
new
UpdateListener
(
cb
).
onResponse
(
json
);
public
static
void
check
(
Runnable
cb
)
{
Request
request
=
getRequest
();
UpdateListener
listener
=
new
UpdateListener
(
cb
);
if
(
ShellUtils
.
onMainThread
())
{
request
.
getAsJSONObject
(
listener
);
}
else
{
JSONObject
json
=
request
.
execForJSONObject
().
getResult
();
if
(
json
!=
null
)
listener
.
onResponse
(
json
);
}
}
private
static
class
UpdateListener
implements
ResponseListener
<
JSONObject
>
{
...
...
@@ -89,8 +95,20 @@ public class CheckUpdates {
@Override
public
void
onResponse
(
JSONObject
json
)
{
JSONObject
magisk
=
getJson
(
json
,
"magisk"
);
Config
.
remoteMagiskVersionString
=
getString
(
magisk
,
"version"
,
null
);
Config
.
remoteMagiskVersionCode
=
getInt
(
magisk
,
"versionCode"
,
-
1
);
if
((
int
)
Config
.
get
(
Config
.
Key
.
UPDATE_CHANNEL
)
==
Config
.
Value
.
DEFAULT_CHANNEL
)
{
if
(
Config
.
magiskVersionCode
>
Config
.
remoteMagiskVersionCode
)
{
// If we are newer than current stable channel, switch to beta
Config
.
set
(
Config
.
Key
.
UPDATE_CHANNEL
,
Config
.
Value
.
BETA_CHANNEL
);
check
(
cb
);
return
;
}
else
{
Config
.
set
(
Config
.
Key
.
UPDATE_CHANNEL
,
Config
.
Value
.
STABLE_CHANNEL
);
}
}
Config
.
remoteMagiskVersionString
=
getString
(
magisk
,
"version"
,
null
);
Config
.
magiskLink
=
getString
(
magisk
,
"link"
,
null
);
Config
.
magiskNoteLink
=
getString
(
magisk
,
"note"
,
null
);
Config
.
magiskMD5
=
getString
(
magisk
,
"md5"
,
null
);
...
...
app/src/main/res/values-sk/strings.xml
View file @
ced9b4a8
...
...
@@ -155,7 +155,7 @@
<string
name=
"auto_response"
>
Automatická odpoveď
</string>
<string
name=
"request_timeout"
>
Časový limit pre odpoveď
</string>
<string
name=
"superuser_notification"
>
Notifikácie Superuser
</string>
<string
name=
"request_timeout_summary"
>
%1$
s
sekúnd
</string>
<string
name=
"request_timeout_summary"
>
%1$
d
sekúnd
</string>
<string
name=
"settings_su_reauth_title"
>
Overenie autentifikácie po upgrade
</string>
<string
name=
"settings_su_reauth_summary"
>
Overí autentifikáciu oprávnení superuser po upgrade aplikácie
</string>
<string
name=
"settings_su_fingerprint_title"
>
Povoliť autentifikáciu odtlačkom prsta
</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