Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Startup Init Lite
提交
9982c26e
S
Startup Init Lite
项目概览
OpenHarmony
/
Startup Init Lite
接近 2 年 前同步成功
通知
3
Star
37
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Startup Init Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9982c26e
编写于
7月 15, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 15, 2023
浏览文件
操作
浏览文件
下载
差异文件
!2123 IPCcode接口格式修改
Merge pull request !2123 from zhaohaoran09/master
上级
15bf42b1
53a41078
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
51 addition
and
27 deletion
+51
-27
device_info/device_info_proxy.cpp
device_info/device_info_proxy.cpp
+4
-2
device_info/deviceinfoservice_ipc_interface_code.h
device_info/deviceinfoservice_ipc_interface_code.h
+3
-3
services/param/watcher/agent/watcher_manager_proxy.cpp
services/param/watcher/agent/watcher_manager_proxy.cpp
+4
-2
services/param/watcher/include/param_watcher_ipc_interface_code.h
.../param/watcher/include/param_watcher_ipc_interface_code.h
+6
-6
test/unittest/deviceinfo/DeviceInfoUnittest.cpp
test/unittest/deviceinfo/DeviceInfoUnittest.cpp
+20
-7
test/unittest/param/watcher_proxy_unittest.cpp
test/unittest/param/watcher_proxy_unittest.cpp
+14
-7
未找到文件。
device_info/device_info_proxy.cpp
浏览文件 @
9982c26e
...
...
@@ -44,7 +44,8 @@ int32_t DeviceInfoProxy::GetUdid(std::string& result)
MessageParcel
reply
;
MessageOption
option
{
MessageOption
::
TF_SYNC
};
data
.
WriteInterfaceToken
(
DeviceInfoProxy
::
GetDescriptor
());
int32_t
ret
=
DeviceInfoSendRequest
(
static_cast
<
uint32_t
>
(
DeviceInfoInterfaceCode
::
COMMAND_GET_UDID
),
data
,
reply
,
option
);
int32_t
ret
=
DeviceInfoSendRequest
(
static_cast
<
uint32_t
>
(
DeviceInfoInterfaceCode
::
COMMAND_GET_UDID
),
data
,
reply
,
option
);
DINFO_LOGI
(
"DeviceInfoProxy::GetUdid: %d"
,
ret
);
DINFO_CHECK
(
ret
==
ERR_NONE
,
return
ret
,
"getUdid failed, error code is %d"
,
ret
);
result
=
Str16ToStr8
(
reply
.
ReadString16
());
...
...
@@ -58,7 +59,8 @@ int32_t DeviceInfoProxy::GetSerialID(std::string& result)
MessageOption
option
{
MessageOption
::
TF_SYNC
};
data
.
WriteInterfaceToken
(
DeviceInfoProxy
::
GetDescriptor
());
int32_t
ret
=
DeviceInfoSendRequest
(
static_cast
<
uint32_t
>
(
DeviceInfoInterfaceCode
::
COMMAND_GET_SERIAL_ID
),
data
,
reply
,
option
);
int32_t
ret
=
DeviceInfoSendRequest
(
static_cast
<
uint32_t
>
(
DeviceInfoInterfaceCode
::
COMMAND_GET_SERIAL_ID
),
data
,
reply
,
option
);
DINFO_LOGI
(
"DeviceInfoProxy::GetSerialID: %d"
,
ret
);
DINFO_CHECK
(
ret
==
ERR_NONE
,
return
ret
,
"GetSerial failed, error code is %d"
,
ret
);
result
=
Str16ToStr8
(
reply
.
ReadString16
());
...
...
device_info/deviceinfoservice_ipc_interface_code.h
浏览文件 @
9982c26e
...
...
@@ -16,12 +16,12 @@
#ifndef DEVICEINFOSERVICE_IPC_INTERFACE_CODE_H
#define DEVICEINFOSERVICE_IPC_INTERFACE_CODE_H
/*SAID: 3902 */
/*
SAID: 3902 */
namespace
OHOS
{
namespace
device_info
{
enum
class
DeviceInfoInterfaceCode
{
COMMAND_GET_UDID
=
1
,
COMMAND_GET_SERIAL_ID
=
2
,
COMMAND_GET_UDID
=
1
,
COMMAND_GET_SERIAL_ID
=
2
,
};
}
// namespace device_info
}
// namespace OHOS
...
...
services/param/watcher/agent/watcher_manager_proxy.cpp
浏览文件 @
9982c26e
...
...
@@ -29,7 +29,8 @@ uint32_t WatcherManagerProxy::AddRemoteWatcher(uint32_t id, const sptr<IWatcher>
MessageParcel
reply
;
MessageOption
option
{
MessageOption
::
TF_SYNC
};
int32_t
res
=
SendWatcherMsg
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
ADD_REMOTE_AGENT
),
data
,
reply
,
option
);
int32_t
res
=
SendWatcherMsg
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
ADD_REMOTE_AGENT
),
data
,
reply
,
option
);
WATCHER_CHECK
(
res
==
ERR_OK
,
return
0
,
"Transact error %d"
,
res
);
return
reply
.
ReadUint32
();
}
...
...
@@ -41,7 +42,8 @@ int32_t WatcherManagerProxy::DelRemoteWatcher(uint32_t remoteWatcherId)
data
.
WriteUint32
(
remoteWatcherId
);
MessageParcel
reply
;
MessageOption
option
{
MessageOption
::
TF_SYNC
};
int32_t
res
=
SendWatcherMsg
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
DEL_REMOTE_AGENT
),
data
,
reply
,
option
);
int32_t
res
=
SendWatcherMsg
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
DEL_REMOTE_AGENT
),
data
,
reply
,
option
);
WATCHER_CHECK
(
res
==
ERR_OK
,
return
ERR_FLATTEN_OBJECT
,
"Transact error"
);
return
reply
.
ReadInt32
();
}
...
...
services/param/watcher/include/param_watcher_ipc_interface_code.h
浏览文件 @
9982c26e
...
...
@@ -16,15 +16,15 @@
#ifndef PARAM_WATCHER_IPC_INTERFACE_CODE_H
#define PARAM_WATCHER_IPC_INTERFACE_CODE_H
/*SAID: 3901 */
/*
SAID: 3901 */
namespace
OHOS
{
namespace
init_param
{
enum
class
ParamWatcherInterfaceCode
{
ADD_WATCHER
=
0
,
DEL_WATCHER
,
ADD_REMOTE_AGENT
,
DEL_REMOTE_AGENT
,
REFRESH_WATCHER
ADD_WATCHER
=
0
,
DEL_WATCHER
,
ADD_REMOTE_AGENT
,
DEL_REMOTE_AGENT
,
REFRESH_WATCHER
};
}
// namespace init_param
}
// namespace OHOS
...
...
test/unittest/deviceinfo/DeviceInfoUnittest.cpp
浏览文件 @
9982c26e
...
...
@@ -126,7 +126,8 @@ HWTEST_F(DeviceInfoUnittest, DeviceInfoServiceInvalidTokenTest, TestSize.Level1)
MessageOption
option
;
g_tokenType
=
OHOS
::
Security
::
AccessToken
::
TOKEN_INVALID
;
data
.
WriteInterfaceToken
(
OHOS
::
device_info
::
DeviceInfoStub
::
GetDescriptor
());
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_UDID
),
data
,
reply
,
option
);
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_UDID
),
data
,
reply
,
option
);
}
HWTEST_F
(
DeviceInfoUnittest
,
DeviceInfoServiceFailTest
,
TestSize
.
Level1
)
...
...
@@ -142,10 +143,14 @@ HWTEST_F(DeviceInfoUnittest, DeviceInfoServiceFailTest, TestSize.Level1)
// udid
data
.
WriteInterfaceToken
(
OHOS
::
device_info
::
DeviceInfoStub
::
GetDescriptor
());
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_UDID
),
data
,
reply
,
option
);
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_UDID
),
data
,
reply
,
option
);
// serial
data
.
WriteInterfaceToken
(
OHOS
::
device_info
::
DeviceInfoStub
::
GetDescriptor
());
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_SERIAL_ID
),
data
,
reply
,
option
);
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_SERIAL_ID
),
data
,
reply
,
option
);
}
HWTEST_F
(
DeviceInfoUnittest
,
DeviceInfoServiceTest
,
TestSize
.
Level1
)
...
...
@@ -159,13 +164,21 @@ HWTEST_F(DeviceInfoUnittest, DeviceInfoServiceTest, TestSize.Level1)
g_tokenType
=
OHOS
::
Security
::
AccessToken
::
TOKEN_HAP
;
g_tokenVerifyResult
=
OHOS
::
Security
::
AccessToken
::
TypePermissionState
::
PERMISSION_GRANTED
;
data
.
WriteInterfaceToken
(
OHOS
::
device_info
::
DeviceInfoStub
::
GetDescriptor
());
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_UDID
),
data
,
reply
,
option
);
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_UDID
),
data
,
reply
,
option
);
data
.
WriteInterfaceToken
(
OHOS
::
device_info
::
DeviceInfoStub
::
GetDescriptor
());
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_SERIAL_ID
),
data
,
reply
,
option
);
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_SERIAL_ID
),
data
,
reply
,
option
);
data
.
WriteInterfaceToken
(
OHOS
::
device_info
::
DeviceInfoStub
::
GetDescriptor
());
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_SERIAL_ID
)
+
1
,
data
,
reply
,
option
);
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_SERIAL_ID
)
+
1
,
data
,
reply
,
option
);
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_SERIAL_ID
)
+
1
,
data
,
reply
,
option
);
deviceInfoService
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
OHOS
::
device_info
::
DeviceInfoInterfaceCode
::
COMMAND_GET_SERIAL_ID
)
+
1
,
data
,
reply
,
option
);
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
3
));
// wait sa unload 3s
deviceInfoService
->
GetUdid
(
result
);
deviceInfoService
->
GetSerialID
(
result
);
...
...
test/unittest/param/watcher_proxy_unittest.cpp
浏览文件 @
9982c26e
...
...
@@ -78,7 +78,8 @@ public:
bool
ret
=
data
.
WriteRemoteObject
(
watcher
->
AsObject
());
WATCHER_CHECK
(
ret
,
return
0
,
"Can not get remote"
);
data
.
WriteUint32
(
agentId
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
ADD_REMOTE_AGENT
),
data
,
reply
,
option
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
ADD_REMOTE_AGENT
),
data
,
reply
,
option
);
watcherId
=
reply
.
ReadUint32
();
EXPECT_NE
(
watcherId
,
0
);
...
...
@@ -101,7 +102,8 @@ public:
data
.
WriteInterfaceToken
(
IWatcherManager
::
GetDescriptor
());
data
.
WriteUint32
(
watcherId
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
DEL_REMOTE_AGENT
),
data
,
reply
,
option
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
DEL_REMOTE_AGENT
),
data
,
reply
,
option
);
EXPECT_EQ
(
reply
.
ReadInt32
(),
0
);
EXPECT_EQ
(
watcherManager
->
GetRemoteWatcher
(
watcherId
)
==
nullptr
,
1
);
return
0
;
...
...
@@ -118,7 +120,8 @@ public:
data
.
WriteInterfaceToken
(
IWatcherManager
::
GetDescriptor
());
data
.
WriteString
(
keyPrefix
);
data
.
WriteUint32
(
watcherId
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
ADD_WATCHER
),
data
,
reply
,
option
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
ADD_WATCHER
),
data
,
reply
,
option
);
EXPECT_EQ
(
reply
.
ReadInt32
(),
0
);
EXPECT_EQ
(
watcherManager
->
GetWatcherGroup
(
keyPrefix
)
!=
nullptr
,
1
);
return
0
;
...
...
@@ -135,7 +138,8 @@ public:
data
.
WriteInterfaceToken
(
IWatcherManager
::
GetDescriptor
());
data
.
WriteString
(
keyPrefix
);
data
.
WriteUint32
(
watcherId
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
REFRESH_WATCHER
),
data
,
reply
,
option
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
REFRESH_WATCHER
),
data
,
reply
,
option
);
EXPECT_EQ
(
reply
.
ReadInt32
(),
0
);
EXPECT_EQ
(
watcherManager
->
GetWatcherGroup
(
keyPrefix
)
!=
nullptr
,
1
);
return
0
;
...
...
@@ -151,7 +155,8 @@ public:
data
.
WriteInterfaceToken
(
IWatcherManager
::
GetDescriptor
());
data
.
WriteString
(
keyPrefix
);
data
.
WriteUint32
(
watcherId
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
DEL_WATCHER
),
data
,
reply
,
option
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
DEL_WATCHER
),
data
,
reply
,
option
);
EXPECT_EQ
(
reply
.
ReadInt32
(),
0
);
return
0
;
}
...
...
@@ -231,11 +236,13 @@ public:
data
.
WriteInterfaceToken
(
IWatcherManager
::
GetDescriptor
());
data
.
WriteString
(
keyPrefix
);
data
.
WriteUint32
(
0
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
REFRESH_WATCHER
)
+
1
,
data
,
reply
,
option
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
REFRESH_WATCHER
)
+
1
,
data
,
reply
,
option
);
data
.
WriteInterfaceToken
(
IWatcherManager
::
GetDescriptor
());
data
.
WriteString
(
keyPrefix
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
REFRESH_WATCHER
)
+
1
,
data
,
reply
,
option
);
watcherManager
->
OnRemoteRequest
(
static_cast
<
uint32_t
>
(
ParamWatcherInterfaceCode
::
REFRESH_WATCHER
)
+
1
,
data
,
reply
,
option
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录