1/*
2 * Copyright (c) 2022 Chipsea Technologies (Shenzhen) Corp., 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 PERMISSION_UTIL_H
17#define PERMISSION_UTIL_H
18
19#include <string>
20#include <unordered_map>
21
22#include "access_token.h"
23#include "singleton.h"
24
25namespace OHOS {
26namespace Sensors {
27using namespace Security::AccessToken;
28class PermissionUtil : public Singleton<PermissionUtil> {
29public:
30    PermissionUtil() = default;
31    virtual ~PermissionUtil() {};
32    int32_t CheckSensorPermission(AccessTokenID callerToken, int32_t sensorTypeId);
33
34private:
35    void AddPermissionRecord(AccessTokenID tokenID, const std::string& permissionName, bool status);
36    static std::unordered_map<uint32_t, std::string> sensorPermissions_;
37};
38}  // namespace Sensors
39}  // namespace OHOS
40#endif  // PERMISSION_UTIL_H
41