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 "pending_want_key.h" 17 18namespace OHOS { 19namespace AAFwk { 20void PendingWantKey::SetType(const int32_t type) 21{ 22 type_ = type; 23} 24 25void PendingWantKey::SetBundleName(const std::string &bundleName) 26{ 27 bundleName_ = bundleName; 28} 29 30void PendingWantKey::SetRequestWho(const std::string &requestWho) 31{ 32 requestWho_ = requestWho; 33} 34 35void PendingWantKey::SetRequestCode(int32_t requestCode) 36{ 37 requestCode_ = requestCode; 38} 39 40void PendingWantKey::SetRequestWant(const Want &requestWant) 41{ 42 std::lock_guard<std::mutex> lock(requestWantMutex_); 43 requestWant_ = requestWant; 44} 45 46void PendingWantKey::SetRequestResolvedType(const std::string &requestResolvedType) 47{ 48 requestResolvedType_ = requestResolvedType; 49} 50 51void PendingWantKey::SetAllWantsInfos(const std::vector<WantsInfo> &allWantsInfos) 52{ 53 std::lock_guard<std::mutex> lock(wantsInfosMutex_); 54 allWantsInfos_ = allWantsInfos; 55} 56 57void PendingWantKey::SetFlags(int32_t flags) 58{ 59 flags_ = flags; 60} 61 62void PendingWantKey::SetCode(int32_t code) 63{ 64 code_ = code; 65} 66 67void PendingWantKey::SetUserId(int32_t userId) 68{ 69 userId_ = userId; 70} 71 72void PendingWantKey::SetAppIndex(int32_t appIndex) 73{ 74 appIndex_ = appIndex; 75} 76 77int32_t PendingWantKey::GetType() 78{ 79 return type_; 80} 81 82std::string PendingWantKey::GetBundleName() 83{ 84 return bundleName_; 85} 86 87std::string PendingWantKey::GetRequestWho() 88{ 89 return requestWho_; 90} 91 92int32_t PendingWantKey::GetRequestCode() 93{ 94 return requestCode_; 95} 96 97Want PendingWantKey::GetRequestWant() 98{ 99 std::lock_guard<std::mutex> lock(requestWantMutex_); 100 return requestWant_; 101} 102 103Want& PendingWantKey::GetRequestWantRef() 104{ 105 std::lock_guard<std::mutex> lock(requestWantMutex_); 106 return requestWant_; 107} 108 109std::string PendingWantKey::GetRequestResolvedType() 110{ 111 return requestResolvedType_; 112} 113 114std::vector<WantsInfo> PendingWantKey::GetAllWantsInfos() 115{ 116 std::lock_guard<std::mutex> lock(wantsInfosMutex_); 117 return allWantsInfos_; 118} 119 120int32_t PendingWantKey::GetFlags() 121{ 122 return flags_; 123} 124 125int32_t PendingWantKey::GetCode() 126{ 127 return code_; 128} 129 130int32_t PendingWantKey::GetUserId() 131{ 132 return userId_; 133} 134 135int32_t PendingWantKey::GetAppIndex() 136{ 137 return appIndex_; 138} 139 140bool PendingWantKey::IsEqualsRequestWant(const Want &otherWant) 141{ 142 std::lock_guard<std::mutex> lock(requestWantMutex_); 143 return requestWant_.IsEquals(otherWant); 144} 145} // namespace AAFwk 146} // namespace OHOS 147