Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6c8c7c19 authored by Tianjie Xu's avatar Tianjie Xu Committed by Gerrit Code Review
Browse files

Merge "Move the parse of last_install to recovery-persist"

parents 9c675b09 2b1a464a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -256,6 +256,7 @@ cc_binary {
    shared_libs: [
        "libbase",
        "liblog",
        "libmetricslogger",
    ],

    static_libs: [
+6 −3
Original line number Diff line number Diff line
@@ -71,10 +71,13 @@ LOCAL_REQUIRED_MODULES += \
endif
endif

# On A/B devices recovery-persist reads the recovery related file from the persist storage and
# copies them into /data/misc/recovery. Then, for both A/B and non-A/B devices, recovery-persist
# parses the last_install file and reports the embedded update metrics. Also, the last_install file
# will be deteleted after the report.
LOCAL_REQUIRED_MODULES += recovery-persist
ifeq ($(BOARD_CACHEIMAGE_PARTITION_SIZE),)
LOCAL_REQUIRED_MODULES += \
    recovery-persist \
    recovery-refresh
LOCAL_REQUIRED_MODULES += recovery-refresh
endif

include $(BUILD_PHONY_PACKAGE)
+1 −0
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ void copy_logs(bool modified_flash, bool has_cache) {
  chown(LAST_KMSG_FILE, AID_SYSTEM, AID_SYSTEM);
  chmod(LAST_LOG_FILE, 0640);
  chmod(LAST_INSTALL_FILE, 0644);
  chown(LAST_INSTALL_FILE, AID_SYSTEM, AID_SYSTEM);
  sync();
}

+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ cc_library_static {
            srcs: [
                "dirutil.cpp",
                "mounts.cpp",
                "parse_install_logs.cpp",
                "sysutil.cpp",
                "thermalutil.cpp",
            ],
+33 −0
Original line number Diff line number Diff line
/*
 * 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);
Loading