1 /* 2 * Copyright (c) 2020 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 #ifndef OHOS_ABILITY_TOOL_H 17 #define OHOS_ABILITY_TOOL_H 18 19 #include <iproxy_client.h> 20 #include "ipc_skeleton.h" 21 #include "want.h" 22 23 namespace OHOS { 24 class AbilityTool { 25 public: 26 AbilityTool() = default; 27 ~AbilityTool(); 28 bool SetBundleName(const char *bundleName); 29 bool SetAbilityName(const char *className); 30 void SetExtra(const char *extra); 31 bool SetCommand(const char *command); 32 bool RunCommand(); 33 void SetDumpAll(); 34 35 private: 36 Want* BuildWant(); 37 bool InnerStartAbility(); 38 bool InnerStopAbility(); 39 bool TerminateApp(IClientProxy *proxy) const; 40 bool Dump(IClientProxy *proxy); 41 static int32_t AaCallback(uint32_t code, IpcIo *data, IpcIo *reply, MessageOption option); 42 43 ElementName elementName_ { nullptr, nullptr, nullptr }; 44 char *extra_ { nullptr }; 45 char *command_ { nullptr }; 46 bool dumpAll_ { false }; 47 SvcIdentity identity_ {}; 48 static const int MAX_OBJECTS = 2; 49 IpcObjectStub objectStub_; 50 }; 51 } // namespace OHOS 52 #endif // OHOS_ABILITY_TOOL_H 53