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

Commit 6031414c authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5582435 from 5c1b6041 to qt-qpr1-release

Change-Id: I685cef01984848104890618a0530370d87bd7fca
parents bcdc4094 5c1b6041
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ struct TransferId {

struct IoBlock {
    bool pending = false;
    struct iocb control;
    struct iocb control = {};
    std::shared_ptr<Block> payload;

    TransferId id() const { return TransferId::from_value(control.aio_data); }
+18 −5
Original line number Diff line number Diff line
@@ -244,16 +244,29 @@ TEST_F(LogicalPartitionCompliance, FastbootRebootTest) {
// Testing creation/resize/delete of logical partitions
TEST_F(LogicalPartitionCompliance, CreateResizeDeleteLP) {
    ASSERT_TRUE(UserSpaceFastboot());
    std::string test_partition_name = "test_partition";
    std::string slot_count;
    // Add suffix to test_partition_name if device is slotted.
    EXPECT_EQ(fb->GetVar("slot-count", &slot_count), SUCCESS) << "getvar slot-count failed";
    int32_t num_slots = strtol(slot_count.c_str(), nullptr, 10);
    if (num_slots > 0) {
        std::string current_slot;
        EXPECT_EQ(fb->GetVar("current-slot", &current_slot), SUCCESS)
                << "getvar current-slot failed";
        std::string slot_suffix = "_" + current_slot;
        test_partition_name += slot_suffix;
    }

    GTEST_LOG_(INFO) << "Testing 'fastboot create-logical-partition' command";
    EXPECT_EQ(fb->CreatePartition("test_partition_a", "0"), SUCCESS)
    EXPECT_EQ(fb->CreatePartition(test_partition_name, "0"), SUCCESS)
            << "create-logical-partition failed";
    GTEST_LOG_(INFO) << "Testing 'fastboot resize-logical-partition' command";
    EXPECT_EQ(fb->ResizePartition("test_partition_a", "4096"), SUCCESS)
    EXPECT_EQ(fb->ResizePartition(test_partition_name, "4096"), SUCCESS)
            << "resize-logical-partition failed";
    std::vector<char> buf(4096);

    GTEST_LOG_(INFO) << "Flashing a logical partition..";
    EXPECT_EQ(fb->FlashPartition("test_partition_a", buf), SUCCESS)
    EXPECT_EQ(fb->FlashPartition(test_partition_name, buf), SUCCESS)
            << "flash logical -partition failed";
    GTEST_LOG_(INFO) << "Rebooting to bootloader mode";
    // Reboot to bootloader mode and attempt to flash the logical partitions
@@ -262,7 +275,7 @@ TEST_F(LogicalPartitionCompliance, CreateResizeDeleteLP) {
    ReconnectFastbootDevice();
    ASSERT_FALSE(UserSpaceFastboot());
    GTEST_LOG_(INFO) << "Attempt to flash a logical partition..";
    EXPECT_EQ(fb->FlashPartition("test_partition", buf), DEVICE_FAIL)
    EXPECT_EQ(fb->FlashPartition(test_partition_name, buf), DEVICE_FAIL)
            << "flash logical partition must fail in bootloader";
    GTEST_LOG_(INFO) << "Rebooting back to fastbootd mode";
    fb->RebootTo("fastboot");
@@ -270,7 +283,7 @@ TEST_F(LogicalPartitionCompliance, CreateResizeDeleteLP) {
    ReconnectFastbootDevice();
    ASSERT_TRUE(UserSpaceFastboot());
    GTEST_LOG_(INFO) << "Testing 'fastboot delete-logical-partition' command";
    EXPECT_EQ(fb->DeletePartition("test_partition_a"), SUCCESS)
    EXPECT_EQ(fb->DeletePartition(test_partition_name), SUCCESS)
            << "delete logical-partition failed";
}

+2 −1
Original line number Diff line number Diff line
@@ -414,7 +414,8 @@ Commands

`class_start_post_data <serviceclass>`
> Like `class_start`, but only considers services that were started
  after /data was mounted. Only used for FDE devices.
  after /data was mounted, and that were running at the time
 `class_reset_post_data` was called. Only used for FDE devices.

`class_stop <serviceclass>`
> Stop and disable all services of the specified class if they are
+13 −12
Original line number Diff line number Diff line
@@ -104,35 +104,36 @@ static void ForEachServiceInClass(const std::string& classname, F function) {
    }
}

static Result<Success> class_start(const std::string& class_name, bool post_data_only) {
static Result<Success> do_class_start(const BuiltinArguments& args) {
    // Do not start a class if it has a property persist.dont_start_class.CLASS set to 1.
    if (android::base::GetBoolProperty("persist.init.dont_start_class." + class_name, false))
    if (android::base::GetBoolProperty("persist.init.dont_start_class." + args[1], false))
        return Success();
    // Starting a class does not start services which are explicitly disabled.
    // They must  be started individually.
    for (const auto& service : ServiceList::GetInstance()) {
        if (service->classnames().count(class_name)) {
            if (post_data_only && !service->is_post_data()) {
                continue;
            }
        if (service->classnames().count(args[1])) {
            if (auto result = service->StartIfNotDisabled(); !result) {
                LOG(ERROR) << "Could not start service '" << service->name()
                           << "' as part of class '" << class_name << "': " << result.error();
                           << "' as part of class '" << args[1] << "': " << result.error();
            }
        }
    }
    return Success();
}

static Result<Success> do_class_start(const BuiltinArguments& args) {
    return class_start(args[1], false /* post_data_only */);
}

static Result<Success> do_class_start_post_data(const BuiltinArguments& args) {
    if (args.context != kInitContext) {
        return Error() << "command 'class_start_post_data' only available in init context";
    }
    return class_start(args[1], true /* post_data_only */);
    for (const auto& service : ServiceList::GetInstance()) {
        if (service->classnames().count(args[1])) {
            if (auto result = service->StartIfPostData(); !result) {
                LOG(ERROR) << "Could not start service '" << service->name()
                           << "' as part of class '" << args[1] << "': " << result.error();
            }
        }
    }
    return Success();
}

static Result<Success> do_class_stop(const BuiltinArguments& args) {
+13 −0
Original line number Diff line number Diff line
@@ -1154,10 +1154,23 @@ void Service::Reset() {

void Service::ResetIfPostData() {
    if (post_data_) {
        if (flags_ & SVC_RUNNING) {
            running_at_post_data_reset_ = true;
        }
        StopOrReset(SVC_RESET);
    }
}

Result<Success> Service::StartIfPostData() {
    // Start the service, but only if it was started after /data was mounted,
    // and it was still running when we reset the post-data services.
    if (running_at_post_data_reset_) {
        return Start();
    }

    return Success();
}

void Service::Stop() {
    StopOrReset(SVC_DISABLED);
}
Loading