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  */
15 
16 #include "devicedebug_stub.h"
17 
18 #include "appspawn.h"
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 int g_isDeveloperModeOpen = 0;
25 
DeveloperModeOpenSet(int developerMode)26 void DeveloperModeOpenSet(int developerMode)
27 {
28     g_isDeveloperModeOpen = developerMode;
29 }
30 
IsDeveloperModeOpenStub()31 int IsDeveloperModeOpenStub()
32 {
33     return g_isDeveloperModeOpen;
34 }
35 
36 int g_appSpawnClientInitRet = 0;
37 
AppSpawnClientInitRetSet(int appSpawnClientInitRet)38 void AppSpawnClientInitRetSet(int appSpawnClientInitRet)
39 {
40     g_appSpawnClientInitRet = appSpawnClientInitRet;
41 }
42 
AppSpawnClientInitStub(const char * serviceName,AppSpawnClientHandle * handle)43 int AppSpawnClientInitStub(const char *serviceName, AppSpawnClientHandle *handle)
44 {
45     (void)serviceName;
46     (void)handle;
47 
48     return g_appSpawnClientInitRet;
49 }
50 
51 int g_appSpawnReqMsgCreateRet = 0;
52 
AppSpawnReqMsgCreateRetSet(int appSpawnReqMsgCreateRet)53 void AppSpawnReqMsgCreateRetSet(int appSpawnReqMsgCreateRet)
54 {
55     g_appSpawnReqMsgCreateRet = appSpawnReqMsgCreateRet;
56 }
57 
AppSpawnReqMsgCreateStub(AppSpawnMsgType msgType,const char * processName,AppSpawnReqMsgHandle * reqHandle)58 int AppSpawnReqMsgCreateStub(AppSpawnMsgType msgType, const char *processName, AppSpawnReqMsgHandle *reqHandle)
59 {
60     (void)msgType;
61     (void)processName;
62     (void)reqHandle;
63 
64     return g_appSpawnReqMsgCreateRet;
65 }
66 
67 int g_appSpawnReqMsgAddExtInfoRet = 0;
68 
AppSpawnReqMsgAddExtInfoRetSet(int appSpawnReqMsgAddExtInfoRet)69 void AppSpawnReqMsgAddExtInfoRetSet(int appSpawnReqMsgAddExtInfoRet)
70 {
71     g_appSpawnReqMsgAddExtInfoRet = appSpawnReqMsgAddExtInfoRet;
72 }
73 
AppSpawnReqMsgAddExtInfoStub(AppSpawnReqMsgHandle reqHandle,const char * name,const uint8_t * value,uint32_t valueLen)74 int AppSpawnReqMsgAddExtInfoStub(AppSpawnReqMsgHandle reqHandle, const char *name, const uint8_t *value,
75     uint32_t valueLen)
76 {
77     (void)reqHandle;
78     (void)name;
79     (void)value;
80     (void)valueLen;
81 
82     return g_appSpawnReqMsgAddExtInfoRet;
83 }
84 
85 int g_appSpawnClientSendMsgResulte = 0;
86 int g_appSpawnClientSendMsgRet = 0;
87 
AppSpawnClientSendMsgResultSet(int appSpawnClientSendMsgResult)88 void AppSpawnClientSendMsgResultSet(int appSpawnClientSendMsgResult)
89 {
90     g_appSpawnClientSendMsgResulte = appSpawnClientSendMsgResult;
91 }
92 
AppSpawnClientSendMsgRetSet(int appSpawnClientSendMsgRet)93 void AppSpawnClientSendMsgRetSet(int appSpawnClientSendMsgRet)
94 {
95     g_appSpawnClientSendMsgRet = appSpawnClientSendMsgRet;
96 }
97 
AppSpawnClientSendMsgStub(AppSpawnClientHandle handle,AppSpawnReqMsgHandle reqHandle,AppSpawnResult * result)98 int AppSpawnClientSendMsgStub(AppSpawnClientHandle handle, AppSpawnReqMsgHandle reqHandle, AppSpawnResult *result)
99 {
100     (void)handle;
101     (void)reqHandle;
102     result->result = g_appSpawnClientSendMsgResulte;
103 
104     return g_appSpawnClientSendMsgRet;
105 }
106 
107 #ifdef __cplusplus
108 }
109 #endif
110