1 /* 2 * Copyright (c) 2024 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 TEST_SERVER_CLIENT_H 17 #define TEST_SERVER_CLIENT_H 18 19 #include "iremote_object.h" 20 #include "itest_server_interface.h" 21 #include <common_event_manager.h> 22 #include <common_event_subscribe_info.h> 23 #include "memory.h" 24 25 namespace OHOS::testserver { 26 27 class TestServerClient { 28 public: 29 static TestServerClient &GetInstance(); 30 sptr<ITestServerInterface> LoadTestServer(); 31 int32_t SetPasteData(std::string text); 32 int32_t ChangeWindowMode(int windowId, uint32_t mode); 33 int32_t TerminateWindow(int windowId); 34 int32_t MinimizeWindow(int windowId); 35 bool PublishCommonEvent(const EventFwk::CommonEventData &event); 36 void FrequencyLock(); 37 int32_t SpDaemonProcess(int daemonCommand, std::string extraInfo); 38 int32_t CollectProcessMemory(int32_t &pid, ProcessMemoryInfo &processMemoryInfo); 39 int32_t CollectProcessCpu(int32_t &pid, bool isNeedUpdate, ProcessCpuInfo &processCpuInfo); 40 private: 41 TestServerClient(); 42 ~TestServerClient() = default; 43 void InitLoadState(); 44 bool WaitLoadStateChange(int32_t systemAbilityId); 45 46 sptr<IRemoteObject> remoteObject_ = nullptr; 47 sptr<ITestServerInterface> iTestServerInterface_ = nullptr; 48 }; 49 } // namespace OHOS::testserver 50 51 #ifdef __cplusplus 52 extern "C" { 53 #endif 54 void FrequencyLockPlugin(); 55 #ifdef __cplusplus 56 } 57 #endif 58 59 #endif // TEST_SERVER_CLIENT_H