summaryrefslogtreecommitdiffstats
path: root/otautil/include
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-09-06 20:58:55 +0200
committerTianjie Xu <xunchang@google.com>2018-09-13 22:27:55 +0200
commit2b1a464a7045134b0980def4ea906b98ab3616f1 (patch)
tree9a58a8c7a23b44d3ca3d2e52c12041088d777d6d /otautil/include
parentMerge "Fix sideload for user devices by adding a new sideload config" (diff)
downloadandroid_bootable_recovery-2b1a464a7045134b0980def4ea906b98ab3616f1.tar
android_bootable_recovery-2b1a464a7045134b0980def4ea906b98ab3616f1.tar.gz
android_bootable_recovery-2b1a464a7045134b0980def4ea906b98ab3616f1.tar.bz2
android_bootable_recovery-2b1a464a7045134b0980def4ea906b98ab3616f1.tar.lz
android_bootable_recovery-2b1a464a7045134b0980def4ea906b98ab3616f1.tar.xz
android_bootable_recovery-2b1a464a7045134b0980def4ea906b98ab3616f1.tar.zst
android_bootable_recovery-2b1a464a7045134b0980def4ea906b98ab3616f1.zip
Diffstat (limited to 'otautil/include')
-rw-r--r--otautil/include/otautil/parse_install_logs.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/otautil/include/otautil/parse_install_logs.h b/otautil/include/otautil/parse_install_logs.h
new file mode 100644
index 000000000..135d29ccf
--- /dev/null
+++ b/otautil/include/otautil/parse_install_logs.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <stdint.h>
+
+#include <map>
+#include <string>
+#include <vector>
+
+constexpr const char* LAST_INSTALL_FILE = "/data/misc/recovery/last_install";
+constexpr const char* LAST_INSTALL_FILE_IN_CACHE = "/cache/recovery/last_install";
+
+// Parses the metrics of update applied under recovery mode in |lines|, and returns a map with
+// "name: value".
+std::map<std::string, int64_t> ParseRecoveryUpdateMetrics(const std::vector<std::string>& lines);
+// Parses the sideload history and update metrics in the last_install file. Returns a map with
+// entries as "metrics_name: value". If no such file exists, returns an empty map.
+std::map<std::string, int64_t> ParseLastInstall(const std::string& file_name);