• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 "ability_local_record.h"
17 
18 #include "ability_thread.h"
19 
20 namespace OHOS {
21 namespace AppExecFwk {
22 namespace {
23 constexpr const char* IS_HOOK = "ohos.ability_runtime.is_hook";
24 }
AbilityLocalRecord(const std::shared_ptr<AbilityInfo> & info,const sptr<IRemoteObject> & token,const std::shared_ptr<AAFwk::Want> & want,int32_t abilityRecordId)25 AbilityLocalRecord::AbilityLocalRecord(const std::shared_ptr<AbilityInfo> &info, const sptr<IRemoteObject> &token,
26     const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId)
27     : abilityInfo_(info), token_(token), want_(want), abilityRecordId_(abilityRecordId) {}
28 
~AbilityLocalRecord()29 AbilityLocalRecord::~AbilityLocalRecord() {}
30 
GetAbilityInfo()31 const std::shared_ptr<AbilityInfo> &AbilityLocalRecord::GetAbilityInfo()
32 {
33     return abilityInfo_;
34 }
35 
GetToken()36 const sptr<IRemoteObject> &AbilityLocalRecord::GetToken()
37 {
38     return token_;
39 }
40 
GetAbilityRecordId() const41 int32_t AbilityLocalRecord::GetAbilityRecordId() const
42 {
43     return abilityRecordId_;
44 }
45 
GetAbilityThread()46 const sptr<AbilityThread> &AbilityLocalRecord::GetAbilityThread()
47 {
48     return abilityThread_;
49 }
50 
SetAbilityThread(const sptr<AbilityThread> & abilityThread)51 void AbilityLocalRecord::SetAbilityThread(const sptr<AbilityThread> &abilityThread)
52 {
53     abilityThread_ = abilityThread;
54 }
55 
GetWant()56 const std::shared_ptr<AAFwk::Want> &AbilityLocalRecord::GetWant()
57 {
58     return want_;
59 }
60 
IsHook() const61 bool AbilityLocalRecord::IsHook() const
62 {
63     return want_ && want_->GetBoolParam(IS_HOOK, false);
64 }
65 }  // namespace AppExecFwk
66 }  // namespace OHOS
67