Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
0a21090f
C
communication_ipc
项目概览
OpenHarmony
/
communication_ipc
12 个月 前同步成功
通知
20
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
communication_ipc
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0a21090f
编写于
1月 12, 2022
作者:
L
liubb_0516
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove dbinder's dependency on samgr
Signed-off-by:
N
liubb_0516
<
liubeibei8@huawei.com
>
上级
6da1cf47
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
30 deletion
+16
-30
interfaces/innerkits/libdbinder/include/dbinder_service.h
interfaces/innerkits/libdbinder/include/dbinder_service.h
+4
-5
interfaces/innerkits/libdbinder/include/rpc_system_ability_callback.h
...nnerkits/libdbinder/include/rpc_system_ability_callback.h
+6
-6
services/dbinder/dbinder_service/src/dbinder_service.cpp
services/dbinder/dbinder_service/src/dbinder_service.cpp
+6
-19
未找到文件。
interfaces/innerkits/libdbinder/include/dbinder_service.h
浏览文件 @
0a21090f
...
...
@@ -24,10 +24,10 @@
#include <list>
#include <thread>
#include "
if_dbinder_service
.h"
#include "
dbinder_service_stub
.h"
#include "ipc_object_proxy.h"
#include "ipc_object_stub.h"
#include "
dbinder_service_stub
.h"
#include "
rpc_system_ability_callback
.h"
namespace
OHOS
{
class
DBinderRemoteListener
;
...
...
@@ -101,8 +101,7 @@ public:
virtual
~
DBinderService
();
public:
static
sptr
<
DBinderService
>
GetInstance
();
bool
StartDBinderService
();
bool
StartDBinderService
(
std
::
shared_ptr
<
IDBinderService
>
&
callbackImpl
);
bool
StartDBinderService
(
std
::
shared_ptr
<
RpcSystemAbilityCallback
>
&
callbackImpl
);
sptr
<
DBinderServiceStub
>
MakeRemoteBinder
(
const
std
::
u16string
&
serviceName
,
const
std
::
string
&
deviceID
,
binder_uintptr_t
binderObject
,
uint64_t
pid
=
0
);
bool
RegisterRemoteProxy
(
std
::
u16string
serviceName
,
sptr
<
IRemoteObject
>
binderObject
);
...
...
@@ -197,7 +196,7 @@ private:
static
constexpr
int32_t
FIRST_SYS_ABILITY_ID
=
0x00000001
;
static
constexpr
int32_t
LAST_SYS_ABILITY_ID
=
0x00ffffff
;
std
::
shared_ptr
<
IDBinderService
>
dbinderCallback_
;
std
::
shared_ptr
<
RpcSystemAbilityCallback
>
dbinderCallback_
;
};
}
// namespace OHOS
#endif // OHOS_IPC_SERVICES_DBINDER_DBINDER_SERVICE_H
interfaces/innerkits/libdbinder/include/
if_dbinder_service
.h
→
interfaces/innerkits/libdbinder/include/
rpc_system_ability_callback
.h
浏览文件 @
0a21090f
...
...
@@ -13,17 +13,17 @@
* limitations under the License.
*/
#ifndef INTERFACES_RPC_SERVICES_
DBINDER
_H
#define INTERFACES_RPC_SERVICES_
DBINDER
_H
#ifndef INTERFACES_RPC_SERVICES_
CALLBACK
_H
#define INTERFACES_RPC_SERVICES_
CALLBACK
_H
#include "iremote_object.h"
namespace
OHOS
{
class
IDBinderService
{
class
RpcSystemAbilityCallback
{
public:
virtual
sptr
<
IRemoteObject
>
GetSystemAbilityFromRemote
(
int32_t
systemAbilityId
)
=
0
;
IDBinderService
()
=
default
;
virtual
~
IDBinderService
()
=
default
;
RpcSystemAbilityCallback
()
=
default
;
virtual
~
RpcSystemAbilityCallback
()
=
default
;
};
}
// namespace OHOS
#endif // INTERFACES_RPC_SERVICES_DBINDER_H
\ No newline at end of file
#endif // INTERFACES_RPC_SERVICES_CALLBACK_H
\ No newline at end of file
services/dbinder/dbinder_service/src/dbinder_service.cpp
浏览文件 @
0a21090f
...
...
@@ -73,22 +73,7 @@ std::string DBinderService::GetLocalDeviceID()
return
networkId
;
}
bool
DBinderService
::
StartDBinderService
()
{
if
(
mainThreadCreated_
)
{
return
true
;
}
bool
result
=
StartRemoteListener
();
if
(
!
result
)
{
return
false
;
}
mainThreadCreated_
=
true
;
return
true
;
}
bool
DBinderService
::
StartDBinderService
(
std
::
shared_ptr
<
IDBinderService
>
&
callbackImpl
)
bool
DBinderService
::
StartDBinderService
(
std
::
shared_ptr
<
RpcSystemAbilityCallback
>
&
callbackImpl
)
{
if
(
mainThreadCreated_
)
{
return
true
;
...
...
@@ -387,6 +372,10 @@ sptr<IRemoteObject> DBinderService::FindOrNewProxy(binder_uintptr_t binderObject
DBINDER_LOGI
(
"already have proxy"
);
return
proxy
;
}
if
(
dbinderCallback_
==
nullptr
)
{
DBINDER_LOGE
(
"samgr not initialized get remote sa callback"
);
return
nullptr
;
}
/* proxy is null, attempt to get a new proxy */
std
::
u16string
serviceName
=
GetRegisterService
(
binderObject
);
if
(
serviceName
.
empty
()
&&
!
CheckSystemAbilityId
(
systemAbilityId
))
{
...
...
@@ -394,9 +383,7 @@ sptr<IRemoteObject> DBinderService::FindOrNewProxy(binder_uintptr_t binderObject
return
nullptr
;
}
int32_t
digitalName
=
!
serviceName
.
empty
()
?
std
::
atoi
(
Str16ToStr8
(
serviceName
).
c_str
())
:
systemAbilityId
;
if
(
dbinderCallback_
!=
nullptr
)
{
proxy
=
dbinderCallback_
->
GetSystemAbilityFromRemote
(
digitalName
);
}
proxy
=
dbinderCallback_
->
GetSystemAbilityFromRemote
(
digitalName
);
if
(
proxy
!=
nullptr
)
{
/* When the stub object dies, you need to delete the corresponding busName information */
IPCObjectProxy
*
saProxy
=
reinterpret_cast
<
IPCObjectProxy
*>
(
proxy
.
GetRefPtr
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录