1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#include "focus_test_flow.h" 17 18#include <string> 19 20#include "report.h" 21#include "wukong_define.h" 22#include "ability_manager_client.h" 23#include "component_manager.h" 24#include "accessibility_ui_test_ability.h" 25#include "component_input.h" 26#include "tree_manager.h" 27 28namespace OHOS { 29namespace WuKong { 30namespace { 31const std::string FOCUS_TEST_HELP_MSG = 32 "usage: wukong focus [<arguments>]\n" 33 "These are wukong focus arguments list:\n" 34 " -h, --help random test help\n" 35 " -a, --appswitch appswitch event percent\n" 36 " -b, --bundle the bundle name of allowlist\n" 37 " -p, --prohibit the bundle name of blocklist\n" 38 " -d, --page block page list\n" 39 " -t, --touch touch event percent\n" 40 " -c, --count test count\n" 41 " -i, --interval interval\n" 42 " -s, --seed random seed\n" 43 " -m, --mouse mouse event percent\n" 44 " -k, --keyboard keyboard event percent\n" 45 " -H, --hardkey hardkey event percent\n" 46 " -S, --swap swap event percent\n" 47 " -T, --time test time\n" 48 " -C, --component component event percent\n" 49 " -r, --rotate rotate event percent\n" 50 " -n, --numberfocus the number of inputs to focus on some component one time\n" 51 " -f, --focustypes the component type to focus on\n" 52 " -e, --allow ability the ability name of allowlist\n" 53 " -E, --block ability the ability name of blocklist\n" 54 " -Y, --blockCompId the id list of block component\n" 55 " -y, --blockCompType the type list of block component\n" 56 " -I, --screenshot get screenshot\n"; 57 58const std::string SHORT_OPTIONS = "a:b:c:d:e:E:hIi:k:p:s:t:T:H:m:S:C:r:n:f:Y:y:"; 59const struct option LONG_OPTIONS[] = { 60 {"help", no_argument, nullptr, 'h'}, // help 61 {"seed", required_argument, nullptr, 's'}, // test seed 62 {"time", required_argument, nullptr, 'T'}, // test time 63 {"count", required_argument, nullptr, 'c'}, // test count 64 {"interval", required_argument, nullptr, 'i'}, // test interval 65 {"bundle", required_argument, nullptr, 'b'}, // test haps 66 {"appswitch", required_argument, nullptr, 'a'}, // switch app percent 67 {"keyboard", required_argument, nullptr, 'k'}, // keyboard percent 68 {"mouse", required_argument, nullptr, 'm'}, // mouse percent 69 {"touch", required_argument, nullptr, 't'}, // touch percent 70 {"swap", required_argument, nullptr, 'S'}, // swap percent 71 {"hardkey", required_argument, nullptr, 'H'}, // hardkey percent 72 {"prohibit", required_argument, nullptr, 'p'}, // prohibit 73 {"component", required_argument, nullptr, 'C'}, // prohibit 74 {"rotate", required_argument, nullptr, 'r'}, // rotate percent 75 {"numberfocus", required_argument, nullptr, 'n'}, // number focus 76 {"focustypes", required_argument, nullptr, 'f'}, // focus types 77 {"page", required_argument, nullptr, 'd'}, // block page 78 {"allow ability", required_argument, nullptr, 'e'}, 79 {"block ability", required_argument, nullptr, 'E'}, 80 {"blockCompId", required_argument, nullptr, 'Y'}, 81 {"blockCompType", required_argument, nullptr, 'y'}, 82 {"screenshot", no_argument, nullptr, 'I'}, // get screenshot 83}; 84 85/** 86 * WuKong default input action percent. 87 */ 88const vector<int> DEFAULT_INPUT_PERCENT = { 89 10, // INPUTTYPE_TOUCHINPUT, input touch event 90 3, // INPUTTYPE_SWAPINPUT, input swap event 91 1, // INPUTTYPE_MOUSEINPUT, input mouse event 92 2, // INPUTTYPE_KEYBOARDINPUT, input keyboard event 93 70, // INPUTTYPE_ELEMENTINPUT, input element event 94 10, // INPUTTYPE_APPSWITCHINPUT, input appswitch event 95 2, // INPUTTYPE_HARDKEYINPUT, input hardkey event 96 2 // INPUTTYPE_ROTATE, input rotate event 97}; 98 99const map<int, InputType> OPTION_INPUT_PERCENT = { 100 {'a', INPUTTYPE_APPSWITCHINPUT}, // input appswitch event 101 {'C', INPUTTYPE_ELEMENTINPUT}, // input element event 102 {'k', INPUTTYPE_KEYBOARDINPUT}, // input keyboard event 103 {'S', INPUTTYPE_SWAPINPUT}, // input swap event 104 {'m', INPUTTYPE_MOUSEINPUT}, // input mouse event 105 {'t', INPUTTYPE_TOUCHINPUT}, // input touch event 106 {'H', INPUTTYPE_HARDKEYINPUT}, // input hardkey event 107 {'r', INPUTTYPE_ROTATEINPUT} // input rotate event 108}; 109 110const int ONE_HUNDRED_PERCENT = 100; 111// one minute (ms) 112const int ONE_MINUTE = 60000; 113// rotate 114const int ROTATE = 114; 115bool g_commandSEEDENABLE = false; 116bool g_commandHELPENABLE = false; 117bool g_commandTIMEENABLE = false; 118bool g_commandCOUNTENABLE = false; 119bool g_isAppStarted = false; 120bool g_commandSCREENSHOTENABLE = false; 121bool g_commandALLOWABILITYENABLE = false; 122bool g_commandBLOCKABILITYENABLE = false; 123bool g_commandALLOWBUNDLEENABLE = false; 124} // namespace 125using namespace std; 126 127FocusTestFlow::FocusTestFlow(WuKongShellCommand &shellcommand) 128 : TestFlow(shellcommand), 129 inputPercent_(INPUTTYPE_INVALIDINPUT, 0) 130{ 131} 132 133FocusTestFlow::~FocusTestFlow() 134{ 135 if (timer_ != nullptr) { 136 timer_->Shutdown(); 137 timer_->Unregister(timerId_); 138 timer_ = nullptr; 139 } 140} 141 142ErrCode FocusTestFlow::InitEventPercent() 143{ 144 int sumPercent = 0; 145 int sumLastDefaultPercent = ONE_HUNDRED_PERCENT; 146 vector<int> lastDefaultPercent = DEFAULT_INPUT_PERCENT; 147 for (auto input : inputPercent_) { 148 TRACK_LOG_STR("input: (%02d)", input); 149 } 150 for (int type = 0; type < INPUTTYPE_INVALIDINPUT; type++) { 151 // add type to count input list for random algorithm. 152 for (int index = 0; index < inputPercent_[type]; index++) { 153 eventList_.push_back(type); 154 } 155 // check argument percent, and set last default percent. 156 if (inputPercent_[type] > 0) { 157 sumLastDefaultPercent -= lastDefaultPercent[type]; 158 lastDefaultPercent[type] = 0; 159 } 160 sumPercent += inputPercent_[type]; 161 } 162 TRACK_LOG_STR("sumPercent: %d", sumPercent); 163 // check the sum percent more than 100%, and exit wukong. 164 if (sumPercent > ONE_HUNDRED_PERCENT) { 165 shellcommand_.ResultReceiverAppend("all event percentage more than 1, please reset params.\n"); 166 shellcommand_.ResultReceiverAppend(FOCUS_TEST_HELP_MSG); 167 return OHOS::ERR_INVALID_VALUE; 168 } 169 170 // sum the last default percent for calculate last percent. 171 int lastPercent = ONE_HUNDRED_PERCENT - sumPercent; 172 int lastInputPercent = 0; 173 for (int type = 0; type < INPUTTYPE_INVALIDINPUT; type++) { 174 if (lastDefaultPercent[type] <= 0 || lastDefaultPercent[type] > ONE_HUNDRED_PERCENT || 175 sumLastDefaultPercent <= 0) { 176 continue; 177 } 178 lastInputPercent = (int)(lastPercent * ((float)(lastDefaultPercent[type]) / sumLastDefaultPercent)); 179 // add type to count input list for random algorithm. 180 for (int index = 0; index < lastInputPercent; index++) { 181 eventList_.push_back(type); 182 } 183 sumPercent += lastInputPercent; 184 } 185 186 // if the sumPercent less than 100%, add INPUTTYPE_TOUCHINPUT to random algorithm. 187 for (int index = 0; index < ONE_HUNDRED_PERCENT - sumPercent; index++) { 188 eventList_.push_back(INPUTTYPE_TOUCHINPUT); 189 } 190 191 return OHOS::ERR_OK; 192} 193 194ErrCode FocusTestFlow::EnvInit() 195{ 196 // init event list percent. 197 ErrCode result = InitEventPercent(); 198 if (result != OHOS::ERR_OK) { 199 return result; 200 } 201 202 // init srand and print seed information. 203 if (g_commandSEEDENABLE) { 204 srand(seedArgs_); 205 } else { 206 time_t tempSeed = time(nullptr); 207 srand((unsigned int)tempSeed); 208 seedArgs_ = (int)time(nullptr); 209 } 210 Report::GetInstance()->SetSeed(std::to_string(seedArgs_)); 211 Report::GetInstance()->SetIsFocusTest(true); 212 TEST_RUN_LOG(("Seed: " + std::to_string(seedArgs_)).c_str()); 213 214 // shuffle the event list. 215 RandomShuffle(); 216 217 // if time test flow, register timer. 218 if (g_commandTIMEENABLE) { 219 RegisterTimer(); 220 } 221 return result; 222} 223 224ErrCode FocusTestFlow::SetInputPercent(const int option) 225{ 226 InputType inputType = INPUTTYPE_INVALIDINPUT; 227 auto it = OPTION_INPUT_PERCENT.find(option); 228 if (it == OPTION_INPUT_PERCENT.end()) { 229 return OHOS::ERR_INVALID_VALUE; 230 } 231 232 inputType = it->second; 233 float percent = 0.0; 234 try { 235 percent = std::stof(optarg); 236 if ((it->first) == ROTATE && percent == 1) { 237 g_isAppStarted = true; 238 } 239 } catch (const std::exception &e) { 240 // try the option argument string convert float. 241 shellcommand_.ResultReceiverAppend("error: option '"); 242 shellcommand_.ResultReceiverAppend(string((char *)(&option))); 243 shellcommand_.ResultReceiverAppend("' requires a value.\n"); 244 shellcommand_.ResultReceiverAppend(FOCUS_TEST_HELP_MSG); 245 return OHOS::ERR_INVALID_VALUE; 246 } 247 // check valid of the option argument 248 if (percent > 1 || percent < 0) { 249 shellcommand_.ResultReceiverAppend("the input percent more than 1 (100%).\n"); 250 shellcommand_.ResultReceiverAppend(FOCUS_TEST_HELP_MSG); 251 return OHOS::ERR_INVALID_VALUE; 252 } 253 254 // convert float to int (0 ~ 100) 255 inputPercent_[inputType] = (int)(percent * ONE_HUNDRED_PERCENT); 256 return OHOS::ERR_OK; 257} 258 259ErrCode FocusTestFlow::SetBlackWhiteSheet(const int option) 260{ 261 ErrCode result = OHOS::ERR_OK; 262 if (option == 'b') { 263 result = WuKongUtil::GetInstance()->SetAllowList(optarg); 264 g_commandALLOWBUNDLEENABLE = true; 265 } else if (option == 'p') { 266 result = WuKongUtil::GetInstance()->SetBlockList(optarg); 267 } else if (option == 'e') { 268 result = WuKongUtil::GetInstance()->SetAllowAbilityList(optarg); 269 if (result != OHOS::ERR_INVALID_VALUE) { 270 result = CheckArgument(option); 271 } 272 } else if (option == 'E') { 273 result = WuKongUtil::GetInstance()->SetBlockAbilityList(optarg); 274 if (result != OHOS::ERR_INVALID_VALUE) { 275 result = CheckArgument(option); 276 } 277 } else if (option == 'd') { 278 result = WuKongUtil::GetInstance()->SetBlockPageList(optarg); 279 } else if (option == 'Y') { 280 WuKongUtil::GetInstance()->SetCompIdBlockList(optarg); 281 } else if (option == 'y') { 282 WuKongUtil::GetInstance()->SetCompTypeBlockList(optarg); 283 } 284 return OHOS::ERR_OK; 285} 286 287ErrCode FocusTestFlow::SetRunningParam(const int option) 288{ 289 ErrCode result = OHOS::ERR_OK; 290 if (option == 'c' || option == 'T') { 291 result = CheckArgument(option); 292 } else if (option == 'i') { 293 intervalArgs_ = std::stoi(optarg); 294 TEST_RUN_LOG(("Interval: " + std::to_string(intervalArgs_)).c_str()); 295 } else if (option == 's') { 296 seedArgs_ = std::stoi(optarg); 297 g_commandSEEDENABLE = true; 298 } else if (option == 'n') { 299 TreeManager::GetInstance()->SetFocusNum(optarg); 300 } else if (option == 'f') { 301 TreeManager::GetInstance()->SetFocusTypeList(optarg); 302 } 303 return result; 304} 305 306ErrCode FocusTestFlow::SetRunningIndicator(const int option) 307{ 308 ErrCode result = OHOS::ERR_OK; 309 if (option == 'h') { 310 shellcommand_.ResultReceiverAppend(FOCUS_TEST_HELP_MSG); 311 result = OHOS::ERR_NO_INIT; 312 g_commandHELPENABLE = true; 313 } else if (option == 'I') { 314 g_commandSCREENSHOTENABLE = true; 315 } 316 return OHOS::ERR_OK; 317} 318 319ErrCode FocusTestFlow::InputScene(std::shared_ptr<InputAction> inputaction, bool inputFlag) 320{ 321 ErrCode result = OHOS::ERR_OK; 322 if (inputFlag) { 323 TRACK_LOG("inputScene branck 1"); 324 result = inputaction->FocusInput(g_commandSCREENSHOTENABLE); 325 } else { 326 TRACK_LOG("inputScene branck 2"); 327 ComponentManager::GetInstance()->BackToPrePage(); 328 } 329 return result; 330} 331 332bool FocusTestFlow::SetBlockPage() 333{ 334 auto root = std::make_shared<OHOS::Accessibility::AccessibilityElementInfo>(); 335 auto accPtr = OHOS::Accessibility::AccessibilityUITestAbility::GetInstance(); 336 // Get root AccessibilityElementInfo from Accessibility 337 accPtr->GetRoot(*(root.get())); 338 std::string path = root->GetPagePath(); 339 bool inputFlag = true; 340 char const *systemPath = "pages/system"; 341 char const *passwordPath = "pages/biometricsandpassword"; 342 if (strstr(path.c_str(), systemPath) != NULL || 343 strstr(path.c_str(), passwordPath) != NULL) { 344 inputFlag = false; 345 } 346 TRACK_LOG_STR("Componentpage path: (%s)", path.c_str()); 347 return inputFlag; 348} 349 350ErrCode FocusTestFlow::RunStep() 351{ 352 TRACK_LOG("RunStep Start"); 353 ErrCode result; 354 // control the count test flow 355 if (g_commandCOUNTENABLE == true) { 356 totalCount_--; 357 if (totalCount_ < 0) { 358 isFinished_ = true; 359 return OHOS::ERR_OK; 360 } 361 } 362 bool inputFlag = SetBlockPage(); 363 std::shared_ptr<InputAction> inputaction = nullptr; 364 if (!g_isAppStarted) { 365 TRACK_LOG("RunStep g_isAppStarted not start"); 366 inputaction = InputFactory::GetInputAction(INPUTTYPE_APPSWITCHINPUT); 367 if (inputaction == nullptr) { 368 ERROR_LOG("inputaction is nullptr"); 369 return OHOS::ERR_INVALID_VALUE; 370 } 371 result = InputScene(inputaction, inputFlag); 372 if (result != OHOS::ERR_OK) { 373 ERROR_LOG("launch app failed and exit"); 374 return result; 375 } 376 inputaction = nullptr; 377 g_isAppStarted = true; 378 usleep(intervalArgs_ * oneSecond_); 379 } 380 TRACK_LOG("RunStep after g_isAppStarted "); 381 // input event, get event index form event list by random algorithm. 382 int eventindex = rand() % ONE_HUNDRED_PERCENT; 383 InputType eventTypeId = (InputType)(eventList_.at(eventindex)); 384 inputaction = InputFactory::GetInputAction(eventTypeId); 385 if (inputaction == nullptr) { 386 ERROR_LOG("inputaction is nullptr"); 387 return OHOS::ERR_INVALID_VALUE; 388 } 389 TRACK_LOG("RunStep before ProtectRightAbility"); 390 if (ProtectRightAbility(inputaction, eventTypeId) == OHOS::ERR_INVALID_VALUE) { 391 return OHOS::ERR_INVALID_VALUE; 392 } 393 394 result = InputScene(inputaction, inputFlag); 395 usleep(intervalArgs_ * oneSecond_); 396 return result; 397} 398 399ErrCode FocusTestFlow::ProtectRightAbility(std::shared_ptr<InputAction> &inputaction, InputType &eventTypeId) 400{ 401 std::vector<std::string> allowList; 402 WuKongUtil::GetInstance()->GetAllowList(allowList); 403 if (allowList.size() > 0) { 404 auto elementName = AAFwk::AbilityManagerClient::GetInstance()->GetTopAbility(); 405 406 // allowList 数量大于0 并且 elementName.GetBundleName() 不在allowList里面,重新拉起一个应用 407 auto curBundleName = elementName.GetBundleName(); 408 auto it = find(allowList.begin(), allowList.end(), curBundleName); 409 if (it == allowList.end()) { 410 inputaction = InputFactory::GetInputAction(INPUTTYPE_APPSWITCHINPUT); 411 if (inputaction == nullptr) { 412 ERROR_LOG("inputaction is nullptr"); 413 return OHOS::ERR_INVALID_VALUE; 414 } 415 } 416 } 417 return OHOS::ERR_OK; 418} 419 420ErrCode FocusTestFlow::HandleNormalOption(const int option) 421{ 422 ErrCode result; 423 if (option == 't' || option == 'm' || option == 'S' || option == 'k' || option == 'H' || 424 option == 'a' || option == 'r' || option == 'C') { 425 result = SetInputPercent(option); 426 } else { 427 result = SetBlackWhiteSheet(option); 428 if (result != OHOS::ERR_OK) { 429 return result; 430 } 431 result = SetRunningParam(option); 432 if (result != OHOS::ERR_OK) { 433 return result; 434 } 435 result = SetRunningIndicator(option); 436 } 437 WuKongUtil::GetInstance()->SetOrderFlag(false); 438 return result; 439} 440 441ErrCode FocusTestFlow::CheckArgument(const int option) 442{ 443 ErrCode result = OHOS::ERR_OK; 444 switch (option) { 445 case 'c': { 446 result = CheckArgumentOptionOfc(); 447 break; 448 } 449 case 'T': { 450 result = CheckArgumentOptionOfT(); 451 break; 452 } 453 case 'e': { 454 result = CheckArgumentOptionOfe(); 455 break; 456 } 457 case 'E': { 458 result = CheckArgumentOptionOfE(); 459 break; 460 } 461 default: { 462 result = OHOS::ERR_INVALID_VALUE; 463 break; 464 } 465 } 466 return result; 467} 468 469const struct option *FocusTestFlow::GetOptionArguments(std::string &shortOpts) 470{ 471 shortOpts = SHORT_OPTIONS; 472 return LONG_OPTIONS; 473} 474 475ErrCode FocusTestFlow::HandleUnknownOption(const char optopt) 476{ 477 ErrCode result = OHOS::ERR_OK; 478 switch (optopt) { 479 case 'a': 480 case 'b': 481 case 'c': 482 case 'i': 483 case 's': 484 case 't': 485 case 'r': 486 case 'S': 487 case 'p': 488 case 'k': 489 case 'H': 490 case 'T': 491 case 'm': 492 case 'C': 493 case 'n': 494 case 'f': 495 case 'Y': 496 case 'y': 497 // error: option 'x' requires a value. 498 shellcommand_.ResultReceiverAppend("error: option '-"); 499 shellcommand_.ResultReceiverAppend(string(1, optopt)); 500 shellcommand_.ResultReceiverAppend("' requires a value.\n"); 501 result = OHOS::ERR_INVALID_VALUE; 502 break; 503 case 'h': { 504 result = OHOS::ERR_INVALID_VALUE; 505 break; 506 } 507 default: { 508 // 'wukong focus' with an unknown option: wukong focus -x 509 shellcommand_.ResultReceiverAppend( 510 "'wukong focus' with an unknown option, please reference help information:\n"); 511 result = OHOS::ERR_INVALID_VALUE; 512 break; 513 } 514 } 515 shellcommand_.ResultReceiverAppend(FOCUS_TEST_HELP_MSG); 516 return result; 517} 518 519void FocusTestFlow::RandomShuffle() 520{ 521 for (uint32_t i = eventList_.size() - 1; i > 0; --i) { 522 std::swap(eventList_[i], eventList_[std::rand() % (i + 1)]); 523 } 524} 525 526void FocusTestFlow::RegisterTimer() 527{ 528 if (timer_ == nullptr) { 529 timer_ = std::make_shared<Utils::Timer>("wukong"); 530 timerId_ = timer_->Register([this] () { FocusTestFlow::TestTimeout(); }, totalTime_ * ONE_MINUTE, true); 531 timer_->Setup(); 532 } 533} 534 535void FocusTestFlow::TestTimeout() 536{ 537 g_commandTIMEENABLE = false; 538 isFinished_ = true; 539} 540 541ErrCode FocusTestFlow::CheckArgumentOptionOfe() 542{ 543 if (g_commandALLOWABILITYENABLE == false) { 544 g_commandALLOWABILITYENABLE = true; 545 if (g_commandALLOWBUNDLEENABLE == true) { 546 return OHOS::ERR_OK; 547 } else { 548 ERROR_LOG("invalid param : When -e is configured, -b must be configured."); 549 ERROR_LOG("invalid param : please ensure that the -b is before the -e"); 550 return OHOS::ERR_INVALID_VALUE; 551 } 552 } else { 553 ERROR_LOG("invalid param : please check params of '-e'."); 554 return OHOS::ERR_INVALID_VALUE; 555 } 556} 557 558ErrCode FocusTestFlow::CheckArgumentOptionOfE() 559{ 560 if (g_commandBLOCKABILITYENABLE == false) { 561 g_commandBLOCKABILITYENABLE = true; 562 if (g_commandALLOWBUNDLEENABLE == true) { 563 return OHOS::ERR_OK; 564 } else { 565 ERROR_LOG("invalid param : When -E is configure, -b must be configured."); 566 ERROR_LOG("invalid param : Plese ensure that the -b is before the -E."); 567 return OHOS::ERR_INVALID_VALUE; 568 } 569 } else { 570 ERROR_LOG("invalid param : please check params of '-E'."); 571 return OHOS::ERR_INVALID_VALUE; 572 } 573} 574 575ErrCode FocusTestFlow::CheckArgumentOptionOfc() 576{ 577 // check if the '-c' and 'T' is exist at the same time 578 if (g_commandTIMEENABLE == false) { 579 std::stringstream ss(optarg); 580 if (ss >> countArgs_) { 581 g_commandCOUNTENABLE = true; 582 TEST_RUN_LOG(("Count: " + std::to_string(countArgs_)).c_str()); 583 totalCount_ = countArgs_; 584 return OHOS::ERR_OK; 585 } else { 586 ERROR_LOG("Setting -c must follow an interger"); 587 return OHOS::ERR_INVALID_VALUE; 588 } 589 } else { 590 DEBUG_LOG(PARAM_COUNT_TIME_ERROR); 591 shellcommand_.ResultReceiverAppend(std::string(PARAM_COUNT_TIME_ERROR) + "\n"); 592 return OHOS::ERR_INVALID_VALUE; 593 } 594} 595 596ErrCode FocusTestFlow::CheckArgumentOptionOfT() 597{ 598 // check if the '-c' and 'T' is exist at the same time 599 if (g_commandCOUNTENABLE == false) { 600 std::stringstream ss(optarg); 601 if (ss >> totalTime_) { 602 TEST_RUN_LOG(("Time: " + std::to_string(totalTime_)).c_str()); 603 g_commandTIMEENABLE = true; 604 return OHOS::ERR_OK; 605 } else { 606 ERROR_LOG("Setting -T must follow a float"); 607 return OHOS::ERR_INVALID_VALUE; 608 } 609 } else { 610 DEBUG_LOG(PARAM_TIME_COUNT_ERROR); 611 shellcommand_.ResultReceiverAppend(std::string(PARAM_TIME_COUNT_ERROR) + "\n"); 612 return OHOS::ERR_INVALID_VALUE; 613 } 614} 615 616} // namespace WuKong 617} // namespace OHOS 618