mirror of
https://github.com/openharmony/security_access_token.git
synced 2026-08-24 14:42:49 -04:00
隐私弹窗隔离
Signed-off-by: y1585740638 <yulei99@huawei.com> Change-Id: I3c33102da5d190c176926abb47f9ac67acb1541d
This commit is contained in:
+7
-1
@@ -141,7 +141,13 @@ if (!defined(global_parts_info) ||
|
||||
|
||||
declare_args() {
|
||||
access_token_camera_float_window_enable = true
|
||||
access_token_different_feature = true
|
||||
}
|
||||
|
||||
if (!defined(global_parts_info) ||
|
||||
defined(global_parts_info.appsecurityprivacy_security_privacy_server)) {
|
||||
access_token_app_security_privacy_service_enable = true
|
||||
} else {
|
||||
access_token_app_security_privacy_service_enable = false
|
||||
}
|
||||
|
||||
if (!defined(global_parts_info) ||
|
||||
|
||||
+1
-2
@@ -21,8 +21,7 @@
|
||||
],
|
||||
"features": [
|
||||
"access_token_feature_coverage = false",
|
||||
"access_token_camera_float_window_enable",
|
||||
"access_token_different_feature"
|
||||
"access_token_camera_float_window_enable"
|
||||
],
|
||||
"adapted_system_type": [ "standard" ],
|
||||
"rom": "10000KB",
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace Security {
|
||||
namespace AccessToken {
|
||||
enum PrivacyAudioPolicyInterfaceCode {
|
||||
#ifdef FEATURE_DTMF_TONE
|
||||
SET_MICROPHONE_MUTE_PERSISTENT = 119,
|
||||
GET_MICROPHONE_MUTE_PERSISTENT = 120,
|
||||
SET_MICROPHONE_MUTE_PERSISTENT = 120,
|
||||
GET_MICROPHONE_MUTE_PERSISTENT = 121,
|
||||
#else
|
||||
SET_MICROPHONE_MUTE_PERSISTENT = 117,
|
||||
GET_MICROPHONE_MUTE_PERSISTENT = 118,
|
||||
SET_MICROPHONE_MUTE_PERSISTENT = 118,
|
||||
GET_MICROPHONE_MUTE_PERSISTENT = 119,
|
||||
#endif
|
||||
};
|
||||
} // namespace AccessToken
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace OHOS {
|
||||
namespace Security {
|
||||
namespace AccessToken {
|
||||
enum PrivacyCameraServiceInterfaceCode {
|
||||
CAMERA_SERVICE_IS_CAMERA_MUTED = 13,
|
||||
CAMERA_SERVICE_MUTE_CAMERA_PERSIST = 22,
|
||||
CAMERA_SERVICE_IS_CAMERA_MUTED = 14,
|
||||
CAMERA_SERVICE_MUTE_CAMERA_PERSIST = 23,
|
||||
};
|
||||
} // namespace AccessToken
|
||||
} // namespace Security
|
||||
|
||||
@@ -150,5 +150,9 @@ if (is_standard_system && ability_base_enable == true) {
|
||||
include_dirs +=
|
||||
[ "${access_token_path}/services/common/window_manager/include" ]
|
||||
}
|
||||
|
||||
if (access_token_app_security_privacy_service_enable) {
|
||||
cflags_cc += [ "-DAPP_SECURITY_PRIVACY_SERVICE" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ bool PermissionRecordManager::GetGlobalSwitchStatus(const std::string& permissio
|
||||
}
|
||||
return isOpen;
|
||||
}
|
||||
#ifdef DIFFERENT_FEATURE
|
||||
#ifndef APP_SECURITY_PRIVACY_SERVICE
|
||||
/*
|
||||
* StartUsing when close and choose open, update status to foreground or background from inactive
|
||||
* StartUsing when open and choose close, update status to inactive and store in database
|
||||
@@ -837,7 +837,7 @@ int32_t PermissionRecordManager::StartUsingPermission(AccessTokenID tokenId, con
|
||||
if (AddRecordToStartList(record)) {
|
||||
return PrivacyError::ERR_PERMISSION_ALREADY_START_USING;
|
||||
}
|
||||
|
||||
#ifndef APP_SECURITY_PRIVACY_SERVICE
|
||||
if (!GetGlobalSwitchStatus(permissionName)) {
|
||||
if (!ShowGlobalDialog(permissionName)) {
|
||||
ACCESSTOKEN_LOG_ERROR(LABEL, "Show permission dialog failed.");
|
||||
@@ -845,12 +845,10 @@ int32_t PermissionRecordManager::StartUsingPermission(AccessTokenID tokenId, con
|
||||
UnRegisterWindowCallback();
|
||||
return ERR_SERVICE_ABNORMAL;
|
||||
}
|
||||
#ifdef DIFFERENT_FEATURE
|
||||
} else {
|
||||
CallbackExecute(tokenId, permissionName, record.status);
|
||||
}
|
||||
#else
|
||||
}
|
||||
CallbackExecute(tokenId, permissionName, record.status);
|
||||
#endif
|
||||
return Constant::SUCCESS;
|
||||
@@ -892,6 +890,7 @@ int32_t PermissionRecordManager::StartUsingPermission(AccessTokenID tokenId, con
|
||||
cameraCallbackMap_.Erase(tokenId);
|
||||
return PrivacyError::ERR_WINDOW_CALLBACK_FAILED;
|
||||
}
|
||||
#ifndef APP_SECURITY_PRIVACY_SERVICE
|
||||
if (!GetGlobalSwitchStatus(permissionName)) {
|
||||
if (!ShowGlobalDialog(permissionName)) {
|
||||
ACCESSTOKEN_LOG_ERROR(LABEL, "Show permission dialog failed.");
|
||||
@@ -900,12 +899,10 @@ int32_t PermissionRecordManager::StartUsingPermission(AccessTokenID tokenId, con
|
||||
cameraCallbackMap_.Erase(tokenId);
|
||||
return ERR_SERVICE_ABNORMAL;
|
||||
}
|
||||
#ifdef DIFFERENT_FEATURE
|
||||
} else {
|
||||
CallbackExecute(tokenId, permissionName, record.status);
|
||||
}
|
||||
#else
|
||||
}
|
||||
CallbackExecute(tokenId, permissionName, record.status);
|
||||
#endif
|
||||
return Constant::SUCCESS;
|
||||
@@ -1075,7 +1072,7 @@ int32_t PermissionRecordManager::SetEdmMutePolicy(const std::string permissionNa
|
||||
if (isMute) {
|
||||
ModifyMuteStatus(permissionName, EDM, isMute);
|
||||
ModifyMuteStatus(permissionName, MIXED, isMute);
|
||||
#ifdef DIFFERENT_FEATURE
|
||||
#ifndef APP_SECURITY_PRIVACY_SERVICE
|
||||
ExecuteAndUpdateRecordByPerm(permissionName, false);
|
||||
#endif
|
||||
} else {
|
||||
@@ -1098,7 +1095,7 @@ int32_t PermissionRecordManager::SetPrivacyMutePolicy(const std::string permissi
|
||||
}
|
||||
ModifyMuteStatus(permissionName, MIXED, isMute);
|
||||
}
|
||||
#ifdef DIFFERENT_FEATURE
|
||||
#ifndef APP_SECURITY_PRIVACY_SERVICE
|
||||
ExecuteAndUpdateRecordByPerm(permissionName, !isMute);
|
||||
#endif
|
||||
return RET_SUCCESS;
|
||||
|
||||
@@ -67,6 +67,7 @@ void PrivacyManagerService::OnStart()
|
||||
ACCESSTOKEN_LOG_INFO(LABEL, "PrivacyManagerService has already started!");
|
||||
return;
|
||||
}
|
||||
ACCESSTOKEN_LOG_INFO(LABEL, "PrivacyManagerService is starting");
|
||||
if (!Initialize()) {
|
||||
ACCESSTOKEN_LOG_ERROR(LABEL, "Failed to initialize");
|
||||
return;
|
||||
|
||||
@@ -130,11 +130,6 @@ if (is_standard_system && ability_base_enable == true) {
|
||||
]
|
||||
}
|
||||
|
||||
if (camera_framework_enable) {
|
||||
cflags_cc += [ "-DCAMERA_FRAMEWORK_ENABLE" ]
|
||||
external_deps += [ "camera_framework:camera_framework" ]
|
||||
}
|
||||
|
||||
if (ability_runtime_enable) {
|
||||
cflags_cc += [ "-DABILITY_RUNTIME_ENABLE" ]
|
||||
external_deps += [
|
||||
@@ -148,5 +143,9 @@ if (is_standard_system && ability_base_enable == true) {
|
||||
include_dirs +=
|
||||
[ "${access_token_path}/services/common/window_manager/include" ]
|
||||
}
|
||||
|
||||
if (access_token_app_security_privacy_service_enable) {
|
||||
cflags_cc += [ "-DAPP_SECURITY_PRIVACY_SERVICE" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,7 +365,11 @@ HWTEST_F(PermissionRecordManagerTest, StartUsingPermissionTest004, TestSize.Leve
|
||||
ASSERT_EQ(RET_SUCCESS, PermissionRecordManager::GetInstance().StartUsingPermission(tokenId, permissionName));
|
||||
|
||||
usleep(500000); // 500000us = 0.5s
|
||||
#ifndef APP_SECURITY_PRIVACY_SERVICE
|
||||
ASSERT_EQ(PERM_INACTIVE, callback->type_);
|
||||
#else
|
||||
ASSERT_EQ(PERM_ACTIVE_IN_BACKGROUND, callback->type_);
|
||||
#endif
|
||||
ASSERT_EQ(Constant::SUCCESS, PermissionRecordManager::GetInstance().StopUsingPermission(tokenId, permissionName));
|
||||
PermissionRecordManager::GetInstance().isMicLoad_ = isMicLoad;
|
||||
}
|
||||
|
||||
@@ -33,9 +33,6 @@
|
||||
#endif
|
||||
#include "camera_manager_privacy_client.h"
|
||||
#include "camera_manager_privacy_proxy.h"
|
||||
#ifdef CAMERA_FRAMEWORK_ENABLE
|
||||
#include "camera_service_ipc_interface_code.h"
|
||||
#endif
|
||||
#include "token_setproc.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
|
||||
Reference in New Issue
Block a user