1 /* 2 * Copyright (c) 2025 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 #ifndef OHOS_ABILITY_RUNTIME_LOCAL_PENDING_WANT_H 17 #define OHOS_ABILITY_RUNTIME_LOCAL_PENDING_WANT_H 18 19 #include <memory> 20 #include <string> 21 #include "completed_dispatcher.h" 22 #include "trigger_info.h" 23 #include "want.h" 24 25 namespace OHOS::AbilityRuntime::WantAgent { 26 class LocalPendingWant final : public std::enable_shared_from_this<LocalPendingWant>, public Parcelable { 27 public: 28 LocalPendingWant(const std::string &bundleName, const std::shared_ptr<AAFwk::Want> &want, 29 int32_t operType); 30 31 std::string GetBundleName() const; 32 33 void SetBundleName(const std::string &bundleName); 34 35 int32_t GetUid() const; 36 37 void SetUid(int32_t uid); 38 39 int32_t GetType() const; 40 41 void SetType(int32_t operType); 42 43 std::shared_ptr<AAFwk::Want> GetWant() const; 44 45 void SetWant(const std::shared_ptr<AAFwk::Want> &want); 46 47 int32_t GetHashCode() const; 48 49 void SetHashCode(int32_t hashCode); 50 51 uint32_t GetTokenId() const; 52 53 void SetTokenId(uint32_t tokenId); 54 55 virtual bool Marshalling(Parcel &parcel) const; 56 57 static LocalPendingWant *Unmarshalling(Parcel &parcel); 58 59 ErrCode Send(const sptr<CompletedDispatcher> &callBack, const TriggerInfo &triggerInfo, 60 sptr<IRemoteObject> callerToken); 61 62 static ErrCode IsEquals(const std::shared_ptr<LocalPendingWant> &localPendingWant, 63 const std::shared_ptr<LocalPendingWant> &otherLocalPendingWant); 64 65 private: 66 std::string bundleName_; 67 int32_t uid_ = -1; 68 int32_t hashCode_ = -1; 69 AAFwk::Want want_; 70 int32_t operType_ = -1; 71 uint32_t tokenId_ = 0; 72 }; 73 } 74 75 #endif /* OHOS_ABILITY_RUNTIME_LOCAL_PENDING_WANT_H */