mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-17 21:47:37 +00:00
Only offer shortcuts when running as stub
This commit is contained in:
parent
27c59dbb65
commit
a22a1dd284
@ -136,7 +136,7 @@ private class JobSchedulerWrapper(private val base: JobScheduler) : JobScheduler
|
|||||||
val name = service.className
|
val name = service.className
|
||||||
val component = ComponentName(
|
val component = ComponentName(
|
||||||
service.packageName,
|
service.packageName,
|
||||||
Info.stub!!.classToComponent[name] ?: name
|
Info.stubChk.classToComponent[name] ?: name
|
||||||
)
|
)
|
||||||
|
|
||||||
javaClass.forceGetDeclaredField("service")?.set(this, component)
|
javaClass.forceGetDeclaredField("service")?.set(this, component)
|
||||||
|
@ -18,9 +18,13 @@ object Info {
|
|||||||
|
|
||||||
val envRef = CachedValue { loadState() }
|
val envRef = CachedValue { loadState() }
|
||||||
|
|
||||||
@JvmStatic val env by envRef // Local
|
@JvmStatic val env by envRef
|
||||||
@JvmStatic var stub: DynAPK.Data? = null // Stub
|
|
||||||
var remote = UpdateInfo() // Remote
|
var stub: DynAPK.Data? = null
|
||||||
|
val stubChk: DynAPK.Data
|
||||||
|
get() = stub as DynAPK.Data
|
||||||
|
|
||||||
|
var remote = UpdateInfo()
|
||||||
|
|
||||||
// Toggle-able options
|
// Toggle-able options
|
||||||
@JvmStatic var keepVerity = false
|
@JvmStatic var keepVerity = false
|
||||||
|
@ -38,7 +38,7 @@ private suspend fun DownloadService.upgrade(apk: File, id: Int) {
|
|||||||
// Move to upgrade location
|
// Move to upgrade location
|
||||||
apk.copyTo(DynAPK.update(this), overwrite = true)
|
apk.copyTo(DynAPK.update(this), overwrite = true)
|
||||||
apk.delete()
|
apk.delete()
|
||||||
if (Info.stub!!.version < Info.remote.stub.versionCode) {
|
if (Info.stubChk.version < Info.remote.stub.versionCode) {
|
||||||
// We also want to upgrade stub
|
// We also want to upgrade stub
|
||||||
service.fetchFile(Info.remote.stub.link).byteStream().use {
|
service.fetchFile(Info.remote.stub.link).byteStream().use {
|
||||||
it.writeTo(apk)
|
it.writeTo(apk)
|
||||||
|
@ -195,11 +195,8 @@ open class MainActivity : BaseUIActivity<MainViewModel, ActivityMainMd2Binding>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun askForHomeShortcut() {
|
private fun askForHomeShortcut() {
|
||||||
// Don't bother if we are not hidden
|
if (isRunningAsStub && !Config.askedHome &&
|
||||||
if (packageName == BuildConfig.APPLICATION_ID)
|
ShortcutManagerCompat.isRequestPinShortcutSupported(this)) {
|
||||||
return
|
|
||||||
|
|
||||||
if (!Config.askedHome && ShortcutManagerCompat.isRequestPinShortcutSupported(this)) {
|
|
||||||
// Ask and show dialog
|
// Ask and show dialog
|
||||||
Config.askedHome = true
|
Config.askedHome = true
|
||||||
MagiskDialog(this)
|
MagiskDialog(this)
|
||||||
|
@ -18,6 +18,7 @@ import com.topjohnwu.magisk.core.Info
|
|||||||
import com.topjohnwu.magisk.core.download.Action
|
import com.topjohnwu.magisk.core.download.Action
|
||||||
import com.topjohnwu.magisk.core.download.DownloadService
|
import com.topjohnwu.magisk.core.download.DownloadService
|
||||||
import com.topjohnwu.magisk.core.download.Subject
|
import com.topjohnwu.magisk.core.download.Subject
|
||||||
|
import com.topjohnwu.magisk.core.isRunningAsStub
|
||||||
import com.topjohnwu.magisk.core.utils.PatchAPK
|
import com.topjohnwu.magisk.core.utils.PatchAPK
|
||||||
import com.topjohnwu.magisk.data.database.RepoDao
|
import com.topjohnwu.magisk.data.database.RepoDao
|
||||||
import com.topjohnwu.magisk.events.AddHomeIconEvent
|
import com.topjohnwu.magisk.events.AddHomeIconEvent
|
||||||
@ -56,7 +57,7 @@ class SettingsViewModel(
|
|||||||
// making theming a pain in the ass. Just forget about it
|
// making theming a pain in the ass. Just forget about it
|
||||||
list.remove(Theme)
|
list.remove(Theme)
|
||||||
}
|
}
|
||||||
if (hidden && ShortcutManagerCompat.isRequestPinShortcutSupported(context))
|
if (isRunningAsStub && ShortcutManagerCompat.isRequestPinShortcutSupported(context))
|
||||||
list.add(AddShortcut)
|
list.add(AddShortcut)
|
||||||
|
|
||||||
// Manager
|
// Manager
|
||||||
|
Loading…
x
Reference in New Issue
Block a user