• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_running_record.h"
17 
18 #include "iremote_object.h"
19 
20 namespace OHOS {
21 namespace AppExecFwk {
AbilityRunningRecord(const std::shared_ptr<AbilityInfo> & info,const sptr<IRemoteObject> & token)22 AbilityRunningRecord::AbilityRunningRecord(const std::shared_ptr<AbilityInfo> &info, const sptr<IRemoteObject> &token)
23     : info_(info), token_(token)
24 {}
25 
~AbilityRunningRecord()26 AbilityRunningRecord::~AbilityRunningRecord()
27 {}
28 
GetName() const29 const std::string &AbilityRunningRecord::GetName() const
30 {
31     return info_->name;
32 }
33 
GetAbilityInfo() const34 const std::shared_ptr<AbilityInfo> &AbilityRunningRecord::GetAbilityInfo() const
35 {
36     return info_;
37 }
38 
GetWant() const39 const std::shared_ptr<AAFwk::Want> &AbilityRunningRecord::GetWant() const
40 {
41     return want_;
42 }
43 
SetWant(const std::shared_ptr<AAFwk::Want> & want)44 void AbilityRunningRecord::SetWant(const std::shared_ptr<AAFwk::Want> &want)
45 {
46     want_ = want;
47 }
48 
GetToken() const49 const sptr<IRemoteObject> &AbilityRunningRecord::GetToken() const
50 {
51     return token_;
52 }
53 
SetState(const AbilityState state)54 void AbilityRunningRecord::SetState(const AbilityState state)
55 {
56     state_ = state;
57 }
58 
GetState() const59 AbilityState AbilityRunningRecord::GetState() const
60 {
61     return state_;
62 }
63 
IsSameState(const AbilityState state) const64 bool AbilityRunningRecord::IsSameState(const AbilityState state) const
65 {
66     return state_ == state;
67 }
68 
GetLastLaunchTime() const69 int32_t AbilityRunningRecord::GetLastLaunchTime() const
70 {
71     return lastLaunchTime_;
72 }
73 
GetPreToken() const74 const sptr<IRemoteObject> AbilityRunningRecord::GetPreToken() const
75 {
76     return preToken_;
77 }
78 
SetPreToken(const sptr<IRemoteObject> & preToken)79 void AbilityRunningRecord::SetPreToken(const sptr<IRemoteObject> &preToken)
80 {
81     preToken_ = preToken;
82 }
83 
SetVisibility(const int32_t visibility)84 void AbilityRunningRecord::SetVisibility(const int32_t visibility)
85 {
86     visibility_ = visibility;
87 }
88 
GetVisibility() const89 int32_t AbilityRunningRecord::GetVisibility() const
90 {
91     return visibility_;
92 }
93 
SetPerceptibility(const int32_t perceptibility)94 void AbilityRunningRecord::SetPerceptibility(const int32_t perceptibility)
95 {
96     perceptibility_ = perceptibility;
97 }
98 
GetPerceptibility() const99 int32_t AbilityRunningRecord::GetPerceptibility() const
100 {
101     return perceptibility_;
102 }
103 
SetConnectionState(const int32_t connectionState)104 void AbilityRunningRecord::SetConnectionState(const int32_t connectionState)
105 {
106     connectionState_ = connectionState;
107 }
108 
GetConnectionState() const109 int32_t AbilityRunningRecord::GetConnectionState() const
110 {
111     return connectionState_;
112 }
113 
SetEventId(const int64_t eventId)114 void AbilityRunningRecord::SetEventId(const int64_t eventId)
115 {
116     eventId_ = eventId;
117 }
118 
GetEventId() const119 int64_t AbilityRunningRecord::GetEventId() const
120 {
121     return eventId_;
122 }
123 
SetTerminating()124 void AbilityRunningRecord::SetTerminating()
125 {
126     isTerminating_ = true;
127 }
128 
IsTerminating() const129 bool AbilityRunningRecord::IsTerminating() const
130 {
131     return isTerminating_;
132 }
133 
SetOwnerUserId(int32_t ownerUserId)134 void AbilityRunningRecord::SetOwnerUserId(int32_t ownerUserId)
135 {
136     ownerUserId_ = ownerUserId;
137 }
138 
GetOwnerUserId() const139 int32_t AbilityRunningRecord::GetOwnerUserId() const
140 {
141     return ownerUserId_;
142 }
143 
SetIsSingleUser(bool flag)144 void AbilityRunningRecord::SetIsSingleUser(bool flag)
145 {
146     isSingleUser_ = flag;
147 }
148 
IsSingleUser() const149 bool AbilityRunningRecord::IsSingleUser() const
150 {
151     return isSingleUser_;
152 }
153 }  // namespace AppExecFwk
154 }  // namespace OHOS
155