• 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 
GetToken() const39 const sptr<IRemoteObject> &AbilityRunningRecord::GetToken() const
40 {
41     return token_;
42 }
43 
SetState(const AbilityState state)44 void AbilityRunningRecord::SetState(const AbilityState state)
45 {
46     state_ = state;
47 }
48 
GetState() const49 AbilityState AbilityRunningRecord::GetState() const
50 {
51     return state_;
52 }
53 
IsSameState(const AbilityState state) const54 bool AbilityRunningRecord::IsSameState(const AbilityState state) const
55 {
56     return state_ == state;
57 }
58 
GetLastLaunchTime() const59 int32_t AbilityRunningRecord::GetLastLaunchTime() const
60 {
61     return lastLaunchTime_;
62 }
63 
GetPreToken() const64 const sptr<IRemoteObject> AbilityRunningRecord::GetPreToken() const
65 {
66     return preToken_;
67 }
68 
SetPreToken(const sptr<IRemoteObject> & preToken)69 void AbilityRunningRecord::SetPreToken(const sptr<IRemoteObject> &preToken)
70 {
71     preToken_ = preToken;
72 }
73 
SetVisibility(const int32_t visibility)74 void AbilityRunningRecord::SetVisibility(const int32_t visibility)
75 {
76     visibility_ = visibility;
77 }
78 
GetVisibility() const79 int32_t AbilityRunningRecord::GetVisibility() const
80 {
81     return visibility_;
82 }
83 
SetPerceptibility(const int32_t perceptibility)84 void AbilityRunningRecord::SetPerceptibility(const int32_t perceptibility)
85 {
86     perceptibility_ = perceptibility;
87 }
88 
GetPerceptibility() const89 int32_t AbilityRunningRecord::GetPerceptibility() const
90 {
91     return perceptibility_;
92 }
93 
SetConnectionState(const int32_t connectionState)94 void AbilityRunningRecord::SetConnectionState(const int32_t connectionState)
95 {
96     connectionState_ = connectionState;
97 }
98 
GetConnectionState() const99 int32_t AbilityRunningRecord::GetConnectionState() const
100 {
101     return connectionState_;
102 }
103 
SetEventId(const int64_t eventId)104 void AbilityRunningRecord::SetEventId(const int64_t eventId)
105 {
106     eventId_ = eventId;
107 }
108 
GetEventId() const109 int64_t AbilityRunningRecord::GetEventId() const
110 {
111     return eventId_;
112 }
113 }  // namespace AppExecFwk
114 }  // namespace OHOS
115