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 #ifndef FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_FREE_INSTALL_FREE_INSTALL_PARAMS_H 17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_FREE_INSTALL_FREE_INSTALL_PARAMS_H 18 19 #include <string> 20 21 #include "iremote_object.h" 22 #include "want.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 namespace { 27 const std::u16string ATOMIC_SERVICE_STATUS_CALLBACK_TOKEN = u"ohos.IAtomicServiceStatusCallback"; 28 const std::u16string SERVICE_CENTER_TOKEN = u"abilitydispatcherhm.openapi.hapinstall.IHapInstall"; 29 const std::u16string SEEVICE_CENTER_CALLBACK_TOKEN = u"abilitydispatcherhm.openapi.hapinstall.IHapInstallCallback"; 30 constexpr uint32_t FREE_INSTALL_DONE = 0; 31 }; 32 33 enum UpgradeFlag { 34 NOT_UPGRADE = 0, 35 SINGLE_UPGRADE = 1, 36 RELATION_UPGRADE = 2, 37 }; 38 39 enum FreeInstallErrorCode { 40 CONNECT_ERROR = 0x820101, 41 SERVICE_CENTER_CRASH = 0x820102, 42 SERVICE_CENTER_TIMEOUT = 0x820103, 43 UNDEFINED_ERROR = 0x820104, 44 }; 45 46 enum ServiceCenterFunction { 47 CONNECT_DISPATCHER_INFO = 1, 48 CONNECT_SILENT_INSTALL = 2, 49 CONNECT_UPGRADE_CHECK = 3, 50 CONNECT_UPGRADE_INSTALL = 4, 51 CONNECT_QUERY_RPCID = 5, 52 CONNECT_PRELOAD_INSTALL = 6, 53 }; 54 55 enum ServiceCenterResultCode { 56 FREE_INSTALL_OK = 0, 57 FREE_INSTALL_DOWNLOADING = 1, 58 }; 59 60 enum ServiceCenterConnectState { 61 CONNECTED = 0, 62 CONNECTING = 1, 63 DISCONNECTED = 2, 64 }; 65 66 struct FreeInstallParams : public virtual RefBase { 67 sptr<IRemoteObject> callback; 68 OHOS::AAFwk::Want want; 69 int32_t userId; 70 ServiceCenterFunction serviceCenterFunction; 71 }; 72 } // namespace AppExecFwk 73 } // namespace OHOS 74 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_FREE_INSTALL_FREE_INSTALL_PARAMS_H 75