mirror of
https://gitee.com/openharmony/communication_dsoftbus
synced 2024-11-27 02:40:40 +00:00
!7269 add Projection screen Permission check
Merge pull request !7269 from maodong5/mao0815
This commit is contained in:
commit
6ef577a0e6
@ -54,7 +54,10 @@ if (defined(ohos_lite)) {
|
||||
} else {
|
||||
build_type = "ohos_static_library"
|
||||
}
|
||||
common_client_ext_deps += [ "bounds_checking_function:libsec_shared" ]
|
||||
common_client_ext_deps += [
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"bounds_checking_function:libsec_shared",
|
||||
]
|
||||
}
|
||||
|
||||
config("dsoftbus_sdk_interface") {
|
||||
|
33
sdk/transmission/session/cpp/include/session_ipc_adapter.h
Normal file
33
sdk/transmission/session/cpp/include/session_ipc_adapter.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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 SOFTBUS_SESSION_IPC_ADAPTER
|
||||
#define SOFTBUS_SESSION_IPC_ADAPTER
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
bool CheckIsSystemService();
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* SOFTBUS_SESSION_IPC_ADAPTER */
|
30
sdk/transmission/session/cpp/src/session_ipc_adapter.cpp
Normal file
30
sdk/transmission/session/cpp/src/session_ipc_adapter.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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.
|
||||
*/
|
||||
|
||||
#include "accesstoken_kit.h"
|
||||
#include "ipc_skeleton.h"
|
||||
#include "session_ipc_adapter.h"
|
||||
#include "trans_log.h"
|
||||
|
||||
bool CheckIsSystemService()
|
||||
{
|
||||
uint32_t tokenId = OHOS::IPCSkeleton::GetSelfTokenID();
|
||||
auto type = OHOS::Security::AccessToken::AccessTokenKit::GetTokenTypeFlag(tokenId);
|
||||
TRANS_LOGD(TRANS_SDK, "system level=%{public}d", type);
|
||||
if (type == OHOS::Security::AccessToken::TOKEN_NATIVE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2024 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.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "session_ipc_adapter.h"
|
||||
|
||||
bool CheckIsSystemService()
|
||||
{
|
||||
return false;
|
||||
}
|
@ -32,6 +32,7 @@
|
||||
#include "softbus_errcode.h"
|
||||
#include "softbus_socket.h"
|
||||
#include "softbus_utils.h"
|
||||
#include "session_ipc_adapter.h"
|
||||
#include "trans_log.h"
|
||||
#include "trans_server_proxy.h"
|
||||
|
||||
@ -1208,7 +1209,7 @@ void ClientTransOnLinkDown(const char *networkId, int32_t routeType)
|
||||
ListNode destroyList;
|
||||
ListInit(&destroyList);
|
||||
LIST_FOR_EACH_ENTRY(serverNode, &(g_clientSessionServerList->list), ClientSessionServer, node) {
|
||||
if (strcmp(CAST_SESSION, serverNode->sessionName) == 0) {
|
||||
if (strcmp(CAST_SESSION, serverNode->sessionName) == 0 && CheckIsSystemService()) {
|
||||
TRANS_LOGD(TRANS_SDK, "cast plus sessionname is different");
|
||||
continue;
|
||||
}
|
||||
|
@ -39,7 +39,10 @@ if (defined(ohos_lite)) {
|
||||
"//third_party/cJSON",
|
||||
"$dsoftbus_root_path/components/nstackx/nstackx_core/dfile/interfaces",
|
||||
]
|
||||
trans_session_sdk_src += [ "$dsoftbus_root_path/sdk/transmission/session/cpp/src/session_set_timer_virtual.c" ]
|
||||
trans_session_sdk_src += [
|
||||
"$dsoftbus_root_path/sdk/transmission/session/cpp/src/session_set_timer_virtual.c",
|
||||
"$dsoftbus_root_path/sdk/transmission/session/cpp/src/session_ipc_adapter_virtual.c",
|
||||
]
|
||||
} else {
|
||||
trans_session_sdk_inc = [
|
||||
"$dsoftbus_sdk_path/transmission/session/include",
|
||||
@ -55,6 +58,7 @@ if (defined(ohos_lite)) {
|
||||
"$dsoftbus_root_path/sdk/transmission/session/cpp/src/session_impl.cpp",
|
||||
"$dsoftbus_root_path/sdk/transmission/session/cpp/src/session_mock.cpp",
|
||||
"$dsoftbus_root_path/sdk/transmission/session/cpp/src/session_service_impl.cpp",
|
||||
"$dsoftbus_root_path/sdk/transmission/session/cpp/src/session_ipc_adapter.cpp",
|
||||
]
|
||||
|
||||
if (defined(global_parts_info) &&
|
||||
|
@ -95,6 +95,7 @@ ohos_static_library("softbus_client_static") {
|
||||
cflags_cc = [ "-std=c++14" ]
|
||||
if (is_standard_system) {
|
||||
external_deps += [
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
"ipc:ipc_single",
|
||||
|
@ -40,7 +40,7 @@ ohos_unittest("TransClientSessionManagerTest") {
|
||||
"$dsoftbus_dfx_path/log:softbus_dfx_log",
|
||||
"$dsoftbus_root_path/core/common:softbus_utils",
|
||||
"$dsoftbus_root_path/core/frame:softbus_server",
|
||||
"$dsoftbus_root_path/sdk:softbus_client",
|
||||
"$dsoftbus_root_path/tests/sdk/frame/fuzztest/softbusclientstub_fuzzer:softbus_client_static",
|
||||
]
|
||||
|
||||
if (is_standard_system) {
|
||||
@ -219,8 +219,8 @@ ohos_unittest("TransClientSessionTest") {
|
||||
"$dsoftbus_dfx_path/log:softbus_dfx_log",
|
||||
"$dsoftbus_root_path/core/common:softbus_utils",
|
||||
"$dsoftbus_root_path/core/frame:softbus_server",
|
||||
"$dsoftbus_root_path/sdk:softbus_client",
|
||||
"$dsoftbus_root_path/tests/sdk/common:softbus_access_token_test",
|
||||
"$dsoftbus_root_path/tests/sdk/frame/fuzztest/softbusclientstub_fuzzer:softbus_client_static",
|
||||
]
|
||||
|
||||
if (is_standard_system) {
|
||||
|
Loading…
Reference in New Issue
Block a user