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 OHOS_ABILITY_MANAGER_ACCESS_PROXY_H 17 #define OHOS_ABILITY_MANAGER_ACCESS_PROXY_H 18 19 #include <iremote_proxy.h> 20 21 #include "service_ipc_interface_code.h" 22 #include "want.h" 23 24 namespace OHOS { 25 namespace Security { 26 namespace AccessToken { 27 const int DEFAULT_INVAL_VALUE = -1; 28 class IAbilityManager : public IRemoteBroker { 29 public: 30 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.AbilityManager") 31 32 virtual int StartAbility(const AAFwk::Want &want, const sptr<IRemoteObject> &callerToken, 33 int requestCode = DEFAULT_INVAL_VALUE, int32_t userId = DEFAULT_INVAL_VALUE) = 0; 34 }; 35 36 class AbilityManagerAccessProxy : public IRemoteProxy<IAbilityManager> { 37 public: AbilityManagerAccessProxy(const sptr<IRemoteObject> & impl)38 explicit AbilityManagerAccessProxy(const sptr<IRemoteObject>& impl) : IRemoteProxy<IAbilityManager>(impl) {} 39 ~AbilityManagerAccessProxy()40 ~AbilityManagerAccessProxy() {} 41 int StartAbility(const AAFwk::Want &want, const sptr<IRemoteObject> &callerToken, 42 int requestCode = DEFAULT_INVAL_VALUE, int32_t userId = DEFAULT_INVAL_VALUE) override; 43 44 private: 45 static inline BrokerDelegator<AbilityManagerAccessProxy> delegator_; 46 }; 47 } 48 } 49 } 50 #endif // OHOS_ABILITY_MANAGER_ACCESS_PROXY_H 51