platform_system_core/fastboot/task.h
Daniel Zheng 0d30718d9c Added support for flash task
Added Flash Task

Test: tested on raven
Change-Id: I4a6c22f795440afeba18497745dddf8d5c570f65
Bug: 194686221

changed flash {partition_name} to work with tasks

Test: tested flash {partition_name} on raven
Change-Id: I1fa45b949ad8e5017026dd542dfe1389279a9e64
Bug: 194686221
2023-02-13 23:27:41 +00:00

48 lines
1.4 KiB
C++

//
// Copyright (C) 2020 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 <sstream>
#include <string>
#include "fastboot.h"
#include "fastboot_driver.h"
#include "util.h"
class Task {
public:
Task() = default;
virtual void Run() = 0;
virtual ~Task() = default;
};
class FlashTask : public Task {
public:
FlashTask(const std::string& _slot);
FlashTask(const std::string& _slot, bool _force_flash);
FlashTask(const std::string& _slot, bool _force_flash, const std::string& _pname);
FlashTask(const std::string& _slot, bool _force_flash, const std::string& _pname,
const std::string& _fname);
void Run() override;
~FlashTask() {}
private:
const std::string pname_;
const std::string fname_;
const std::string slot_;
bool force_flash_ = false;
};