pmt: start working on 1.3.0
- Add log cleaner function. - Introduce function flag structure. - Some improvements.
This commit is contained in:
@@ -34,10 +34,17 @@
|
||||
#define PART_MAP (*(*Variables).PartMap)
|
||||
|
||||
namespace PartitionManager {
|
||||
enum basic_function_flags {
|
||||
NO_SU = 1,
|
||||
NO_MAP_CHECK = 2,
|
||||
ADB_SUFFICIENT = 3,
|
||||
};
|
||||
|
||||
// All function classes must inherit from this class.
|
||||
class basic_function {
|
||||
public:
|
||||
CLI::App *cmd = nullptr;
|
||||
std::vector<int> flags = {};
|
||||
|
||||
virtual bool init(CLI::App &_app) = 0;
|
||||
virtual bool run() = 0;
|
||||
@@ -56,6 +63,7 @@ private:
|
||||
public:
|
||||
void registerFunction(std::unique_ptr<basic_function> _func, CLI::App &_app);
|
||||
|
||||
[[nodiscard]] bool hasFlagOnUsedFunction(int flag) const;
|
||||
[[nodiscard]] bool isUsed(const std::string &name) const;
|
||||
[[nodiscard]] bool handleAll() const;
|
||||
};
|
||||
@@ -76,6 +84,7 @@ public:
|
||||
|
||||
using FunctionBase = basic_function;
|
||||
using FunctionManager = basic_function_manager;
|
||||
using FunctionFlags = basic_function_flags;
|
||||
using VariableTable = basic_variables;
|
||||
using Error = Helper::Error;
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, 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 <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Commands */
|
||||
#define ANDROID_RB_RESTART 0xDEAD0001 /* deprecated. Use RESTART2. */
|
||||
#define ANDROID_RB_POWEROFF 0xDEAD0002
|
||||
#define ANDROID_RB_RESTART2 0xDEAD0003
|
||||
#define ANDROID_RB_THERMOFF 0xDEAD0004
|
||||
|
||||
/* Properties */
|
||||
#define ANDROID_RB_PROPERTY "sys.powerctl"
|
||||
|
||||
/* Android reboot reason stored in this property */
|
||||
#define LAST_REBOOT_REASON_PROPERTY "persist.sys.boot.reason"
|
||||
#define LAST_REBOOT_REASON_FILE "/metadata/bootstat/" LAST_REBOOT_REASON_PROPERTY
|
||||
|
||||
/* Reboot or shutdown the system.
|
||||
* This call uses ANDROID_RB_PROPERTY to request reboot to init process.
|
||||
* Due to that, process calling this should have proper selinux permission
|
||||
* to write to the property or the call will fail.
|
||||
*/
|
||||
int android_reboot(unsigned cmd, int flags, const char* arg);
|
||||
|
||||
__END_DECLS
|
||||
Reference in New Issue
Block a user