1 /* 2 * Copyright (c) 2020 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_CONNECT_TRANS_PARAM_H 17 #define OHOS_ABILITY_CONNECT_TRANS_PARAM_H 18 19 #include <sched.h> 20 #include <stdlib.h> 21 22 #include "ipc_skeleton.h" 23 #include "want.h" 24 25 namespace OHOS { 26 class AbilityConnectTransParam { 27 public: AbilityConnectTransParam(Want * want,const SvcIdentity & identity,uint64_t abilityToken)28 AbilityConnectTransParam(Want *want, const SvcIdentity &identity, uint64_t abilityToken) 29 : want_(want), identity_(identity), abilityToken_(abilityToken) {}; 30 31 AbilityConnectTransParam() = delete; ~AbilityConnectTransParam()32 ~AbilityConnectTransParam() 33 { 34 ClearWant(want_); 35 delete want_; 36 }; 37 GetSvcIdentity()38 const SvcIdentity &GetSvcIdentity() const 39 { 40 return identity_; 41 } 42 GetWant()43 const Want *GetWant() const 44 { 45 return want_; 46 } 47 GetToken()48 uint64_t GetToken() const 49 { 50 return abilityToken_; 51 } 52 SetCallingUid(pid_t callingUid)53 void SetCallingUid(pid_t callingUid) 54 { 55 callingUid_ = callingUid; 56 } 57 GetCallingUid()58 pid_t GetCallingUid() const 59 { 60 return callingUid_; 61 } 62 63 private: 64 Want *want_ = { nullptr }; 65 SvcIdentity identity_; 66 uint64_t abilityToken_ = 0; 67 pid_t callingUid_ = -1; 68 }; 69 } // namespace OHOS 70 71 #endif // OHOS_ABILITY_CONNECT_TRANS_PARAM_H 72