mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-12-02 17:51:51 +00:00
Rename db entry name
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user