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
1e7e06d1
Commit
1e7e06d1
authored
Feb 18, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proper canary version detection
parent
8453282f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
36 deletions
+15
-36
Config.kt
app/src/main/java/com/topjohnwu/magisk/core/Config.kt
+10
-32
Info.kt
app/src/main/java/com/topjohnwu/magisk/core/Info.kt
+2
-0
Utils.kt
app/src/main/java/com/topjohnwu/magisk/core/utils/Utils.kt
+0
-2
SettingsItems.kt
...in/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt
+2
-1
DownloadActivity.java
.../src/main/java/com/topjohnwu/magisk/DownloadActivity.java
+1
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/core/Config.kt
View file @
1e7e06d1
...
@@ -106,7 +106,7 @@ object Config : PreferenceModel, DBConfig {
...
@@ -106,7 +106,7 @@ object Config : PreferenceModel, DBConfig {
}
}
private
val
defaultChannel
=
private
val
defaultChannel
=
if
(
Utils
.
isCanary
)
{
if
(
isCanaryVersion
)
{
if
(
BuildConfig
.
DEBUG
)
if
(
BuildConfig
.
DEBUG
)
Value
.
CANARY_DEBUG_CHANNEL
Value
.
CANARY_DEBUG_CHANNEL
else
else
...
@@ -116,24 +116,12 @@ object Config : PreferenceModel, DBConfig {
...
@@ -116,24 +116,12 @@ object Config : PreferenceModel, DBConfig {
var
bootId
by
preference
(
Key
.
BOOT_ID
,
""
)
var
bootId
by
preference
(
Key
.
BOOT_ID
,
""
)
var
downloadPath
by
preference
(
Key
.
DOWNLOAD_PATH
,
Environment
.
DIRECTORY_DOWNLOADS
)
var
downloadPath
by
preference
(
Key
.
DOWNLOAD_PATH
,
Environment
.
DIRECTORY_DOWNLOADS
)
var
repoOrder
by
preference
(
var
repoOrder
by
preference
(
Key
.
REPO_ORDER
,
Value
.
ORDER_DATE
)
Key
.
REPO_ORDER
,
Value
.
ORDER_DATE
)
var
suDefaultTimeout
by
preferenceStrInt
(
Key
.
SU_REQUEST_TIMEOUT
,
10
)
var
suDefaultTimeout
by
preferenceStrInt
(
Key
.
SU_REQUEST_TIMEOUT
,
10
)
var
suAutoReponse
by
preferenceStrInt
(
var
suAutoReponse
by
preferenceStrInt
(
Key
.
SU_AUTO_RESPONSE
,
Value
.
SU_PROMPT
)
Key
.
SU_AUTO_RESPONSE
,
var
suNotification
by
preferenceStrInt
(
Key
.
SU_NOTIFICATION
,
Value
.
NOTIFICATION_TOAST
)
Value
.
SU_PROMPT
var
updateChannel
by
preferenceStrInt
(
Key
.
UPDATE_CHANNEL
,
defaultChannel
)
)
var
suNotification
by
preferenceStrInt
(
Key
.
SU_NOTIFICATION
,
Value
.
NOTIFICATION_TOAST
)
var
updateChannel
by
preferenceStrInt
(
Key
.
UPDATE_CHANNEL
,
defaultChannel
)
var
safetyNotice
by
preference
(
Key
.
SAFETY
,
true
)
var
safetyNotice
by
preference
(
Key
.
SAFETY
,
true
)
var
darkThemeExtended
by
preference
(
var
darkThemeExtended
by
preference
(
...
@@ -153,26 +141,16 @@ object Config : PreferenceModel, DBConfig {
...
@@ -153,26 +141,16 @@ object Config : PreferenceModel, DBConfig {
var
customChannelUrl
by
preference
(
Key
.
CUSTOM_CHANNEL
,
""
)
var
customChannelUrl
by
preference
(
Key
.
CUSTOM_CHANNEL
,
""
)
var
locale
by
preference
(
Key
.
LOCALE
,
""
)
var
locale
by
preference
(
Key
.
LOCALE
,
""
)
var
rootMode
by
dbSettings
(
var
rootMode
by
dbSettings
(
Key
.
ROOT_ACCESS
,
Value
.
ROOT_ACCESS_APPS_AND_ADB
)
Key
.
ROOT_ACCESS
,
var
suMntNamespaceMode
by
dbSettings
(
Key
.
SU_MNT_NS
,
Value
.
NAMESPACE_MODE_REQUESTER
)
Value
.
ROOT_ACCESS_APPS_AND_ADB
var
suMultiuserMode
by
dbSettings
(
Key
.
SU_MULTIUSER_MODE
,
Value
.
MULTIUSER_MODE_OWNER_ONLY
)
)
var
suMntNamespaceMode
by
dbSettings
(
Key
.
SU_MNT_NS
,
Value
.
NAMESPACE_MODE_REQUESTER
)
var
suMultiuserMode
by
dbSettings
(
Key
.
SU_MULTIUSER_MODE
,
Value
.
MULTIUSER_MODE_OWNER_ONLY
)
var
suBiometric
by
dbSettings
(
Key
.
SU_BIOMETRIC
,
false
)
var
suBiometric
by
dbSettings
(
Key
.
SU_BIOMETRIC
,
false
)
var
suManager
by
dbStrings
(
Key
.
SU_MANAGER
,
""
,
true
)
var
suManager
by
dbStrings
(
Key
.
SU_MANAGER
,
""
,
true
)
var
keyStoreRaw
by
dbStrings
(
Key
.
KEYSTORE
,
""
,
true
)
var
keyStoreRaw
by
dbStrings
(
Key
.
KEYSTORE
,
""
,
true
)
// Always return a path in external storage where we can write
// Always return a path in external storage where we can write
val
downloadDirectory
val
downloadDirectory
get
()
=
get
()
=
Utils
.
ensureDownloadPath
(
downloadPath
)
?:
get
<
Context
>().
getExternalFilesDir
(
null
)
!!
Utils
.
ensureDownloadPath
(
downloadPath
)
?:
get
<
Context
>().
getExternalFilesDir
(
null
)
!!
private
const
val
SU_FINGERPRINT
=
"su_fingerprint"
private
const
val
SU_FINGERPRINT
=
"su_fingerprint"
...
...
app/src/main/java/com/topjohnwu/magisk/core/Info.kt
View file @
1e7e06d1
package
com.topjohnwu.magisk.core
package
com.topjohnwu.magisk.core
import
com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
import
com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
import
com.topjohnwu.magisk.BuildConfig
import
com.topjohnwu.magisk.DynAPK
import
com.topjohnwu.magisk.DynAPK
import
com.topjohnwu.magisk.core.model.UpdateInfo
import
com.topjohnwu.magisk.core.model.UpdateInfo
import
com.topjohnwu.magisk.extensions.get
import
com.topjohnwu.magisk.extensions.get
...
@@ -13,6 +14,7 @@ import java.io.FileInputStream
...
@@ -13,6 +14,7 @@ import java.io.FileInputStream
import
java.io.IOException
import
java.io.IOException
val
isRunningAsStub
get
()
=
Info
.
stub
!=
null
val
isRunningAsStub
get
()
=
Info
.
stub
!=
null
val
isCanaryVersion
=
!
BuildConfig
.
VERSION_NAME
.
contains
(
"."
)
object
Info
{
object
Info
{
...
...
app/src/main/java/com/topjohnwu/magisk/core/utils/Utils.kt
View file @
1e7e06d1
...
@@ -17,8 +17,6 @@ import java.util.concurrent.TimeUnit
...
@@ -17,8 +17,6 @@ import java.util.concurrent.TimeUnit
object
Utils
{
object
Utils
{
val
isCanary
:
Boolean
=
BuildConfig
.
VERSION_NAME
.
contains
(
"-"
)
fun
toast
(
msg
:
CharSequence
,
duration
:
Int
)
{
fun
toast
(
msg
:
CharSequence
,
duration
:
Int
)
{
UiThreadHandler
.
run
{
Toast
.
makeText
(
get
(),
msg
,
duration
).
show
()
}
UiThreadHandler
.
run
{
Toast
.
makeText
(
get
(),
msg
,
duration
).
show
()
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt
View file @
1e7e06d1
...
@@ -12,6 +12,7 @@ import com.topjohnwu.magisk.R
...
@@ -12,6 +12,7 @@ import com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Config
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.Const
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.isCanaryVersion
import
com.topjohnwu.magisk.core.utils.*
import
com.topjohnwu.magisk.core.utils.*
import
com.topjohnwu.magisk.databinding.DialogSettingsAppNameBinding
import
com.topjohnwu.magisk.databinding.DialogSettingsAppNameBinding
import
com.topjohnwu.magisk.databinding.DialogSettingsDownloadPathBinding
import
com.topjohnwu.magisk.databinding.DialogSettingsDownloadPathBinding
...
@@ -140,7 +141,7 @@ object UpdateChannel : SettingsItem.Selector() {
...
@@ -140,7 +141,7 @@ object UpdateChannel : SettingsItem.Selector() {
override
val
title
=
R
.
string
.
settings_update_channel_title
.
asTransitive
()
override
val
title
=
R
.
string
.
settings_update_channel_title
.
asTransitive
()
override
val
entries
=
resources
.
getStringArray
(
R
.
array
.
update_channel
).
let
{
override
val
entries
=
resources
.
getStringArray
(
R
.
array
.
update_channel
).
let
{
if
(!
Utils
.
isCanary
&&
Config
.
updateChannel
<
Config
.
Value
.
CANARY_CHANNEL
)
if
(!
isCanaryVersion
&&
Config
.
updateChannel
<
Config
.
Value
.
CANARY_CHANNEL
)
it
.
take
(
it
.
size
-
2
).
toTypedArray
()
else
it
it
.
take
(
it
.
size
-
2
).
toTypedArray
()
else
it
}
}
override
val
entryValues
=
resources
.
getStringArray
(
R
.
array
.
value_array
)
override
val
entryValues
=
resources
.
getStringArray
(
R
.
array
.
value_array
)
...
...
stub/src/main/java/com/topjohnwu/magisk/DownloadActivity.java
View file @
1e7e06d1
...
@@ -27,7 +27,7 @@ import static com.topjohnwu.magisk.DelegateApplication.MANAGER_APK;
...
@@ -27,7 +27,7 @@ import static com.topjohnwu.magisk.DelegateApplication.MANAGER_APK;
public
class
DownloadActivity
extends
Activity
{
public
class
DownloadActivity
extends
Activity
{
private
static
final
boolean
CANARY
=
BuildConfig
.
VERSION_NAME
.
contains
(
"-
"
);
private
static
final
boolean
CANARY
=
!
BuildConfig
.
VERSION_NAME
.
contains
(
".
"
);
private
static
final
String
URL
=
private
static
final
String
URL
=
BuildConfig
.
DEV_CHANNEL
!=
null
?
BuildConfig
.
DEV_CHANNEL
:
RawData
.
urlBase
()
+
BuildConfig
.
DEV_CHANNEL
!=
null
?
BuildConfig
.
DEV_CHANNEL
:
RawData
.
urlBase
()
+
(
BuildConfig
.
DEBUG
?
RawData
.
debug
()
:
(
CANARY
?
RawData
.
canary
()
:
RawData
.
stable
()));
(
BuildConfig
.
DEBUG
?
RawData
.
debug
()
:
(
CANARY
?
RawData
.
canary
()
:
RawData
.
stable
()));
...
...
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