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 MOCK_OHOS_ABILITY_RUNTIME_MOCK_APP_CONTROL_MANAGER_H 17 #define MOCK_OHOS_ABILITY_RUNTIME_MOCK_APP_CONTROL_MANAGER_H 18 19 #include "want.h" 20 #include <gmock/gmock.h> 21 #include "foundation/bundlemanager/bundle_framework/interfaces/inner_api/appexecfwk_core/include/app_control/app_control_interface.h" 22 #include "iremote_proxy.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 namespace { 27 const int32_t UNSPECIFIED_USER_ID = -2; 28 } 29 class AppControlProxy : public IRemoteProxy<IAppControlMgr> { 30 public: 31 using Want = OHOS::AAFwk::Want; 32 33 explicit AppControlProxy(const sptr<IRemoteObject>& object); 34 virtual ~AppControlProxy(); 35 36 // for app install control rule 37 virtual ErrCode AddAppInstallControlRule(const std::vector<std::string>& appIds, 38 const AppInstallControlRuleType controlRuleType, int32_t userId) override; 39 virtual ErrCode DeleteAppInstallControlRule(const AppInstallControlRuleType controlRuleType, 40 const std::vector<std::string>& appIds, int32_t userId) override; 41 virtual ErrCode DeleteAppInstallControlRule( 42 const AppInstallControlRuleType controlRuleType, int32_t userId) override; 43 virtual ErrCode GetAppInstallControlRule( 44 const AppInstallControlRuleType controlRuleType, int32_t userId, std::vector<std::string>& appIds) override; 45 // for app running control rule 46 virtual ErrCode AddAppRunningControlRule( 47 const std::vector<AppRunningControlRule>& controlRule, int32_t userId) override; 48 virtual ErrCode DeleteAppRunningControlRule( 49 const std::vector<AppRunningControlRule>& controlRule, int32_t userId) override; 50 virtual ErrCode DeleteAppRunningControlRule(int32_t userId) override; 51 virtual ErrCode GetAppRunningControlRule(int32_t userId, std::vector<std::string>& appIds) override; 52 virtual ErrCode GetAppRunningControlRule( 53 const std::string& bundleName, int32_t userId, AppRunningControlRuleResult& controlRuleResult) override; 54 55 virtual ErrCode GetAbilityRunningControlRule(const std::string &bundleName, int32_t userId, 56 std::vector<DisposedRule> &disposedRuleList, int32_t appIndex = 0) override; 57 58 virtual ErrCode ConfirmAppJumpControlRule(const std::string &callerBundleName, const std::string &targetBundleName, 59 int32_t userId) override; 60 virtual ErrCode AddAppJumpControlRule(const std::vector<AppJumpControlRule> &controlRules, int32_t userId) override; 61 virtual ErrCode DeleteAppJumpControlRule(const std::vector<AppJumpControlRule> &controlRules, 62 int32_t userId) override; 63 virtual ErrCode DeleteRuleByCallerBundleName(const std::string &callerBundleName, int32_t userId) override; 64 virtual ErrCode DeleteRuleByTargetBundleName(const std::string &targetBundleName, int32_t userId) override; 65 virtual ErrCode GetAppJumpControlRule(const std::string &callerBundleName, const std::string &targetBundleName, 66 int32_t userId, AppJumpControlRule &controlRule) override; 67 68 virtual ErrCode SetDisposedStatus( 69 const std::string& appId, const Want& want, int32_t userId = UNSPECIFIED_USER_ID) override; 70 virtual ErrCode DeleteDisposedStatus( 71 const std::string& appId, int32_t userId = UNSPECIFIED_USER_ID) override; 72 virtual ErrCode GetDisposedStatus( 73 const std::string& appId, Want& want, int32_t userId = UNSPECIFIED_USER_ID) override; 74 }; 75 } // namespace AppExecFwk 76 } // namespace OHOS 77 78 #endif // MOCK_OHOS_ABILITY_RUNTIME_MOCK_APP_CONTROL_MANAGER_H 79