From fe16b5ccaf80f6e04d5b722c37c1abd70457ad28 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Fri, 9 Sep 2016 10:55:44 -0700 Subject: save uncrypt status to last_install Save the uncrypt time cost to /cache/recovery/uncrypt_status. Recovery reads the file and saves its contents to last_install. Bug: 31383361 Test: Tested on angler and uncrypt_time reports correctly. Change-Id: I5cd3f7b6ca069d69086d09acfea8fc4f1215c833 Merged-In: I5cd3f7b6ca069d69086d09acfea8fc4f1215c833 --- install.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'install.cpp') diff --git a/install.cpp b/install.cpp index 92a62db5f..fac6151b3 100644 --- a/install.cpp +++ b/install.cpp @@ -27,10 +27,11 @@ #include #include +#include +#include #include #include #include -#include #include "common.h" #include "error_code.h" @@ -47,6 +48,7 @@ extern RecoveryUI* ui; #define ASSUMED_UPDATE_BINARY_NAME "META-INF/com/google/android/update-binary" #define PUBLIC_KEYS_FILE "/res/keys" static constexpr const char* METADATA_PATH = "META-INF/com/android/metadata"; +static constexpr const char* UNCRYPT_STATUS = "/cache/recovery/uncrypt_status"; // Default allocation of progress bar segments to operations static const int VERIFICATION_PROGRESS_TIME = 60; @@ -384,6 +386,16 @@ install_package(const char* path, bool* wipe_cache, const char* install_file, fprintf(install_log, "%s\n", s.c_str()); } + if (ensure_path_mounted(UNCRYPT_STATUS) != 0) { + LOG(WARNING) << "Can't mount " << UNCRYPT_STATUS; + } else { + std::string uncrypt_status; + if (!android::base::ReadFileToString(UNCRYPT_STATUS, &uncrypt_status)) { + PLOG(WARNING) << "failed to read uncrypt status"; + } else { + fprintf(install_log, "%s\n", android::base::Trim(uncrypt_status).c_str()); + } + } fclose(install_log); } return result; -- cgit v1.2.3