1 /* 2 * Copyright (c) 2024 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 * Description: add permission utils 15 * Author: zhangge 16 * Create: 2023-05-11 17 */ 18 19 #ifndef CAST_SERVICE_PERMISSION_H 20 #define CAST_SERVICE_PERMISSION_H 21 22 #include "cast_engine_common.h" 23 #include <vector> 24 #include <mutex> 25 #include "ipc_skeleton.h" 26 27 namespace OHOS { 28 namespace CastEngine { 29 namespace CastEngineService { 30 class Permission { 31 public: 32 static bool CheckMirrorPermission(); 33 static bool CheckStreamPermission(); 34 static bool CheckPidPermission(); 35 static void SavePid(pid_t pid); 36 static void RemovePid(pid_t pid); 37 static void ClearPids(); 38 static void SaveMirrorAppInfo(std::tuple<int32_t, uint32_t, int32_t> appInfo); 39 static std::tuple<int32_t, uint32_t, int32_t> GetMirrorAppInfo(); 40 41 private: 42 static std::mutex pidLock_; 43 static std::vector<pid_t> pids_; 44 static int32_t appUid_; 45 static uint32_t appTokenId_; 46 static int32_t appPid_; 47 }; 48 } // namespace CastEngineService 49 } // namespace CastEngine 50 } // namespace OHOS 51 52 #endif