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