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)22AbilityRunningRecord::AbilityRunningRecord(const std::shared_ptr<AbilityInfo> &info, const sptr<IRemoteObject> &token) 23 : info_(info), token_(token) 24 {} 25 ~AbilityRunningRecord()26AbilityRunningRecord::~AbilityRunningRecord() 27 {} 28 GetName() const29const std::string &AbilityRunningRecord::GetName() const 30 { 31 return info_->name; 32 } 33 GetAbilityInfo() const34const std::shared_ptr<AbilityInfo> &AbilityRunningRecord::GetAbilityInfo() const 35 { 36 return info_; 37 } 38 GetToken() const39const sptr<IRemoteObject> &AbilityRunningRecord::GetToken() const 40 { 41 return token_; 42 } 43 SetState(const AbilityState state)44void AbilityRunningRecord::SetState(const AbilityState state) 45 { 46 state_ = state; 47 } 48 GetState() const49AbilityState AbilityRunningRecord::GetState() const 50 { 51 return state_; 52 } 53 IsSameState(const AbilityState state) const54bool AbilityRunningRecord::IsSameState(const AbilityState state) const 55 { 56 return state_ == state; 57 } 58 GetLastLaunchTime() const59int32_t AbilityRunningRecord::GetLastLaunchTime() const 60 { 61 return lastLaunchTime_; 62 } 63 GetPreToken() const64const sptr<IRemoteObject> AbilityRunningRecord::GetPreToken() const 65 { 66 return preToken_; 67 } 68 SetPreToken(const sptr<IRemoteObject> & preToken)69void AbilityRunningRecord::SetPreToken(const sptr<IRemoteObject> &preToken) 70 { 71 preToken_ = preToken; 72 } 73 SetVisibility(const int32_t visibility)74void AbilityRunningRecord::SetVisibility(const int32_t visibility) 75 { 76 visibility_ = visibility; 77 } 78 GetVisibility() const79int32_t AbilityRunningRecord::GetVisibility() const 80 { 81 return visibility_; 82 } 83 SetPerceptibility(const int32_t perceptibility)84void AbilityRunningRecord::SetPerceptibility(const int32_t perceptibility) 85 { 86 perceptibility_ = perceptibility; 87 } 88 GetPerceptibility() const89int32_t AbilityRunningRecord::GetPerceptibility() const 90 { 91 return perceptibility_; 92 } 93 SetConnectionState(const int32_t connectionState)94void AbilityRunningRecord::SetConnectionState(const int32_t connectionState) 95 { 96 connectionState_ = connectionState; 97 } 98 GetConnectionState() const99int32_t AbilityRunningRecord::GetConnectionState() const 100 { 101 return connectionState_; 102 } 103 SetEventId(const int64_t eventId)104void AbilityRunningRecord::SetEventId(const int64_t eventId) 105 { 106 eventId_ = eventId; 107 } 108 GetEventId() const109int64_t AbilityRunningRecord::GetEventId() const 110 { 111 return eventId_; 112 } 113 } // namespace AppExecFwk 114 } // namespace OHOS 115