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
a22a1dd2
Commit
a22a1dd2
authored
Aug 22, 2020
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only offer shortcuts when running as stub
parent
27c59dbb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
11 deletions
+13
-11
Hacks.kt
app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
+1
-1
Info.kt
app/src/main/java/com/topjohnwu/magisk/core/Info.kt
+7
-3
ManagerUpgrade.kt
...java/com/topjohnwu/magisk/core/download/ManagerUpgrade.kt
+1
-1
MainActivity.kt
app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt
+2
-5
SettingsViewModel.kt
...ava/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt
+2
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/core/Hacks.kt
View file @
a22a1dd2
...
...
@@ -136,7 +136,7 @@ private class JobSchedulerWrapper(private val base: JobScheduler) : JobScheduler
val
name
=
service
.
className
val
component
=
ComponentName
(
service
.
packageName
,
Info
.
stub
!!
.
classToComponent
[
name
]
?:
name
Info
.
stub
Chk
.
classToComponent
[
name
]
?:
name
)
javaClass
.
forceGetDeclaredField
(
"service"
)
?.
set
(
this
,
component
)
...
...
app/src/main/java/com/topjohnwu/magisk/core/Info.kt
View file @
a22a1dd2
...
...
@@ -18,9 +18,13 @@ object Info {
val
envRef
=
CachedValue
{
loadState
()
}
@JvmStatic
val
env
by
envRef
// Local
@JvmStatic
var
stub
:
DynAPK
.
Data
?
=
null
// Stub
var
remote
=
UpdateInfo
()
// Remote
@JvmStatic
val
env
by
envRef
var
stub
:
DynAPK
.
Data
?
=
null
val
stubChk
:
DynAPK
.
Data
get
()
=
stub
as
DynAPK
.
Data
var
remote
=
UpdateInfo
()
// Toggle-able options
@JvmStatic
var
keepVerity
=
false
...
...
app/src/main/java/com/topjohnwu/magisk/core/download/ManagerUpgrade.kt
View file @
a22a1dd2
...
...
@@ -38,7 +38,7 @@ private suspend fun DownloadService.upgrade(apk: File, id: Int) {
// Move to upgrade location
apk
.
copyTo
(
DynAPK
.
update
(
this
),
overwrite
=
true
)
apk
.
delete
()
if
(
Info
.
stub
!!
.
version
<
Info
.
remote
.
stub
.
versionCode
)
{
if
(
Info
.
stub
Chk
.
version
<
Info
.
remote
.
stub
.
versionCode
)
{
// We also want to upgrade stub
service
.
fetchFile
(
Info
.
remote
.
stub
.
link
).
byteStream
().
use
{
it
.
writeTo
(
apk
)
...
...
app/src/main/java/com/topjohnwu/magisk/ui/MainActivity.kt
View file @
a22a1dd2
...
...
@@ -195,11 +195,8 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
}
private
fun
askForHomeShortcut
()
{
// Don't bother if we are not hidden
if
(
packageName
==
BuildConfig
.
APPLICATION_ID
)
return
if
(!
Config
.
askedHome
&&
ShortcutManagerCompat
.
isRequestPinShortcutSupported
(
this
))
{
if
(
isRunningAsStub
&&
!
Config
.
askedHome
&&
ShortcutManagerCompat
.
isRequestPinShortcutSupported
(
this
))
{
// Ask and show dialog
Config
.
askedHome
=
true
MagiskDialog
(
this
)
...
...
app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsViewModel.kt
View file @
a22a1dd2
...
...
@@ -18,6 +18,7 @@ import com.topjohnwu.magisk.core.Info
import
com.topjohnwu.magisk.core.download.Action
import
com.topjohnwu.magisk.core.download.DownloadService
import
com.topjohnwu.magisk.core.download.Subject
import
com.topjohnwu.magisk.core.isRunningAsStub
import
com.topjohnwu.magisk.core.utils.PatchAPK
import
com.topjohnwu.magisk.data.database.RepoDao
import
com.topjohnwu.magisk.events.AddHomeIconEvent
...
...
@@ -56,7 +57,7 @@ class SettingsViewModel(
// making theming a pain in the ass. Just forget about it
list
.
remove
(
Theme
)
}
if
(
hidden
&&
ShortcutManagerCompat
.
isRequestPinShortcutSupported
(
context
))
if
(
isRunningAsStub
&&
ShortcutManagerCompat
.
isRequestPinShortcutSupported
(
context
))
list
.
add
(
AddShortcut
)
// Manager
...
...
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