1 /* 2 * Copyright (c) 2022 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_SESSION_CONTAINER_H 17 #define OHOS_SESSION_CONTAINER_H 18 19 #include <string> 20 #include <vector> 21 22 #include "avsession_item.h" 23 24 namespace OHOS::AVSession { 25 class SessionContainer { 26 public: 27 virtual int32_t AddSession(pid_t pid, const std::string& abilityName, sptr<AVSessionItem>& item) = 0; 28 29 virtual std::vector<sptr<AVSessionItem>> RemoveSession(pid_t pid) = 0; 30 31 virtual sptr<AVSessionItem> RemoveSession(pid_t pid, const std::string& abilityName) = 0; 32 33 virtual sptr<AVSessionItem> RemoveSession(const std::string& sessionId) = 0; 34 35 virtual sptr<AVSessionItem> GetSession(pid_t pid, const std::string& abilityName) = 0; 36 37 virtual std::vector<sptr<AVSessionItem>> GetSessionsByPid(pid_t pid) = 0; 38 39 virtual bool PidHasSession(pid_t pid) = 0; 40 41 virtual sptr<AVSessionItem> GetSessionById(const std::string& sessionId) = 0; 42 43 virtual std::vector<sptr<AVSessionItem>> GetAllSessions() = 0; 44 45 virtual void UpdateSessionSort(sptr<AVSessionItem>& item); 46 47 virtual bool IsEmpty(); 48 49 virtual int32_t getAllSessionNum(); 50 51 virtual ~SessionContainer() = default; 52 53 static constexpr int32_t SESSION_NUM_MAX = 50; 54 }; 55 } // namespace OHOS::AVSession 56 #endif // OHOS_SESSION_CONTAINER_H