Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
communication_ipc
提交
fbc3beb2
C
communication_ipc
项目概览
OpenHarmony
/
communication_ipc
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
fbc3beb2
编写于
1月 13, 2022
作者:
O
openharmony_ci
提交者:
Gitee
1月 13, 2022
浏览文件
操作
浏览文件
下载
差异文件
!85 Remove dbinder's dependency on samgr
Merge pull request !85 from liubb_0516/master
上级
981dfb39
0a21090f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
43 addition
and
15 deletion
+43
-15
interfaces/innerkits/libdbinder/BUILD.gn
interfaces/innerkits/libdbinder/BUILD.gn
+0
-1
interfaces/innerkits/libdbinder/include/dbinder_service.h
interfaces/innerkits/libdbinder/include/dbinder_service.h
+5
-2
interfaces/innerkits/libdbinder/include/rpc_system_ability_callback.h
...nnerkits/libdbinder/include/rpc_system_ability_callback.h
+29
-0
services/dbinder/dbinder_service/src/dbinder_service.cpp
services/dbinder/dbinder_service/src/dbinder_service.cpp
+9
-12
未找到文件。
interfaces/innerkits/libdbinder/BUILD.gn
100755 → 100644
浏览文件 @
fbc3beb2
...
@@ -56,7 +56,6 @@ ohos_shared_library("libdbinder") {
...
@@ -56,7 +56,6 @@ ohos_shared_library("libdbinder") {
external_deps = [
external_deps = [
"dsoftbus_standard:softbus_client",
"dsoftbus_standard:softbus_client",
"hiviewdfx_hilog_native:libhilog",
"hiviewdfx_hilog_native:libhilog",
"samgr_standard:samgr_proxy",
]
]
subsystem_name = "communication"
subsystem_name = "communication"
part_name = "ipc"
part_name = "ipc"
...
...
interfaces/innerkits/libdbinder/include/dbinder_service.h
100755 → 100644
浏览文件 @
fbc3beb2
...
@@ -24,9 +24,10 @@
...
@@ -24,9 +24,10 @@
#include <list>
#include <list>
#include <thread>
#include <thread>
#include "dbinder_service_stub.h"
#include "ipc_object_proxy.h"
#include "ipc_object_proxy.h"
#include "ipc_object_stub.h"
#include "ipc_object_stub.h"
#include "
dbinder_service_stub
.h"
#include "
rpc_system_ability_callback
.h"
namespace
OHOS
{
namespace
OHOS
{
class
DBinderRemoteListener
;
class
DBinderRemoteListener
;
...
@@ -100,7 +101,7 @@ public:
...
@@ -100,7 +101,7 @@ public:
virtual
~
DBinderService
();
virtual
~
DBinderService
();
public:
public:
static
sptr
<
DBinderService
>
GetInstance
();
static
sptr
<
DBinderService
>
GetInstance
();
bool
StartDBinderService
();
bool
StartDBinderService
(
std
::
shared_ptr
<
RpcSystemAbilityCallback
>
&
callbackImpl
);
sptr
<
DBinderServiceStub
>
MakeRemoteBinder
(
const
std
::
u16string
&
serviceName
,
sptr
<
DBinderServiceStub
>
MakeRemoteBinder
(
const
std
::
u16string
&
serviceName
,
const
std
::
string
&
deviceID
,
binder_uintptr_t
binderObject
,
uint64_t
pid
=
0
);
const
std
::
string
&
deviceID
,
binder_uintptr_t
binderObject
,
uint64_t
pid
=
0
);
bool
RegisterRemoteProxy
(
std
::
u16string
serviceName
,
sptr
<
IRemoteObject
>
binderObject
);
bool
RegisterRemoteProxy
(
std
::
u16string
serviceName
,
sptr
<
IRemoteObject
>
binderObject
);
...
@@ -194,6 +195,8 @@ private:
...
@@ -194,6 +195,8 @@ private:
std
::
map
<
IPCObjectProxy
*
,
std
::
string
>
busNameObject_
;
std
::
map
<
IPCObjectProxy
*
,
std
::
string
>
busNameObject_
;
static
constexpr
int32_t
FIRST_SYS_ABILITY_ID
=
0x00000001
;
static
constexpr
int32_t
FIRST_SYS_ABILITY_ID
=
0x00000001
;
static
constexpr
int32_t
LAST_SYS_ABILITY_ID
=
0x00ffffff
;
static
constexpr
int32_t
LAST_SYS_ABILITY_ID
=
0x00ffffff
;
std
::
shared_ptr
<
RpcSystemAbilityCallback
>
dbinderCallback_
;
};
};
}
// namespace OHOS
}
// namespace OHOS
#endif // OHOS_IPC_SERVICES_DBINDER_DBINDER_SERVICE_H
#endif // OHOS_IPC_SERVICES_DBINDER_DBINDER_SERVICE_H
interfaces/innerkits/libdbinder/include/rpc_system_ability_callback.h
0 → 100644
浏览文件 @
fbc3beb2
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef INTERFACES_RPC_SERVICES_CALLBACK_H
#define INTERFACES_RPC_SERVICES_CALLBACK_H
#include "iremote_object.h"
namespace
OHOS
{
class
RpcSystemAbilityCallback
{
public:
virtual
sptr
<
IRemoteObject
>
GetSystemAbilityFromRemote
(
int32_t
systemAbilityId
)
=
0
;
RpcSystemAbilityCallback
()
=
default
;
virtual
~
RpcSystemAbilityCallback
()
=
default
;
};
}
// namespace OHOS
#endif // INTERFACES_RPC_SERVICES_CALLBACK_H
\ No newline at end of file
services/dbinder/dbinder_service/src/dbinder_service.cpp
100755 → 100644
浏览文件 @
fbc3beb2
...
@@ -21,14 +21,12 @@
...
@@ -21,14 +21,12 @@
#include <arpa/inet.h>
#include <arpa/inet.h>
#include "securec.h"
#include "securec.h"
#include "string_ex.h"
#include "string_ex.h"
#include "iservice_registry.h"
#include "ipc_skeleton.h"
#include "ipc_skeleton.h"
#include "ipc_thread_skeleton.h"
#include "ipc_thread_skeleton.h"
#include "dbinder_log.h"
#include "dbinder_log.h"
#include "dbinder_service_stub.h"
#include "dbinder_service_stub.h"
#include "dbinder_remote_listener.h"
#include "dbinder_remote_listener.h"
#include "if_system_ability_manager.h"
#include "dbinder_error_code.h"
#include "dbinder_error_code.h"
#include "softbus_bus_center.h"
#include "softbus_bus_center.h"
#include "dbinder_sa_death_recipient.h"
#include "dbinder_sa_death_recipient.h"
...
@@ -58,6 +56,7 @@ DBinderService::~DBinderService()
...
@@ -58,6 +56,7 @@ DBinderService::~DBinderService()
noticeProxy_
.
clear
();
noticeProxy_
.
clear
();
deathRecipients_
.
clear
();
deathRecipients_
.
clear
();
busNameObject_
.
clear
();
busNameObject_
.
clear
();
dbinderCallback_
=
nullptr
;
DBINDER_LOGI
(
"dbinder service died"
);
DBINDER_LOGI
(
"dbinder service died"
);
}
}
...
@@ -74,7 +73,7 @@ std::string DBinderService::GetLocalDeviceID()
...
@@ -74,7 +73,7 @@ std::string DBinderService::GetLocalDeviceID()
return
networkId
;
return
networkId
;
}
}
bool
DBinderService
::
StartDBinderService
()
bool
DBinderService
::
StartDBinderService
(
std
::
shared_ptr
<
RpcSystemAbilityCallback
>
&
callbackImpl
)
{
{
if
(
mainThreadCreated_
)
{
if
(
mainThreadCreated_
)
{
return
true
;
return
true
;
...
@@ -85,6 +84,7 @@ bool DBinderService::StartDBinderService()
...
@@ -85,6 +84,7 @@ bool DBinderService::StartDBinderService()
return
false
;
return
false
;
}
}
mainThreadCreated_
=
true
;
mainThreadCreated_
=
true
;
dbinderCallback_
=
callbackImpl
;
return
true
;
return
true
;
}
}
...
@@ -372,21 +372,18 @@ sptr<IRemoteObject> DBinderService::FindOrNewProxy(binder_uintptr_t binderObject
...
@@ -372,21 +372,18 @@ sptr<IRemoteObject> DBinderService::FindOrNewProxy(binder_uintptr_t binderObject
DBINDER_LOGI
(
"already have proxy"
);
DBINDER_LOGI
(
"already have proxy"
);
return
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 */
/* proxy is null, attempt to get a new proxy */
std
::
u16string
serviceName
=
GetRegisterService
(
binderObject
);
std
::
u16string
serviceName
=
GetRegisterService
(
binderObject
);
if
(
serviceName
.
empty
()
&&
!
CheckSystemAbilityId
(
systemAbilityId
))
{
if
(
serviceName
.
empty
()
&&
!
CheckSystemAbilityId
(
systemAbilityId
))
{
DBINDER_LOGE
(
"service is not registered in this device, saId:%{public}d"
,
systemAbilityId
);
DBINDER_LOGE
(
"service is not registered in this device, saId:%{public}d"
,
systemAbilityId
);
return
nullptr
;
return
nullptr
;
}
}
int32_t
digitalName
=
!
serviceName
.
empty
()
?
std
::
atoi
(
Str16ToStr8
(
serviceName
).
c_str
())
:
systemAbilityId
;
auto
manager
=
SystemAbilityManagerClient
::
GetInstance
().
GetSystemAbilityManager
();
proxy
=
dbinderCallback_
->
GetSystemAbilityFromRemote
(
digitalName
);
if
(
manager
==
nullptr
)
{
DBINDER_LOGE
(
"when new proxy, find samgr fail!"
);
return
nullptr
;
}
int
digitalName
=
!
serviceName
.
empty
()
?
std
::
atoi
(
Str16ToStr8
(
serviceName
).
c_str
())
:
systemAbilityId
;
proxy
=
manager
->
GetSystemAbility
(
digitalName
);
if
(
proxy
!=
nullptr
)
{
if
(
proxy
!=
nullptr
)
{
/* When the stub object dies, you need to delete the corresponding busName information */
/* When the stub object dies, you need to delete the corresponding busName information */
IPCObjectProxy
*
saProxy
=
reinterpret_cast
<
IPCObjectProxy
*>
(
proxy
.
GetRefPtr
());
IPCObjectProxy
*
saProxy
=
reinterpret_cast
<
IPCObjectProxy
*>
(
proxy
.
GetRefPtr
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录