Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

Commit

Permalink
Minor code changes
Browse files Browse the repository at this point in the history
  • Loading branch information
topjohnwu committed May 18, 2020
1 parent f7d3d1e commit b27b9c1
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions native/jni/core/bootstages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,28 +146,27 @@ void reboot() {

static bool check_data() {
bool mnt = false;
bool data = false;
file_readline("/proc/mounts", [&](string_view s) -> bool {
if (str_contains(s, " /data ") && !str_contains(s, "tmpfs"))
file_readline("/proc/mounts", [&](string_view s) {
if (str_contains(s, " /data ") && !str_contains(s, "tmpfs")) {
mnt = true;
return false;
}
return true;
});
if (mnt) {
auto crypto = getprop("ro.crypto.state");
if (!crypto.empty()) {
if (crypto == "unencrypted") {
// Unencrypted, we can directly access data
data = true;
} else {
// Encrypted, check whether vold is started
data = !getprop("init.svc.vold").empty();
}
if (!mnt)
return false;
auto crypto = getprop("ro.crypto.state");
if (!crypto.empty()) {
if (crypto == "unencrypted") {
// Unencrypted, we can directly access data
return true;
} else {
// ro.crypto.state is not set, assume it's unencrypted
data = true;
// Encrypted, check whether vold is started
return !getprop("init.svc.vold").empty();
}
}
return data;
// ro.crypto.state is not set, assume it's unencrypted
return true;
}

void unlock_blocks() {
Expand Down

0 comments on commit b27b9c1

Please sign in to comment.