1d95e75fdSopenharmony_ci/*
2d95e75fdSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
3d95e75fdSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4d95e75fdSopenharmony_ci * you may not use this file except in compliance with the License.
5d95e75fdSopenharmony_ci * You may obtain a copy of the License at
6d95e75fdSopenharmony_ci *
7d95e75fdSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8d95e75fdSopenharmony_ci *
9d95e75fdSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10d95e75fdSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11d95e75fdSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12d95e75fdSopenharmony_ci * See the License for the specific language governing permissions and
13d95e75fdSopenharmony_ci * limitations under the License.
14d95e75fdSopenharmony_ci */
15d95e75fdSopenharmony_ci
16d95e75fdSopenharmony_ci#include "addcellularcalltoken_fuzzer.h"
17d95e75fdSopenharmony_ci
18d95e75fdSopenharmony_ci#include <iostream>
19d95e75fdSopenharmony_ci
20d95e75fdSopenharmony_ci#include "nativetoken_kit.h"
21d95e75fdSopenharmony_ci#include "token_setproc.h"
22d95e75fdSopenharmony_ci
23d95e75fdSopenharmony_cinamespace OHOS {
24d95e75fdSopenharmony_ciconst int PERMS_NUM = 6;
25d95e75fdSopenharmony_ci
26d95e75fdSopenharmony_ciAddCellularCallTokenFuzzer::AddCellularCallTokenFuzzer()
27d95e75fdSopenharmony_ci{
28d95e75fdSopenharmony_ci    const char *perms[PERMS_NUM] = {
29d95e75fdSopenharmony_ci        "ohos.permission.WRITE_CONTACTS",
30d95e75fdSopenharmony_ci        "ohos.permission.SET_TELEPHONY_STATE",
31d95e75fdSopenharmony_ci        "ohos.permission.GET_TELEPHONY_STATE",
32d95e75fdSopenharmony_ci        "ohos.permission.READ_CONTACTS",
33d95e75fdSopenharmony_ci        "ohos.permission.WRITE_CONTACTS",
34d95e75fdSopenharmony_ci        "ohos.permission.LOCATION",
35d95e75fdSopenharmony_ci    };
36d95e75fdSopenharmony_ci
37d95e75fdSopenharmony_ci    NativeTokenInfoParams testCellularCallInfoParams = {
38d95e75fdSopenharmony_ci        .dcapsNum = 0,
39d95e75fdSopenharmony_ci        .permsNum = PERMS_NUM,
40d95e75fdSopenharmony_ci        .aclsNum = 0,
41d95e75fdSopenharmony_ci        .dcaps = nullptr,
42d95e75fdSopenharmony_ci        .perms = perms,
43d95e75fdSopenharmony_ci        .acls = nullptr,
44d95e75fdSopenharmony_ci        .processName = "cellular_call_fuzzer",
45d95e75fdSopenharmony_ci        .aplStr = "system_basic",
46d95e75fdSopenharmony_ci    };
47d95e75fdSopenharmony_ci    currentID_ = GetAccessTokenId(&testCellularCallInfoParams);
48d95e75fdSopenharmony_ci    SetSelfTokenID(currentID_);
49d95e75fdSopenharmony_ci    Security::AccessToken::AccessTokenKit::ReloadNativeTokenInfo();
50d95e75fdSopenharmony_ci}
51d95e75fdSopenharmony_ciAddCellularCallTokenFuzzer::~AddCellularCallTokenFuzzer() {}
52d95e75fdSopenharmony_ci} // namespace OHOS