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

Commit 5454ff72 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5280121 from 8a0222e6 to qt-release

Change-Id: Id972dbbd6300eb778f64b836e07b386789238a50
parents 3ddb6ee5 8a0222e6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -981,6 +981,8 @@ static void AddAnrTraceFiles() {

    AddAnrTraceDir(add_to_zip, anr_traces_dir);

    RunCommand("ANR FILES", {"ls", "-lt", ANR_DIR});

    // Slow traces for slow operations.
    struct stat st;
    int i = 0;
+7 −3
Original line number Diff line number Diff line
@@ -982,9 +982,13 @@ binder::Status InstalldNativeService::restoreAppDataSnapshot(
        auto to_de = create_data_user_de_path(volume_uuid, user);
        int rc = copy_directory_recursive(from_de.c_str(), to_de.c_str());
        if (rc != 0) {
            // TODO(narayan): Should we clear clear the rolled back CE data if
            // something goes wrong here ? We're choosing between leaving the
            // app devoid of all its data or with just its ce data installed.
            if (needs_ce_rollback) {
                auto ce_data = create_data_user_ce_package_path(volume_uuid, user, package_name);
                LOG(WARNING) << "de_data rollback failed. Erasing rolled back ce_data " << ce_data;
                if (delete_dir_contents(ce_data.c_str(), 1, nullptr) != 0) {
                    LOG(WARNING) << "Failed to delete rolled back ce_data " << ce_data;
                }
            }
            res = error(rc, "Failed copying " + from_de + " to " + to_de);
            return res;
        }
+7 −1
Original line number Diff line number Diff line
@@ -314,9 +314,15 @@ class RunDex2Oat : public ExecVHelper {
        bool skip_compilation = vold_decrypt == "trigger_restart_min_framework" ||
                                vold_decrypt == "1";

        const std::string resolve_startup_string_arg =
        std::string resolve_startup_string_arg =
                MapPropertyToArg("persist.device_config.runtime.dex2oat_resolve_startup_strings",
                                 "--resolve-startup-const-strings=%s");
        if (resolve_startup_string_arg.empty()) {
          // If empty, fall back to system property.
          resolve_startup_string_arg =
                MapPropertyToArg("dalvik.vm.dex2oat-resolve-startup-strings",
                                 "--resolve-startup-const-strings=%s");
        }

        const std::string image_block_size_arg =
                MapPropertyToArg("dalvik.vm.dex2oat-max-image-block-size",
+24 −17
Original line number Diff line number Diff line
@@ -58,6 +58,27 @@ static void CloseDescriptor(const char* descriptor_string) {
    }
}

static std::vector<apex::ApexFile> ActivateApexPackages() {
    // The logic here is (partially) copied and adapted from
    // system/apex/apexd/apexd_main.cpp.
    //
    // Only scan the APEX directory under /system (within the chroot dir).
    // Note that this leaves around the loop devices created and used by
    // libapexd's code, but this is fine, as we expect to reboot soon after.
    apex::scanPackagesDirAndActivate(apex::kApexPackageSystemDir);
    return apex::getActivePackages();
}

static void DeactivateApexPackages(const std::vector<apex::ApexFile>& active_packages) {
    for (const apex::ApexFile& apex_file : active_packages) {
        const std::string& package_path = apex_file.GetPath();
        apex::Status status = apex::deactivatePackage(package_path);
        if (!status.Ok()) {
            LOG(ERROR) << "Failed to deactivate " << package_path << ": " << status.ErrorMessage();
        }
    }
}

// Entry for otapreopt_chroot. Expected parameters are:
//   [cmd] [status-fd] [target-slot] "dexopt" [dexopt-params]
// The file descriptor denoted by status-fd will be closed. The rest of the parameters will
@@ -199,15 +220,7 @@ static int otapreopt_chroot(const int argc, char **arg) {

    // Try to mount APEX packages in "/apex" in the chroot dir. We need at least
    // the Android Runtime APEX, as it is required by otapreopt to run dex2oat.
    // The logic here is (partially) copied and adapted from
    // system/apex/apexd/apexd_main.cpp.
    //
    // Only scan the APEX directory under /system (within the chroot dir).
    // Note that this leaves around the loop devices created and used by
    // libapexd's code, but this is fine, as we expect to reboot soon after.
    apex::scanPackagesDirAndActivate(apex::kApexPackageSystemDir);
    // Collect activated packages.
    std::vector<apex::ApexFile> active_packages = apex::getActivePackages();
    std::vector<apex::ApexFile> active_packages = ActivateApexPackages();

    // Now go on and run otapreopt.

@@ -229,14 +242,8 @@ static int otapreopt_chroot(const int argc, char **arg) {
        LOG(ERROR) << "Running otapreopt failed: " << error_msg;
    }

    // Tear down the work down by the apexd logic above (i.e. deactivate packages).
    for (const apex::ApexFile& apex_file : active_packages) {
        const std::string& package_path = apex_file.GetPath();
        apex::Status status = apex::deactivatePackage(package_path);
        if (!status.Ok()) {
            LOG(ERROR) << "Failed to deactivate " << package_path << ": " << status.ErrorMessage();
        }
    }
    // Tear down the work down by the apexd logic. (i.e. deactivate packages).
    DeactivateApexPackages(active_packages);

    if (!exec_result) {
        exit(213);
+46 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 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 <binder/Status.h>
#include <gtest/gtest.h>
#include <utils/String8.h>

#define ASSERT_BINDER_SUCCESS(expr)                                              \
    ({                                                                           \
        binder::Status expect_status = (expr);                                   \
        ASSERT_TRUE(expect_status.isOk()) << expect_status.toString8().c_str();  \
        expect_status;                                                           \
    })
#define ASSERT_BINDER_FAIL(expr)                \
    ({                                          \
        binder::Status expect_status = (expr);  \
        ASSERT_FALSE(expect_status.isOk());     \
        expect_status;                          \
    })
#define EXPECT_BINDER_SUCCESS(expr)                                              \
    ({                                                                           \
        binder::Status expect_status = (expr);                                   \
        EXPECT_TRUE(expect_status.isOk()) << expect_status.toString8().c_str();  \
        expect_status;                                                           \
    })
#define EXPECT_BINDER_FAIL(expr)                \
    ({                                          \
        binder::Status expect_status = (expr);  \
        EXPECT_FALSE(expect_status.isOk());     \
        expect_status;                          \
    })
Loading