• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <gtest/gtest.h>
17 #include <string_ex.h>
18 #include "ability_manager_client.h"
19 #include "ability_manager_interface.h"
20 #include "accessible_ability_client_stub_impl.h"
21 #include "hilog_wrapper.h"
22 #include "if_system_ability_manager.h"
23 #include "ipc_skeleton.h"
24 #include "iservice_registry.h"
25 #include "system_ability_definition.h"
26 
27 namespace OHOS {
28 namespace AAFwk {
29 std::shared_ptr<AbilityManagerClient> AbilityManagerClient::instance_ = nullptr;
30 std::mutex AbilityManagerClient::mutex_;
31 
GetInstance()32 std::shared_ptr<AbilityManagerClient> AbilityManagerClient::GetInstance()
33 {
34     GTEST_LOG_(INFO) << "MOCK AbilityManagerClient GetInstance";
35     if (!instance_) {
36         std::lock_guard<std::mutex> lock_l(mutex_);
37         if (!instance_) {
38             instance_ = std::make_shared<AbilityManagerClient>();
39         }
40     }
41     return instance_;
42 }
43 
ConnectAbility(const Want & want,const sptr<IAbilityConnection> & connect,const sptr<IRemoteObject> & callerToken,int32_t userId)44 ErrCode AbilityManagerClient::ConnectAbility(const Want &want, const sptr<IAbilityConnection> &connect,
45     const sptr<IRemoteObject> &callerToken, int32_t userId)
46 {
47     GTEST_LOG_(INFO) << "MOCK AbilityManagerClient ConnectAbility";
48     return ERR_OK;
49 }
50 
DisconnectAbility(const sptr<IAbilityConnection> & connect)51 ErrCode AbilityManagerClient::DisconnectAbility(const sptr<IAbilityConnection> &connect)
52 {
53     GTEST_LOG_(INFO) << "MOCK AbilityManagerClient DisconnectAbility";
54     return ERR_OK;
55 }
56 
AbilityManagerClient()57 AbilityManagerClient::AbilityManagerClient()
58 {
59 }
60 
~AbilityManagerClient()61 AbilityManagerClient::~AbilityManagerClient()
62 {
63 }
64 
AttachAbilityThread(const sptr<IAbilityScheduler> & scheduler,const sptr<IRemoteObject> & token)65 ErrCode AbilityManagerClient::AttachAbilityThread(const sptr<IAbilityScheduler> &scheduler,
66     const sptr<IRemoteObject> &token)
67 {
68     return ERR_OK;
69 }
70 
AbilityTransitionDone(const sptr<IRemoteObject> & token,int state,const PacMap & saveData)71 ErrCode AbilityManagerClient::AbilityTransitionDone(const sptr<IRemoteObject> &token, int state, const PacMap &saveData)
72 {
73     return ERR_OK;
74 }
75 
ScheduleConnectAbilityDone(const sptr<IRemoteObject> & token,const sptr<IRemoteObject> & remoteObject)76 ErrCode AbilityManagerClient::ScheduleConnectAbilityDone(
77     const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject)
78 {
79     return ERR_OK;
80 }
81 
ScheduleDisconnectAbilityDone(const sptr<IRemoteObject> & token)82 ErrCode AbilityManagerClient::ScheduleDisconnectAbilityDone(const sptr<IRemoteObject> &token)
83 {
84     return ERR_OK;
85 }
86 
ScheduleCommandAbilityDone(const sptr<IRemoteObject> & token)87 ErrCode AbilityManagerClient::ScheduleCommandAbilityDone(const sptr<IRemoteObject> &token)
88 {
89     return ERR_OK;
90 }
91 
AddWindowInfo(const sptr<IRemoteObject> & token,int32_t windowToken)92 void AbilityManagerClient::AddWindowInfo(const sptr<IRemoteObject> &token, int32_t windowToken)
93 {
94 }
95 
StartAbility(const Want & want,int requestCode,int32_t userId)96 ErrCode AbilityManagerClient::StartAbility(const Want &want, int requestCode, int32_t userId)
97 {
98     return ERR_OK;
99 }
100 
StartAbility(const Want & want,const sptr<IRemoteObject> & callerToken,int requestCode,int32_t userId)101 ErrCode AbilityManagerClient::StartAbility(const Want &want,
102     const sptr<IRemoteObject> &callerToken, int requestCode, int32_t userId)
103 {
104     return ERR_OK;
105 }
106 
TerminateAbility(const sptr<IRemoteObject> & token,int resultCode,const Want * resultWant)107 ErrCode AbilityManagerClient::TerminateAbility(const sptr<IRemoteObject> &token, int resultCode, const Want *resultWant)
108 {
109     return ERR_OK;
110 }
111 
TerminateAbility(const sptr<IRemoteObject> & callerToken,int requestCode)112 ErrCode AbilityManagerClient::TerminateAbility(const sptr<IRemoteObject> &callerToken, int requestCode)
113 {
114     return ERR_OK;
115 }
116 
TerminateAbilityResult(const sptr<IRemoteObject> & token,int startId)117 ErrCode AbilityManagerClient::TerminateAbilityResult(const sptr<IRemoteObject> &token, int startId)
118 {
119     return ERR_OK;
120 }
121 
AcquireDataAbility(const Uri & uri,bool tryBind,const sptr<IRemoteObject> & callerToken)122 sptr<IAbilityScheduler> AbilityManagerClient::AcquireDataAbility(
123     const Uri &uri, bool tryBind, const sptr<IRemoteObject> &callerToken)
124 {
125     return nullptr;
126 }
127 
ReleaseDataAbility(sptr<IAbilityScheduler> dataAbilityScheduler,const sptr<IRemoteObject> & callerToken)128 ErrCode AbilityManagerClient::ReleaseDataAbility(
129     sptr<IAbilityScheduler> dataAbilityScheduler, const sptr<IRemoteObject> &callerToken)
130 {
131     return ERR_OK;
132 }
133 
DumpState(const std::string & args,std::vector<std::string> & state)134 ErrCode AbilityManagerClient::DumpState(const std::string &args, std::vector<std::string> &state)
135 {
136     return ERR_OK;
137 }
138 
Connect()139 ErrCode AbilityManagerClient::Connect()
140 {
141     return ERR_OK;
142 }
143 
GetAllStackInfo(StackInfo & stackInfo)144 ErrCode AbilityManagerClient::GetAllStackInfo(StackInfo &stackInfo)
145 {
146     return ERR_OK;
147 }
148 
StopServiceAbility(const Want & want)149 ErrCode AbilityManagerClient::StopServiceAbility(const Want &want)
150 {
151     return ERR_OK;
152 }
153 
GetRecentMissions(const int32_t numMax,const int32_t flags,std::vector<AbilityMissionInfo> & recentList)154 ErrCode GetRecentMissions(const int32_t numMax, const int32_t flags, std::vector<AbilityMissionInfo> &recentList)
155 {
156     return ERR_OK;
157 }
158 
GetMissionSnapshot(const int32_t missionId,MissionSnapshot & snapshot)159 ErrCode AbilityManagerClient::GetMissionSnapshot(const int32_t missionId, MissionSnapshot &snapshot)
160 {
161     return ERR_OK;
162 }
163 
MoveMissionToTop(int32_t missionId)164 ErrCode AbilityManagerClient::MoveMissionToTop(int32_t missionId)
165 {
166     return ERR_OK;
167 }
168 
RemoveMissions(std::vector<int> missionId)169 ErrCode AbilityManagerClient::RemoveMissions(std::vector<int> missionId)
170 {
171     return ERR_OK;
172 }
173 
RemoveStack(int id)174 ErrCode AbilityManagerClient::RemoveStack(int id)
175 {
176     return ERR_OK;
177 }
178 
KillProcess(const std::string & bundleName)179 ErrCode AbilityManagerClient::KillProcess(const std::string &bundleName)
180 {
181     return ERR_OK;
182 }
183 
SetAbilityController(const sptr<AppExecFwk::IAbilityController> & abilityController,bool imAStabilityTest)184 ErrCode AbilityManagerClient::SetAbilityController(const sptr<AppExecFwk::IAbilityController> &abilityController,
185     bool imAStabilityTest)
186 {
187     return ERR_OK;
188 }
189 } // namespace AAFwk
190 } // namespace OHOS
191