Skip to content

Commit b1d93a8

Browse files
Tom CherryGerrit Code Review
Tom Cherry
authored and
Gerrit Code Review
committed
Merge "init: do not load persistent properties from temporary /data"
2 parents 332370d + 9951b79 commit b1d93a8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

init/property_service.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,17 @@ static void load_override_properties() {
690690
* has mounted /data.
691691
*/
692692
void load_persist_props(void) {
693+
// Devices with FDE have load_persist_props called twice; the first time when the temporary
694+
// /data partition is mounted and then again once /data is truly mounted. We do not want to
695+
// read persistent properties from the temporary /data partition or mark persistent properties
696+
// as having been loaded during the first call, so we return in that case.
697+
std::string crypto_state = android::base::GetProperty("ro.crypto.state", "");
698+
std::string crypto_type = android::base::GetProperty("ro.crypto.type", "");
699+
if (crypto_state == "encrypted" && crypto_type == "block") {
700+
static size_t num_calls = 0;
701+
if (++num_calls == 1) return;
702+
}
703+
693704
load_override_properties();
694705
/* Read persistent properties after all default values have been loaded. */
695706
load_persistent_properties();

0 commit comments

Comments
 (0)