122736c2fSopenharmony_ci/* 222736c2fSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd. 322736c2fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 422736c2fSopenharmony_ci * you may not use this file except in compliance with the License. 522736c2fSopenharmony_ci * You may obtain a copy of the License at 622736c2fSopenharmony_ci * 722736c2fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 822736c2fSopenharmony_ci * 922736c2fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1022736c2fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1122736c2fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1222736c2fSopenharmony_ci * See the License for the specific language governing permissions and 1322736c2fSopenharmony_ci * limitations under the License. 1422736c2fSopenharmony_ci */ 1522736c2fSopenharmony_ci 1622736c2fSopenharmony_ci#ifndef SERVICES_INCLUDE_IDENTITY_CHECKER_H 1722736c2fSopenharmony_ci#define SERVICES_INCLUDE_IDENTITY_CHECKER_H 1822736c2fSopenharmony_ci 1922736c2fSopenharmony_ci#include <string> 2022736c2fSopenharmony_ci 2122736c2fSopenharmony_ci#include "access_token.h" 2222736c2fSopenharmony_cinamespace OHOS { 2322736c2fSopenharmony_cinamespace MiscServices { 2422736c2fSopenharmony_ciclass IdentityChecker { 2522736c2fSopenharmony_cipublic: 2622736c2fSopenharmony_ci static constexpr int64_t INVALID_PID = -1; 2722736c2fSopenharmony_ci virtual ~IdentityChecker() = default; 2822736c2fSopenharmony_ci virtual bool IsFocused(int64_t callingPid, uint32_t callingTokenId, int64_t focusedPid = INVALID_PID) = 0; 2922736c2fSopenharmony_ci virtual bool IsSystemApp(uint64_t fullTokenId) = 0; 3022736c2fSopenharmony_ci virtual bool IsBundleNameValid(uint32_t tokenId, const std::string &validBundleName) = 0; 3122736c2fSopenharmony_ci virtual bool HasPermission(uint32_t tokenId, const std::string &permission) = 0; 3222736c2fSopenharmony_ci virtual bool IsBroker(Security::AccessToken::AccessTokenID tokenId) = 0; 3322736c2fSopenharmony_ci virtual bool IsNativeSa(Security::AccessToken::AccessTokenID tokenId) = 0; 3422736c2fSopenharmony_ci virtual std::string GetBundleNameByToken(uint32_t tokenId); 3522736c2fSopenharmony_ci virtual bool IsFocusedUIExtension(uint32_t callingTokenId) 3622736c2fSopenharmony_ci { 3722736c2fSopenharmony_ci return false; 3822736c2fSopenharmony_ci }; 3922736c2fSopenharmony_ci}; 4022736c2fSopenharmony_ci} // namespace MiscServices 4122736c2fSopenharmony_ci} // namespace OHOS 4222736c2fSopenharmony_ci 4322736c2fSopenharmony_ci#endif // SERVICES_INCLUDE_IDENTITY_CHECKER_H 44