/* * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_AAFWK_PENDING_WANT_RECORD_H #define OHOS_AAFWK_PENDING_WANT_RECORD_H #include #include #include "iremote_object.h" #include "refbase.h" #include "ability_record.h" #include "want_sender_stub.h" #include "sender_info.h" #include "pending_want_key.h" namespace OHOS { namespace AAFwk { class PendingWantManager; class PendingWantRecord : public WantSenderStub { public: static const int START_CANCELED = -96; PendingWantRecord(); PendingWantRecord(const std::shared_ptr &pendingWantManager, int32_t uid, const sptr &callerToken, std::shared_ptr key); virtual ~PendingWantRecord(); virtual void Send(SenderInfo &senderInfo); virtual void RegisterCancelListener(const sptr &receiver); virtual void UnregisterCancelListener(const sptr &receiver); virtual int32_t SenderInner(SenderInfo &senderInfo); public: std::shared_ptr GetKey(); int32_t GetUid() const; void SetCallerUid(const int32_t callerUid); void SetCanceled(); bool GetCanceled(); std::list> GetCancelCallbacks(); private: std::weak_ptr pendingWantManager_ = {}; int32_t uid_ = 0; int32_t callerUid_ = 0; sptr callerToken_ = {}; bool canceled_ = false; std::shared_ptr key_ = {}; std::list> mCancelCallbacks_ = {}; std::recursive_mutex lock_ = {}; }; } // namespace AAFwk } // namespace OHOS #endif // OHOS_AAFWK_PENDING_WANT_RECORD_H