mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
Rename db entry name
This commit is contained in:
parent
dd3b9980e7
commit
6c27ba6b88
@ -40,7 +40,7 @@ object Config : PreferenceConfig, DBConfig {
|
||||
const val SU_MNT_NS = "mnt_ns"
|
||||
const val SU_BIOMETRIC = "su_biometric"
|
||||
const val ZYGISK = "zygisk"
|
||||
const val SAFEMODE = "safemode"
|
||||
const val BOOTLOOP = "bootloop"
|
||||
const val DENYLIST = "denylist"
|
||||
const val SU_MANAGER = "requester"
|
||||
const val KEYSTORE = "keystore"
|
||||
@ -167,7 +167,7 @@ object Config : PreferenceConfig, DBConfig {
|
||||
suBiometric = value
|
||||
}
|
||||
var zygisk by dbSettings(Key.ZYGISK, false)
|
||||
var safemode by dbSettings(Key.SAFEMODE, 0)
|
||||
var bootloop by dbSettings(Key.BOOTLOOP, 0)
|
||||
var denyList by BoolDBPropertyNoWrite(Key.DENYLIST, false)
|
||||
var suManager by dbStrings(Key.SU_MANAGER, "", true)
|
||||
var keyStoreRaw by dbStrings(Key.KEYSTORE, "", true)
|
||||
|
@ -25,7 +25,7 @@ object RebootMenu {
|
||||
R.id.action_reboot_safe_mode -> {
|
||||
val status = !item.isChecked
|
||||
item.isChecked = status
|
||||
Config.safemode = if (status) 2 else 0
|
||||
Config.bootloop = if (status) 2 else 0
|
||||
}
|
||||
else -> Unit
|
||||
}
|
||||
@ -42,7 +42,7 @@ object RebootMenu {
|
||||
menu.menu.findItem(R.id.action_reboot_userspace).isVisible = true
|
||||
}
|
||||
if (Const.APP_IS_CANARY) {
|
||||
menu.menu.findItem(R.id.action_reboot_safe_mode).isChecked = Config.safemode >= 2
|
||||
menu.menu.findItem(R.id.action_reboot_safe_mode).isChecked = Config.bootloop >= 2
|
||||
} else {
|
||||
menu.menu.findItem(R.id.action_reboot_safe_mode).isVisible = false
|
||||
}
|
||||
|
@ -122,14 +122,13 @@ static bool check_key_combo() {
|
||||
}
|
||||
|
||||
static bool check_safe_mode() {
|
||||
int safe_mode;
|
||||
int bootloop_cnt;
|
||||
db_settings dbs;
|
||||
get_db_settings(dbs, SAFEMODE_CONFIG);
|
||||
safe_mode = dbs[SAFEMODE_CONFIG];
|
||||
|
||||
set_db_settings(SAFEMODE_CONFIG, safe_mode + 1);
|
||||
|
||||
return safe_mode >= 2 || get_prop("persist.sys.safemode", true) == "1" ||
|
||||
get_db_settings(dbs, BOOTLOOP_COUNT);
|
||||
bootloop_cnt = dbs[BOOTLOOP_COUNT];
|
||||
// Increment the bootloop counter
|
||||
set_db_settings(BOOTLOOP_COUNT, bootloop_cnt + 1);
|
||||
return bootloop_cnt >= 2 || get_prop("persist.sys.safemode", true) == "1" ||
|
||||
get_prop("ro.sys.safemode") == "1" || check_key_combo();
|
||||
}
|
||||
|
||||
@ -197,7 +196,8 @@ void MagiskD::boot_complete() const {
|
||||
|
||||
LOGI("** boot-complete triggered\n");
|
||||
|
||||
set_db_settings(SAFEMODE_CONFIG, 0);
|
||||
// Reset the bootloop counter once we have boot-complete
|
||||
set_db_settings(BOOTLOOP_COUNT, 0);
|
||||
|
||||
// At this point it's safe to create the folder
|
||||
if (access(SECURE_DIR, F_OK) != 0)
|
||||
|
@ -117,7 +117,7 @@ db_settings::db_settings() {
|
||||
data[SU_MNT_NS] = NAMESPACE_MODE_REQUESTER;
|
||||
data[DENYLIST_CONFIG] = false;
|
||||
data[ZYGISK_CONFIG] = MagiskD::get()->is_emulator();
|
||||
data[SAFEMODE_CONFIG] = false;
|
||||
data[BOOTLOOP_COUNT] = 0;
|
||||
}
|
||||
|
||||
int db_settings::get_idx(string_view key) const {
|
||||
|
@ -40,7 +40,7 @@ constexpr const char *DB_SETTING_KEYS[] = {
|
||||
"mnt_ns",
|
||||
"denylist",
|
||||
"zygisk",
|
||||
"safemode",
|
||||
"bootloop",
|
||||
};
|
||||
|
||||
// Settings key indices
|
||||
@ -50,7 +50,7 @@ enum {
|
||||
SU_MNT_NS,
|
||||
DENYLIST_CONFIG,
|
||||
ZYGISK_CONFIG,
|
||||
SAFEMODE_CONFIG,
|
||||
BOOTLOOP_COUNT,
|
||||
};
|
||||
|
||||
// Values for root_access
|
||||
|
Loading…
x
Reference in New Issue
Block a user