2019-05-13 13:39:33 +00:00
|
|
|
package com.topjohnwu.magisk
|
|
|
|
|
|
|
|
import android.os.Process
|
|
|
|
import java.io.File
|
|
|
|
|
|
|
|
object Const {
|
|
|
|
|
|
|
|
// Paths
|
|
|
|
const val MAGISK_PATH = "/sbin/.magisk/img"
|
2019-06-08 07:41:03 +00:00
|
|
|
var MAGISK_DISABLE_FILE = File("xxx")
|
2019-05-13 13:39:33 +00:00
|
|
|
const val TMP_FOLDER_PATH = "/dev/tmp"
|
|
|
|
const val MAGISK_LOG = "/cache/magisk.log"
|
|
|
|
|
|
|
|
// Versions
|
2019-08-08 11:18:32 +00:00
|
|
|
const val SNET_EXT_VER = 13
|
2019-10-08 18:53:04 +00:00
|
|
|
const val SNET_REVISION = "a6c47f86f10b310358afa9dbe837037dd5d561df"
|
|
|
|
const val BOOTCTL_REVISION = "a6c47f86f10b310358afa9dbe837037dd5d561df"
|
2019-05-13 13:39:33 +00:00
|
|
|
|
2019-06-08 07:41:03 +00:00
|
|
|
// Misc
|
|
|
|
const val ANDROID_MANIFEST = "AndroidManifest.xml"
|
|
|
|
const val MAGISK_INSTALL_LOG_FILENAME = "magisk_install_log_%s.log"
|
|
|
|
const val MANAGER_CONFIGS = ".tmp.magisk.config"
|
2019-05-13 13:39:33 +00:00
|
|
|
val USER_ID = Process.myUid() / 100000
|
|
|
|
|
2019-10-22 20:04:20 +00:00
|
|
|
object Version {
|
2019-11-04 08:24:16 +00:00
|
|
|
const val MIN_VERSION = "v18.0"
|
|
|
|
const val MIN_VERCODE = 18000
|
2019-11-03 22:01:09 +00:00
|
|
|
const val CONNECT_MODE = 20100
|
Use ContentProvider call method for communication
Previously, we use either BroadcastReceivers or Activities to receive
messages from our native daemon, but both have their own downsides.
Some OEMs blocks broadcasts if the app is not running in the background,
regardless of who the caller is. Activities on the other hand, despite
working 100% of the time, will steal the focus of the current foreground
app, even though we are just doing some logging and showing a toast.
In addition, since stubs for hiding Magisk Manager is introduced, our
only communication method is left with the broadcast option, as
only broadcasting allows targeting a specific package name, not a
component name (which will be obfuscated in the case of stubs).
To make sure root requests will work on all devices, Magisk had to do
some experiments every boot to test whether broadcast is deliverable or
not. This makes the whole thing even more complicated then ever.
So lets take a look at another kind of component in Android apps:
ContentProviders. It is a vital part of Android's ecosystem, and as far
as I know no OEMs will block requests to ContentProviders (or else
tons of functionality will break catastrophically). Starting at API 11,
the system supports calling a specific method in ContentProviders,
optionally sending extra data along with the method call. This is
perfect for the native daemon to start a communication with Magisk
Manager. Another cool thing is that we no longer need to know the
component name of the reciever, as ContentProviders identify themselves
with an "authority" name, which in Magisk Manager's case is tied to the
package name. We already have a mechanism to keep track of our current
manager package name, so this works out of the box.
So yay! No more flaky broadcast tests, no more stupid OEMs blocking
broadcasts for some bizzare reasons. This method should in theory
work on almost all devices and situations.
2019-11-04 19:32:28 +00:00
|
|
|
const val PROVIDER_CONNECT = 20102
|
2019-05-13 13:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
object ID {
|
|
|
|
const val FETCH_ZIP = 2
|
|
|
|
const val SELECT_BOOT = 3
|
|
|
|
|
|
|
|
// notifications
|
|
|
|
const val MAGISK_UPDATE_NOTIFICATION_ID = 4
|
|
|
|
const val APK_UPDATE_NOTIFICATION_ID = 5
|
|
|
|
const val DTBO_NOTIFICATION_ID = 7
|
|
|
|
const val HIDE_MANAGER_NOTIFICATION_ID = 8
|
|
|
|
const val UPDATE_NOTIFICATION_CHANNEL = "update"
|
|
|
|
const val PROGRESS_NOTIFICATION_CHANNEL = "progress"
|
|
|
|
const val CHECK_MAGISK_UPDATE_WORKER_ID = "magisk_update"
|
|
|
|
}
|
|
|
|
|
|
|
|
object Url {
|
|
|
|
const val ZIP_URL = "https://github.com/Magisk-Modules-Repo/%s/archive/master.zip"
|
|
|
|
const val PAYPAL_URL = "https://www.paypal.me/topjohnwu"
|
|
|
|
const val PATREON_URL = "https://www.patreon.com/topjohnwu"
|
|
|
|
const val TWITTER_URL = "https://twitter.com/topjohnwu"
|
|
|
|
const val XDA_THREAD = "http://forum.xda-developers.com/showthread.php?t=3432382"
|
|
|
|
const val SOURCE_CODE_URL = "https://github.com/topjohnwu/Magisk"
|
2019-07-28 08:54:34 +00:00
|
|
|
|
|
|
|
const val GITHUB_RAW_URL = "https://raw.githubusercontent.com/"
|
|
|
|
const val GITHUB_API_URL = "https://api.github.com/users/Magisk-Modules-Repo/"
|
2019-05-13 13:39:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
object Key {
|
|
|
|
// others
|
|
|
|
const val LINK_KEY = "Link"
|
|
|
|
const val IF_NONE_MATCH = "If-None-Match"
|
2019-07-28 08:54:34 +00:00
|
|
|
const val ETAG_KEY = "ETag"
|
2019-05-13 13:39:33 +00:00
|
|
|
// intents
|
|
|
|
const val OPEN_SECTION = "section"
|
2019-07-29 07:26:18 +00:00
|
|
|
const val INTENT_SET_APP = "app_json"
|
2019-05-13 13:39:33 +00:00
|
|
|
const val FLASH_ACTION = "action"
|
2019-07-10 14:33:01 +00:00
|
|
|
const val FLASH_DATA = "additional_data"
|
2019-07-25 08:05:06 +00:00
|
|
|
const val DISMISS_ID = "dismiss_id"
|
2019-05-13 13:39:33 +00:00
|
|
|
const val BROADCAST_MANAGER_UPDATE = "manager_update"
|
|
|
|
const val BROADCAST_REBOOT = "reboot"
|
|
|
|
}
|
|
|
|
|
|
|
|
object Value {
|
|
|
|
const val FLASH_ZIP = "flash"
|
|
|
|
const val PATCH_FILE = "patch"
|
|
|
|
const val FLASH_MAGISK = "magisk"
|
|
|
|
const val FLASH_INACTIVE_SLOT = "slot"
|
|
|
|
const val UNINSTALL = "uninstall"
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|