1 /* 2 * Copyright (c) 2021 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 "system_bundle_installer.h" 17 18 #include "app_log_wrapper.h" 19 20 namespace OHOS { 21 namespace AppExecFwk { 22 SystemBundleInstaller(const std::string & filePath)23SystemBundleInstaller::SystemBundleInstaller(const std::string &filePath) : filePath_(filePath) 24 { 25 APP_LOGI("system bundle installer instance is created"); 26 } 27 ~SystemBundleInstaller()28SystemBundleInstaller::~SystemBundleInstaller() 29 { 30 APP_LOGI("system bundle installer instance is destroyed"); 31 } 32 InstallSystemBundle(Constants::AppType appType)33bool SystemBundleInstaller::InstallSystemBundle(Constants::AppType appType) 34 { 35 InstallParam installParam; 36 installParam.userId = Constants::DEFAULT_USERID; 37 ErrCode result = InstallBundle(filePath_, installParam, appType); 38 if (result != ERR_OK) { 39 APP_LOGE("install system bundle fail, error: %{public}d", result); 40 return false; 41 } 42 return true; 43 } 44 45 } // namespace AppExecFwk 46 } // namespace OHOS 47