// Test tends to be flaky if proceeding immediately ("Transport endpoint is not connected").
sleep(1);
sockaddr_un un = {};
un.sun_family = AF_UNIX;
strlcpy(un.sun_path, UNCRYPT_SOCKET.c_str(), sizeof(un.sun_path));
int sockfd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
ASSERT_NE(-1, sockfd);
// Connect to the uncrypt socket. bool success = false; for (int retry = 0; retry < SOCKET_CONNECTION_MAX_RETRY; retry++) { if (connect(sockfd, reinterpret_cast<sockaddr*>(&un), sizeof(sockaddr_un)) == 0) {
success = true; break;
}
sleep(1);
}
ASSERT_TRUE(success);
if (isSetup) { // Send out the BCB message. int length = static_cast<int>(message.size()); int length_out = htonl(length);
ASSERT_TRUE(android::base::WriteFully(sockfd, &length_out, sizeof(int)))
<< "Failed to write length: " << strerror(errno);
ASSERT_TRUE(android::base::WriteFully(sockfd, message.data(), length))
<< "Failed to write message: " << strerror(errno);
}
// Check the status code from uncrypt. int status;
ASSERT_TRUE(android::base::ReadFully(sockfd, &status, sizeof(int)));
ASSERT_EQ(100U, ntohl(status));
// Ack having received the status code. int code = 0;
ASSERT_TRUE(android::base::WriteFully(sockfd, &code, sizeof(int)));
// Verify the message by reading from BCB directly.
bootloader_message boot;
std::string err;
ASSERT_TRUE(read_bootloader_message(&boot, &err)) << "Failed to read BCB: " << err;
if (isSetup) {
ASSERT_EQ("boot-recovery", std::string(boot.command));
ASSERT_EQ(message_in_bcb, std::string(boot.recovery));
// The rest of the boot.recovery message should be zero'd out.
ASSERT_LE(message_in_bcb.size(), sizeof(boot.recovery));
size_t left = sizeof(boot.recovery) - message_in_bcb.size();
ASSERT_EQ(std::string(left, '\0'), std::string(&boot.recovery[message_in_bcb.size()], left));
// Clear the BCB.
ASSERT_TRUE(clear_bootloader_message(&err)) << "Failed to clear BCB: " << err;
} else { // All the bytes should be cleared.
ASSERT_EQ(std::string(sizeof(boot), '\0'),
std::string(reinterpret_cast<constchar*>(&boot), sizeof(boot)));
}
}
// It's expected to store a wipe package in /misc, with the package size passed to recovery.
message = "--wipe_ab\n--wipe_package="s + wipe_package.path + "\n--reason=wipePackage"s;
message_in_bcb = "recovery\n--wipe_ab\n--wipe_package_size=345\n--reason=wipePackage\n";
SetupOrClearBcb(true, message, message_in_bcb);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-07-01)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.