1 /* 2 * Copyright (c) 2021-2025 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 FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_IPC_INSTALLD_HOST_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_IPC_INSTALLD_HOST_H 18 19 #include <mutex> 20 #include <string> 21 22 #include "event_handler.h" 23 #include "event_runner.h" 24 #include "iremote_stub.h" 25 #include "ipc/critical_manager.h" 26 #include "ipc/installd_interface.h" 27 28 namespace OHOS { 29 namespace AppExecFwk { 30 class InstalldHost : public IRemoteStub<IInstalld> { 31 public: 32 InstalldHost(); 33 virtual ~InstalldHost() override; 34 35 virtual int OnRemoteRequest( 36 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 37 38 void SetMemMgrStatus(bool started); 39 private: 40 /** 41 * @brief Handles the CreateBundleDir function called from a IInstalld proxy object. 42 * @param data Indicates the data to be read. 43 * @param reply Indicates the reply to be sent; 44 * @return Returns true if called successfully; returns false otherwise. 45 */ 46 bool HandleCreateBundleDir(MessageParcel &data, MessageParcel &reply); 47 /** 48 * @brief Handles the ExtractModuleFiles function called from a IInstalld proxy object. 49 * @param data Indicates the data to be read. 50 * @param reply Indicates the reply to be sent; 51 * @return Returns true if called successfully; returns false otherwise. 52 */ 53 bool HandleExtractModuleFiles(MessageParcel &data, MessageParcel &reply); 54 /** 55 * @brief Handles the HandleExtractFiles function called from a IInstalld proxy object. 56 * @param data Indicates the data to be read. 57 * @param reply Indicates the reply to be sent; 58 * @return Returns true if called successfully; returns false otherwise. 59 */ 60 bool HandleExtractFiles(MessageParcel &data, MessageParcel &reply); 61 /** 62 * @brief Handles the HandleExtractHnpFiles function called from a IInstalld proxy object. 63 * @param data Indicates the data to be read. 64 * @param reply Indicates the reply to be sent; 65 * @return Returns true if called successfully; returns false otherwise. 66 */ 67 bool HandleExtractHnpFiles(MessageParcel &data, MessageParcel &reply); 68 69 bool HandleProcessBundleInstallNative(MessageParcel &data, MessageParcel &reply); 70 bool HandleProcessBundleUnInstallNative(MessageParcel &data, MessageParcel &reply); 71 72 bool HandleExecuteAOT(MessageParcel &data, MessageParcel &reply); 73 74 bool HandlePendSignAOT(MessageParcel &data, MessageParcel &reply); 75 76 bool HandleStopAOT(MessageParcel &data, MessageParcel &reply); 77 78 bool HandleDeleteUninstallTmpDirs(MessageParcel &data, MessageParcel &reply); 79 /** 80 * @brief Handles the RenameModuleDir function called from a IInstalld proxy object. 81 * @param data Indicates the data to be read. 82 * @param reply Indicates the reply to be sent; 83 * @return Returns true if called successfully; returns false otherwise. 84 */ 85 bool HandleRenameModuleDir(MessageParcel &data, MessageParcel &reply); 86 /** 87 * @brief Handles the CreateBundleDataDir function called from a IInstalld proxy object. 88 * @param data Indicates the data to be read. 89 * @param reply Indicates the reply to be sent; 90 * @return Returns true if called successfully; returns false otherwise. 91 */ 92 bool HandleCreateBundleDataDir(MessageParcel &data, MessageParcel &reply); 93 94 bool HandleCreateBundleDataDirWithVector(MessageParcel &data, MessageParcel &reply); 95 /** 96 * @brief Handles the RemoveBundleDataDir function called from a IInstalld proxy object. 97 * @param data Indicates the data to be read. 98 * @param reply Indicates the reply to be sent; 99 * @return Returns true if called successfully; returns false otherwise. 100 */ 101 bool HandleRemoveBundleDataDir(MessageParcel &data, MessageParcel &reply); 102 /** 103 * @brief Handles the RemoveModuleDataDir function called from a IInstalld proxy object. 104 * @param data Indicates the data to be read. 105 * @param reply Indicates the reply to be sent; 106 * @return Returns true if called successfully; returns false otherwise. 107 */ 108 bool HandleRemoveModuleDataDir(MessageParcel &data, MessageParcel &reply); 109 /** 110 * @brief Handles the RemoveDir function called from a IInstalld proxy object. 111 * @param data Indicates the data to be read. 112 * @param reply Indicates the reply to be sent; 113 * @return Returns true if called successfully; returns false otherwise. 114 */ 115 bool HandleRemoveDir(MessageParcel &data, MessageParcel &reply); 116 /** 117 * @brief Handles the GetDiskUsage function called from a IInstalld proxy object. 118 * @param data Indicates the data to be read. 119 * @param reply Indicates the reply to be sent; 120 * @return Returns true if called successfully; returns false otherwise. 121 */ 122 bool HandleGetDiskUsage(MessageParcel &data, MessageParcel &reply); 123 /** 124 * @brief Handles the GetDiskUsage function called from a IInstalld proxy object. 125 * @param data Indicates the data to be read. 126 * @param reply Indicates the reply to be sent; 127 * @return Returns true if called successfully; returns false otherwise. 128 */ 129 bool HandleGetDiskUsageFromPath(MessageParcel &data, MessageParcel &reply); 130 /** 131 * @brief Handles the CleanBundleDataDir function called from a IInstalld proxy object. 132 * @param data Indicates the data to be read. 133 * @param reply Indicates the reply to be sent; 134 * @return Returns true if called successfully; returns false otherwise. 135 */ 136 bool HandleCleanBundleDataDir(MessageParcel &data, MessageParcel &reply); 137 /** 138 * @brief Handles the CleanBundleDataDirByName function called from a IInstalld proxy object. 139 * @param data Indicates the data to be read. 140 * @param reply Indicates the reply to be sent; 141 * @return Returns true if called successfully; returns false otherwise. 142 */ 143 bool HandleCleanBundleDataDirByName(MessageParcel &data, MessageParcel &reply); 144 /** 145 * @brief Handles the CleanBundleDataDir function called from a IInstalld proxy object. 146 * @param data Indicates the data to be read. 147 * @param reply Indicates the reply to be sent; 148 * @return Returns true if called successfully; returns false otherwise. 149 */ 150 bool HandleGetBundleStats(MessageParcel &data, MessageParcel &reply); 151 152 bool HandleBatchGetBundleStats(MessageParcel &data, MessageParcel &reply); 153 154 bool HandleGetAllBundleStats(MessageParcel &data, MessageParcel &reply); 155 156 /** 157 * @brief Handles the set dir apl function called from a IInstalld proxy object. 158 * @param data Indicates the data to be read. 159 * @param reply Indicates the reply to be sent; 160 * @return Returns true if called successfully; returns false otherwise. 161 */ 162 bool HandleSetDirApl(MessageParcel &data, MessageParcel &reply); 163 164 /** 165 * @brief Handles the set dir apl function called from a IInstalld proxy object. 166 * @param data Indicates the data to be read. 167 * @param reply Indicates the reply to be sent; 168 * @return Returns true if called successfully; returns false otherwise. 169 */ 170 bool HandleSetArkStartupCacheApl(MessageParcel &data, MessageParcel &reply); 171 172 /** 173 * @brief Handles the all GetBundleCachePath function. 174 * @param data Indicates the data to be read. 175 * @param reply Indicates the reply to be sent; 176 * @return Returns true if called successfully; returns false otherwise. 177 */ 178 bool HandleGetBundleCachePath(MessageParcel &data, MessageParcel &reply); 179 180 bool HandleScanDir(MessageParcel &data, MessageParcel &reply); 181 182 bool HandleMoveFile(MessageParcel &data, MessageParcel &reply); 183 184 bool HandleCopyFile(MessageParcel &data, MessageParcel &reply); 185 186 bool HandleMkdir(MessageParcel &data, MessageParcel &reply); 187 188 bool HandleGetFileStat(MessageParcel &data, MessageParcel &reply); 189 190 bool HandleChangeFileStat(MessageParcel &data, MessageParcel &reply); 191 192 bool HandleExtractDiffFiles(MessageParcel &data, MessageParcel &reply); 193 194 bool HandleApplyDiffPatch(MessageParcel &data, MessageParcel &reply); 195 196 bool HandleIsExistDir(MessageParcel &data, MessageParcel &reply); 197 198 bool HandleIsExistFile(MessageParcel &data, MessageParcel &reply); 199 200 bool HandleIsExistApFile(MessageParcel &data, MessageParcel &reply); 201 202 bool HandleIsDirEmpty(MessageParcel &data, MessageParcel &reply); 203 204 bool HandObtainQuickFixFileDir(MessageParcel &data, MessageParcel &reply); 205 206 bool HandCopyFiles(MessageParcel &data, MessageParcel &reply); 207 208 bool HandGetNativeLibraryFileNames(MessageParcel &data, MessageParcel &reply); 209 210 bool HandVerifyCodeSignature(MessageParcel &data, MessageParcel &reply); 211 212 bool HandleCheckEncryption(MessageParcel &data, MessageParcel &reply); 213 214 bool HandMoveFiles(MessageParcel &data, MessageParcel &reply); 215 216 bool HandExtractDriverSoFiles(MessageParcel &data, MessageParcel &reply); 217 218 bool HandExtractEncryptedSoFiles(MessageParcel &data, MessageParcel &reply); 219 220 bool HandVerifyCodeSignatureForHap(MessageParcel &data, MessageParcel &reply); 221 222 bool HandDeliverySignProfile(MessageParcel &data, MessageParcel &reply); 223 224 bool HandRemoveSignProfile(MessageParcel &data, MessageParcel &reply); 225 226 bool HandleSetEncryptionDir(MessageParcel &data, MessageParcel &reply); 227 228 bool HandleDeleteEncryptionKeyId(MessageParcel &data, MessageParcel &reply); 229 230 bool HandleRemoveExtensionDir(MessageParcel &data, MessageParcel &reply); 231 232 bool HandleIsExistExtensionDir(MessageParcel &data, MessageParcel &reply); 233 234 bool HandleCreateExtensionDataDir(MessageParcel &data, MessageParcel &reply); 235 236 bool HandleGetExtensionSandboxTypeList(MessageParcel &data, MessageParcel &reply); 237 238 bool HandleAddUserDirDeleteDfx(MessageParcel &data, MessageParcel &reply); 239 240 bool HandleMoveHapToCodeDir(MessageParcel &data, MessageParcel &reply); 241 242 bool HandleMigrateData(MessageParcel &data, MessageParcel &reply); 243 244 bool HandleCreateDataGroupDirs(MessageParcel &data, MessageParcel &reply); 245 246 bool HandleDeleteDataGroupDirs(MessageParcel &data, MessageParcel &reply); 247 248 bool HandleLoadInstalls(MessageParcel &data, MessageParcel &reply); 249 250 bool HandleClearDir(MessageParcel &data, MessageParcel &reply); 251 252 CriticalManager criticalManager_; 253 254 bool HandleRestoreconPath(MessageParcel &data, MessageParcel &reply); 255 }; 256 } // namespace AppExecFwk 257 } // namespace OHOS 258 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_IPC_INSTALLD_HOST_H