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 #include <remote_native_token.h>
17 
18 namespace OHOS {
19 namespace AppExecFwk {
SetNativeToken()20 void RemoteNativeToken::SetNativeToken()
21 {
22     uint64_t tokenId;
23     const char** perms = new const char* [1];
24     perms[0] = "ohos.permission.DISTRIBUTED_DATASYNC"; // system_core
25     NativeTokenInfoParams infoInstance = {
26         .dcapsNum = 0,
27         .permsNum = 1,
28         .aclsNum = 0,
29         .dcaps = nullptr,
30         .perms = perms,
31         .acls = nullptr,
32         .aplStr = "system_basic",
33     };
34 
35     infoInstance.processName = "SetUpTestCase";
36     tokenId = GetAccessTokenId(&infoInstance);
37     SetSelfTokenID(tokenId);
38     delete[] perms;
39 }
40 }  // namespace AppExecFwk
41 }  // namespace OHOS
42