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

Commit e7759215 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "[MTE] Reset MTE state for userdata wipe in fastbootd" am: d07f1116...

Merge "[MTE] Reset MTE state for userdata wipe in fastbootd" am: d07f1116 am: f6bc9f0c am: 055cddda

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2217197



Change-Id: I2eaededde4905da1d3f22ee621bd7add9eddae04
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 9bcc7697 055cddda
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@
#include <storage_literals/storage_literals.h>
#include <uuid/uuid.h>

#include <bootloader_message/bootloader_message.h>

#include "BootControlClient.h"
#include "constants.h"
#include "fastboot_device.h"
@@ -154,6 +156,14 @@ static bool GetVarAll(FastbootDevice* device) {
    return true;
}

static void PostWipeData() {
    std::string err;
    // Reset mte state of device.
    if (!WriteMiscMemtagMessage({}, &err)) {
        LOG(ERROR) << "Failed to reset MTE state: " << err;
    }
}

const std::unordered_map<std::string, std::function<bool(FastbootDevice*)>> kSpecialVars = {
        {"all", GetVarAll},
        {"dmesg", GetDmesg},
@@ -232,6 +242,7 @@ bool EraseHandler(FastbootDevice* device, const std::vector<std::string>& args)
        //Perform oem PostWipeData if Android userdata partition has been erased
        bool support_oem_postwipedata = false;
        if (partition_name == "userdata") {
            PostWipeData();
            support_oem_postwipedata = OemPostWipeData(device);
        }

@@ -610,6 +621,10 @@ bool FlashHandler(FastbootDevice* device, const std::vector<std::string>& args)
    if (ret < 0) {
        return device->WriteStatus(FastbootResult::FAIL, strerror(-ret));
    }
    if (partition_name == "userdata") {
        PostWipeData();
    }

    return device->WriteStatus(FastbootResult::OKAY, "Flashing succeeded");
}