1 /*
2 * Copyright (c) 2022-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 #include "mock_free_install_manager.h"
17 #include "mock_my_status.h"
18
19 namespace OHOS {
20 namespace AAFwk {
FreeInstallManager(const std::weak_ptr<AbilityManagerService> & server)21 FreeInstallManager::FreeInstallManager(const std::weak_ptr<AbilityManagerService> &server)
22 : server_(server)
23 {
24 }
25
IsTopAbility(const sptr<IRemoteObject> & callerToken)26 bool FreeInstallManager::IsTopAbility(const sptr<IRemoteObject> &callerToken)
27 {
28 return true;
29 }
30
StartFreeInstall(const Want & want,int32_t userId,int requestCode,const sptr<IRemoteObject> & callerToken,std::shared_ptr<FreeInstallParams> param)31 int FreeInstallManager::StartFreeInstall(const Want &want, int32_t userId, int requestCode,
32 const sptr<IRemoteObject> &callerToken, std::shared_ptr<FreeInstallParams> param)
33 {
34 return MyStatus::GetInstance().fimStartFreeInstall_;
35 }
36
RemoteFreeInstall(const Want & want,int32_t userId,int requestCode,const sptr<IRemoteObject> & callerToken)37 int FreeInstallManager::RemoteFreeInstall(const Want &want, int32_t userId, int requestCode,
38 const sptr<IRemoteObject> &callerToken)
39 {
40 return NOT_TOP_ABILITY;
41 }
42
BuildFreeInstallInfo(const Want & want,int32_t userId,int requestCode,const sptr<IRemoteObject> & callerToken,std::shared_ptr<FreeInstallParams> param)43 FreeInstallInfo FreeInstallManager::BuildFreeInstallInfo(const Want &want, int32_t userId, int requestCode,
44 const sptr<IRemoteObject> &callerToken, std::shared_ptr<FreeInstallParams> param)
45 {
46 FreeInstallInfo info = {};
47 return info;
48 }
49
StartRemoteFreeInstall(const Want & want,int requestCode,int32_t validUserId,const sptr<IRemoteObject> & callerToken)50 int FreeInstallManager::StartRemoteFreeInstall(const Want &want, int requestCode, int32_t validUserId,
51 const sptr<IRemoteObject> &callerToken)
52 {
53 return 0;
54 }
55
NotifyDmsCallback(const Want & want,int resultCode)56 int FreeInstallManager::NotifyDmsCallback(const Want &want, int resultCode)
57 {
58 return ERR_OK;
59 }
60
NotifyFreeInstallResult(int32_t recordId,const Want & want,int resultCode,bool isAsync)61 void FreeInstallManager::NotifyFreeInstallResult(int32_t recordId, const Want &want, int resultCode, bool isAsync)
62 {
63 }
64
HandleOnFreeInstallSuccess(int32_t recordId,FreeInstallInfo & freeInstallInfo,bool isAsync)65 void FreeInstallManager::HandleOnFreeInstallSuccess(int32_t recordId, FreeInstallInfo &freeInstallInfo, bool isAsync)
66 {
67 }
68
HandleOnFreeInstallFail(int32_t recordId,FreeInstallInfo & freeInstallInfo,int resultCode,bool isAsync)69 void FreeInstallManager::HandleOnFreeInstallFail(int32_t recordId, FreeInstallInfo &freeInstallInfo, int resultCode,
70 bool isAsync)
71 {
72 }
73
HandleFreeInstallResult(int32_t recordId,FreeInstallInfo & freeInstallInfo,int resultCode,bool isAsync)74 void FreeInstallManager::HandleFreeInstallResult(int32_t recordId, FreeInstallInfo &freeInstallInfo, int resultCode,
75 bool isAsync)
76 {
77 }
78
StartAbilityByFreeInstall(FreeInstallInfo & info,std::string & bundleName,std::string & abilityName,std::string & startTime)79 void FreeInstallManager::StartAbilityByFreeInstall(FreeInstallInfo &info, std::string &bundleName,
80 std::string &abilityName, std::string &startTime)
81 {
82 }
83
StartAbilityByPreInstall(int32_t recordId,FreeInstallInfo & info,std::string & bundleName,std::string & abilityName,std::string & startTime)84 void FreeInstallManager::StartAbilityByPreInstall(int32_t recordId, FreeInstallInfo &info, std::string &bundleName,
85 std::string &abilityName, std::string &startTime)
86 {
87 }
88
StartAbilityByConvertedWant(FreeInstallInfo & info,const std::string & startTime)89 void FreeInstallManager::StartAbilityByConvertedWant(FreeInstallInfo &info, const std::string &startTime)
90 {
91 }
92
StartAbilityByOriginalWant(FreeInstallInfo & info,const std::string & startTime)93 void FreeInstallManager::StartAbilityByOriginalWant(FreeInstallInfo &info, const std::string &startTime)
94 {
95 }
96
UpdateElementName(Want & want,int32_t userId) const97 int32_t FreeInstallManager::UpdateElementName(Want &want, int32_t userId) const
98 {
99 return ERR_OK;
100 }
101
FreeInstallAbilityFromRemote(const Want & want,const sptr<IRemoteObject> & callback,int32_t userId,int requestCode)102 int FreeInstallManager::FreeInstallAbilityFromRemote(const Want &want, const sptr<IRemoteObject> &callback,
103 int32_t userId, int requestCode)
104 {
105 return ERR_OK;
106 }
107
ConnectFreeInstall(const Want & want,int32_t userId,const sptr<IRemoteObject> & callerToken,const std::string & localDeviceId)108 int FreeInstallManager::ConnectFreeInstall(const Want &want, int32_t userId,
109 const sptr<IRemoteObject> &callerToken, const std::string& localDeviceId)
110 {
111 return ERR_OK;
112 }
113
GetTimeStamp()114 std::time_t FreeInstallManager::GetTimeStamp()
115 {
116 std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds> tp =
117 std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::system_clock::now());
118 std::time_t timestamp = tp.time_since_epoch().count();
119 return timestamp;
120 }
121
OnInstallFinished(int32_t recordId,int resultCode,const Want & want,int32_t userId,bool isAsync)122 void FreeInstallManager::OnInstallFinished(int32_t recordId, int resultCode, const Want &want,
123 int32_t userId, bool isAsync)
124 {
125 }
126
PostUpgradeAtomicServiceTask(int resultCode,const Want & want,int32_t userId)127 void FreeInstallManager::PostUpgradeAtomicServiceTask(int resultCode, const Want &want, int32_t userId)
128 {
129 }
130
OnRemoteInstallFinished(int32_t recordId,int resultCode,const Want & want,int32_t userId)131 void FreeInstallManager::OnRemoteInstallFinished(int32_t recordId, int resultCode, const Want &want, int32_t userId)
132 {
133 }
134
AddFreeInstallObserver(const sptr<IRemoteObject> & callerToken,const sptr<AbilityRuntime::IFreeInstallObserver> & observer)135 int FreeInstallManager::AddFreeInstallObserver(const sptr<IRemoteObject> &callerToken,
136 const sptr<AbilityRuntime::IFreeInstallObserver> &observer)
137 {
138 return CHECK_PERMISSION_FAILED;
139 }
140
RemoveFreeInstallInfo(const std::string & bundleName,const std::string & abilityName,const std::string & startTime)141 void FreeInstallManager::RemoveFreeInstallInfo(const std::string &bundleName, const std::string &abilityName,
142 const std::string &startTime)
143 {
144 }
145
VerifyStartFreeInstallPermission(const sptr<IRemoteObject> & callerToken)146 bool FreeInstallManager::VerifyStartFreeInstallPermission(const sptr<IRemoteObject> &callerToken)
147 {
148 return true;
149 }
150
GetRecordIdByToken(const sptr<IRemoteObject> & callerToken)151 int32_t FreeInstallManager::GetRecordIdByToken(const sptr<IRemoteObject> &callerToken)
152 {
153 return 0;
154 }
155
SetAppRunningState(Want & want)156 int FreeInstallManager::SetAppRunningState(Want &want)
157 {
158 return ERR_OK;
159 }
160
GetFreeInstallTaskInfo(const std::string & bundleName,const std::string & abilityName,const std::string & startTime,FreeInstallInfo & taskInfo)161 bool FreeInstallManager::GetFreeInstallTaskInfo(const std::string& bundleName, const std::string& abilityName,
162 const std::string& startTime, FreeInstallInfo& taskInfo)
163 {
164 return false;
165 }
166
GetFreeInstallTaskInfo(const std::string & sessionId,FreeInstallInfo & taskInfo)167 bool FreeInstallManager::GetFreeInstallTaskInfo(const std::string& sessionId, FreeInstallInfo& taskInfo)
168 {
169 return false;
170 }
171
SetSCBCallStatus(const std::string & bundleName,const std::string & abilityName,const std::string & startTime,bool scbCallStatus)172 void FreeInstallManager::SetSCBCallStatus(const std::string& bundleName, const std::string& abilityName,
173 const std::string& startTime, bool scbCallStatus)
174 {
175 }
176
SetPreStartMissionCallStatus(const std::string & bundleName,const std::string & abilityName,const std::string & startTime,bool preStartMissionCallStatus)177 void FreeInstallManager::SetPreStartMissionCallStatus(const std::string& bundleName, const std::string& abilityName,
178 const std::string& startTime, bool preStartMissionCallStatus)
179 {
180 }
181
SetFreeInstallTaskSessionId(const std::string & bundleName,const std::string & abilityName,const std::string & startTime,const std::string & sessionId)182 void FreeInstallManager::SetFreeInstallTaskSessionId(const std::string& bundleName, const std::string& abilityName,
183 const std::string& startTime, const std::string& sessionId)
184 {
185 }
186
NotifyInsightIntentFreeInstallResult(const Want & want,int resultCode)187 void FreeInstallManager::NotifyInsightIntentFreeInstallResult(const Want &want, int resultCode)
188 {
189 }
190
NotifyInsightIntentExecuteDone(const Want & want,int resultCode)191 void FreeInstallManager::NotifyInsightIntentExecuteDone(const Want &want, int resultCode)
192 {
193 }
194 } // namespace AAFwk
195 } // namespace OHOS
196