mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-23 07:10:19 +00:00
Add dfx for aa tool
Signed-off-by: wangzhen <wangzhen346@huawei.com> Change-Id: Ie759a5b3cb88b0de0ccd9c063a19cdfa3ccf71f5
This commit is contained in:
parent
7da3fb4c9f
commit
95a9ff3311
@ -100,6 +100,7 @@ ohos_executable("aa") {
|
||||
"ability_base:base",
|
||||
"ability_base:configuration",
|
||||
"ability_base:session_info",
|
||||
"hicollie:libhicollie",
|
||||
"hilog:libhilog",
|
||||
"ipc:ipc_core",
|
||||
]
|
||||
|
@ -19,12 +19,45 @@
|
||||
#include "ability_command.h"
|
||||
#include "ability_tool_command.h"
|
||||
#include "hilog_wrapper.h"
|
||||
#include "xcollie/xcollie.h"
|
||||
#include "xcollie/xcollie_define.h"
|
||||
#ifdef A11Y_ENABLE
|
||||
#include "accessibility_ability_command.h"
|
||||
#endif // A11Y_ENABLE
|
||||
|
||||
using namespace OHOS;
|
||||
constexpr uint32_t COMMAND_TIME_OUT = 60;
|
||||
|
||||
class CommandTimer {
|
||||
public:
|
||||
CommandTimer(const std::string &timerName, uint32_t timeout, const std::string &operation)
|
||||
{
|
||||
if (operation != "test") {
|
||||
setTimer_ = true;
|
||||
timerId_ = HiviewDFX::XCollie::GetInstance().SetTimer("ability::aa_command", timeout,
|
||||
nullptr, nullptr, HiviewDFX::XCOLLIE_FLAG_LOG | HiviewDFX::XCOLLIE_FLAG_RECOVERY);
|
||||
}
|
||||
}
|
||||
~CommandTimer()
|
||||
{
|
||||
if (setTimer_) {
|
||||
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId_);
|
||||
}
|
||||
}
|
||||
private:
|
||||
bool setTimer_ = false;
|
||||
int32_t timerId_ = 0;
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
std::string operation;
|
||||
if (argc > 1) {
|
||||
operation = argv[1];
|
||||
}
|
||||
|
||||
if (strstr(argv[0], "aa") != nullptr) {
|
||||
CommandTimer commandTimer("ability::aa_command", COMMAND_TIME_OUT, operation);
|
||||
OHOS::AAFwk::AbilityManagerShellCommand cmd(argc, argv);
|
||||
std::cout << cmd.ExecCommand();
|
||||
} else if (strstr(argv[0], "ability_tool") != nullptr) {
|
||||
|
Loading…
Reference in New Issue
Block a user