!9531 ability_runtime解除dlp部件的运行依赖

Merge pull request !9531 from liuzongze/master
This commit is contained in:
openharmony_ci 2024-07-24 06:21:30 +00:00 committed by Gitee
commit d5a805d524
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
67 changed files with 317 additions and 11 deletions

View File

@ -98,11 +98,13 @@ napi_value WantConstantInit(napi_env env, napi_value exports)
#ifdef ENABLE_ERRCODE
napi_value params = nullptr;
napi_create_object(env, &params);
#ifdef WITH_DLP
SetNamedProperty(env, params, "ohos.dlp.params.sandbox", "DLP_PARAMS_SANDBOX");
SetNamedProperty(env, params, "ohos.dlp.params.bundleName", "DLP_PARAMS_BUNDLE_NAME");
SetNamedProperty(env, params, "ohos.dlp.params.moduleName", "DLP_PARAMS_MODULE_NAME");
SetNamedProperty(env, params, "ohos.dlp.params.abilityName", "DLP_PARAMS_ABILITY_NAME");
SetNamedProperty(env, params, "ohos.dlp.params.index", "DLP_PARAMS_INDEX");
#endif // WITH_DLP
SetNamedProperty(env, params, "ability.params.backToOtherMissionStack", "ABILITY_BACK_TO_OTHER_MISSION_STACK");
SetNamedProperty(env, params, "ohos.ability.params.abilityRecoveryRestart", "ABILITY_RECOVERY_RESTART");
SetNamedProperty(env, params, "ohos.ability.params.asssertFaultSessionId", "ASSERT_FAULT_SESSION_ID");

View File

@ -71,7 +71,9 @@ const int Ability::DEFAULT_DMS_SESSION_ID(0);
const std::string LAUNCHER_BUNDLE_NAME = "com.ohos.launcher";
const std::string LAUNCHER_ABILITY_NAME = "com.ohos.launcher.MainAbility";
const std::string SHOW_ON_LOCK_SCREEN = "ShowOnLockScreen";
#ifdef WITH_DLP
const std::string DLP_PARAMS_SECURITY_FLAG = "ohos.dlp.params.securityFlag";
#endif // WITH_DLP
const std::string COMPONENT_STARTUP_NEW_RULES = "component.startup.newRules";
Ability* Ability::Create(const std::unique_ptr<AbilityRuntime::Runtime>& runtime)
@ -163,8 +165,10 @@ void Ability::OnStart(const Want &want, sptr<AAFwk::SessionInfo> sessionInfo)
return;
}
#ifdef WITH_DLP
securityFlag_ = want.GetBoolParam(DLP_PARAMS_SECURITY_FLAG, false);
(const_cast<Want &>(want)).RemoveParam(DLP_PARAMS_SECURITY_FLAG);
#endif // WITH_DLP
SetWant(want);
#ifdef SUPPORT_SCREEN
if (sessionInfo != nullptr) {

View File

@ -45,7 +45,9 @@ constexpr char LAUNCHER_ABILITY_NAME[] = "com.ohos.launcher.MainAbility";
constexpr char SHOW_ON_LOCK_SCREEN[] = "ShowOnLockScreen";
#endif
#ifdef WITH_DLP
constexpr char DLP_PARAMS_SECURITY_FLAG[] = "ohos.dlp.params.securityFlag";
#endif // WITH_DLP
constexpr char COMPONENT_STARTUP_NEW_RULES[] = "component.startup.newRules";
#ifdef SUPPORT_SCREEN
constexpr int32_t ERR_INVALID_VALUE = -1;
@ -167,8 +169,10 @@ void UIAbility::OnStart(const AAFwk::Want &want, sptr<AAFwk::SessionInfo> sessio
return;
}
#ifdef WITH_DLP
securityFlag_ = want.GetBoolParam(DLP_PARAMS_SECURITY_FLAG, false);
(const_cast<AAFwk::Want &>(want)).RemoveParam(DLP_PARAMS_SECURITY_FLAG);
#endif // WITH_DLP
SetWant(want);
TAG_LOGD(AAFwkTag::UIABILITY, "Begin ability is %{public}s.", abilityInfo_->name.c_str());
#ifdef SUPPORT_SCREEN

View File

@ -1557,7 +1557,9 @@ private:
sptr<IAbilityManager> GetAbilityManager();
void ResetProxy(wptr<IRemoteObject> remote);
#ifdef WITH_DLP
void HandleDlpApp(Want &want);
#endif // WITH_DLP
static std::once_flag singletonFlag_;
std::recursive_mutex mutex_;

View File

@ -20,7 +20,9 @@
#include <unordered_set>
#include "connection_observer.h"
#ifdef WITH_DLP
#include "dlp_connection_info.h"
#endif // WITH_DLP
#include "service_proxy_adapter.h"
namespace OHOS {
@ -36,13 +38,16 @@ public:
int32_t RegisterObserver(const std::shared_ptr<ConnectionObserver> &observer);
int32_t UnregisterObserver(const std::shared_ptr<ConnectionObserver> &observer);
int32_t GetDlpConnectionInfos(std::vector<DlpConnectionInfo> &infos);
int32_t GetConnectionData(std::vector<ConnectionData> &infos);
void HandleExtensionConnected(const ConnectionData &data);
void HandleExtensionDisconnected(const ConnectionData &data);
void HandleRemoteDied(const wptr<IRemoteObject> &remote);
#ifdef WITH_DLP
int32_t GetDlpConnectionInfos(std::vector<DlpConnectionInfo> &infos);
void HandleDlpAbilityOpened(const DlpStateData &data);
void HandleDlpAbilityClosed(const DlpStateData &data);
void HandleRemoteDied(const wptr<IRemoteObject> &remote);
#endif // WITH_DLP
private:
class ServiceDeathRecipient : public IRemoteObject::DeathRecipient {

View File

@ -36,9 +36,11 @@ public:
virtual void OnExtensionDisconnected(const ConnectionData &connectionData) override;
#ifdef WITH_DLP
virtual void OnDlpAbilityOpened(const DlpStateData &dlpData) override;
virtual void OnDlpAbilityClosed(const DlpStateData &dlpData) override;
#endif // WITH_DLP
private:
static inline BrokerDelegator<ConnectionObserverProxy> delegator_;

View File

@ -40,8 +40,10 @@ private:
int OnExtensionConnectedInner(MessageParcel &data, MessageParcel &reply);
int OnExtensionDisconnectedInner(MessageParcel &data, MessageParcel &reply);
#ifdef WITH_DLP
int OnDlpAbilityOpenedInner(MessageParcel &data, MessageParcel &reply);
int OnDlpAbilityClosedInner(MessageParcel &data, MessageParcel &reply);
#endif // WITH_DLP
};
} // namespace AbilityRuntime
} // namespace OHOS

View File

@ -34,9 +34,11 @@ public:
void OnExtensionDisconnected(const ConnectionData &data) override;
#ifdef WITH_DLP
void OnDlpAbilityOpened(const DlpStateData &data) override;
void OnDlpAbilityClosed(const DlpStateData &data) override;
#endif // WITH_DLP
private:
std::weak_ptr<ConnectionObserverClientImpl> owner_;

View File

@ -17,7 +17,11 @@
#define OHOS_ABILITYRUNTIME_ICONNECTION_OBSERVER_H
#include "connection_data.h"
#ifdef WITH_DLP
#include "dlp_state_data.h"
#endif // WITH_DLP
#include "iremote_broker.h"
namespace OHOS {
@ -44,6 +48,7 @@ public:
*/
virtual void OnExtensionDisconnected(const ConnectionData &data) = 0;
#ifdef WITH_DLP
/**
* called when dlp ability was started.
*
@ -57,6 +62,7 @@ public:
* @param data dlp state data.
*/
virtual void OnDlpAbilityClosed(const DlpStateData &data) = 0;
#endif // WITH_DLP
enum ConnectionObserverCmd {
// ipc id for OnExtensionConnected
@ -65,11 +71,13 @@ public:
// ipc id for OnExtensionDisconnected
ON_EXTENSION_DISCONNECTED,
#ifdef WITH_DLP
// ipc id for OnDlpAbilityOpened
ON_DLP_ABILITY_OPENED,
// ipc id for OnExtensionDisconnected
ON_DLP_ABILITY_CLOSED,
#endif // WITH_DLP
// maximum of enum
CMD_MAX

View File

@ -16,7 +16,10 @@
#ifndef ABILITY_RUNTIME_SERVICE_PROXY_ADAPTER_H
#define ABILITY_RUNTIME_SERVICE_PROXY_ADAPTER_H
#ifdef WITH_DLP
#include "dlp_connection_info.h"
#endif // WITH_DLP
#include "iconnection_observer.h"
namespace OHOS {
@ -39,7 +42,9 @@ public:
int32_t UnregisterObserver(const sptr<IConnectionObserver> &observer);
#ifdef WITH_DLP
int32_t GetDlpConnectionInfos(std::vector<DlpConnectionInfo> &infos);
#endif // WITH_DLP
int32_t GetConnectionData(std::vector<ConnectionData> &infos);

View File

@ -54,12 +54,16 @@ int32_t ConnectionObserverClient::UnregisterObserver(const std::shared_ptr<Conne
int32_t ConnectionObserverClient::GetDlpConnectionInfos(std::vector<DlpConnectionInfo> &infos)
{
#ifdef WITH_DLP
if (!clientImpl_) {
TAG_LOGE(AAFwkTag::CONNECTION, "ConnectionObserverClient::GetDlpConnectionInfos impl is nullptr.");
return ERR_NO_CLIENT_IMPL;
}
return clientImpl_->GetDlpConnectionInfos(infos);
#else
return ERR_READ_INFO_FAILED;
#endif // WITH_DLP
}
int32_t ConnectionObserverClient::GetConnectionData(std::vector<ConnectionData> &connectionData)

View File

@ -59,6 +59,7 @@ int32_t ConnectionObserverClientImpl::UnregisterObserver(const std::shared_ptr<C
return ret;
}
#ifdef WITH_DLP
int32_t ConnectionObserverClientImpl::GetDlpConnectionInfos(std::vector<DlpConnectionInfo> &infos)
{
auto proxy = GetServiceProxy();
@ -69,6 +70,7 @@ int32_t ConnectionObserverClientImpl::GetDlpConnectionInfos(std::vector<DlpConne
return proxy->GetDlpConnectionInfos(infos);
}
#endif // WITH_DLP
int32_t ConnectionObserverClientImpl::GetConnectionData(std::vector<ConnectionData> &connectionData)
{
@ -103,6 +105,7 @@ void ConnectionObserverClientImpl::HandleExtensionDisconnected(const ConnectionD
}
}
#ifdef WITH_DLP
void ConnectionObserverClientImpl::HandleDlpAbilityOpened(const DlpStateData &data)
{
auto observers = GetObservers();
@ -124,6 +127,7 @@ void ConnectionObserverClientImpl::HandleDlpAbilityClosed(const DlpStateData &da
}
}
}
#endif // WITH_DLP
bool ConnectionObserverClientImpl::RegisterObserverToServiceLocked(const std::shared_ptr<ServiceProxyAdapter> &proxy)
{

View File

@ -69,6 +69,7 @@ void ConnectionObserverProxy::OnExtensionDisconnected(const ConnectionData& conn
}
}
#ifdef WITH_DLP
void ConnectionObserverProxy::OnDlpAbilityOpened(const DlpStateData& dlpData)
{
MessageParcel data;
@ -116,6 +117,7 @@ void ConnectionObserverProxy::OnDlpAbilityClosed(const DlpStateData& dlpData)
return;
}
}
#endif // WITH_DLP
int32_t ConnectionObserverProxy::SendTransactCmd(uint32_t code, MessageParcel &data,
MessageParcel &reply, MessageOption &option)

View File

@ -38,10 +38,12 @@ int ConnectionObserverStub::OnRemoteRequest(
return OnExtensionConnectedInner(data, reply);
case ON_EXTENSION_DISCONNECTED:
return OnExtensionDisconnectedInner(data, reply);
#ifdef WITH_DLP
case ON_DLP_ABILITY_OPENED:
return OnDlpAbilityOpenedInner(data, reply);
case ON_DLP_ABILITY_CLOSED:
return OnDlpAbilityClosedInner(data, reply);
#endif // WITH_DLP
}
}
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
@ -71,6 +73,7 @@ int ConnectionObserverStub::OnExtensionDisconnectedInner(MessageParcel &data, Me
return NO_ERROR;
}
#ifdef WITH_DLP
int ConnectionObserverStub::OnDlpAbilityOpenedInner(MessageParcel &data, MessageParcel &reply)
{
std::unique_ptr<DlpStateData> dlpData(data.ReadParcelable<DlpStateData>());
@ -94,5 +97,6 @@ int ConnectionObserverStub::OnDlpAbilityClosedInner(MessageParcel &data, Message
OnDlpAbilityClosed(*dlpData);
return NO_ERROR;
}
#endif // WITH_DLP
} // namespace AbilityRuntime
} // namespace OHOS

View File

@ -37,6 +37,7 @@ void ConnectionObserverStubImpl::OnExtensionDisconnected(const ConnectionData &d
owner->HandleExtensionDisconnected(data);
}
#ifdef WITH_DLP
void ConnectionObserverStubImpl::OnDlpAbilityOpened(const DlpStateData &data)
{
auto owner = owner_.lock();
@ -54,5 +55,6 @@ void ConnectionObserverStubImpl::OnDlpAbilityClosed(const DlpStateData &data)
}
owner->HandleDlpAbilityClosed(data);
}
#endif // WITH_DLP
} // namespace AbilityRuntime
} // namespace OHOS

View File

@ -24,7 +24,9 @@ namespace {
const std::u16string ABILITY_MGR_DESCRIPTOR = u"ohos.aafwk.AbilityManager";
constexpr uint32_t REGISTER_CONNECTION_OBSERVER = 2502;
constexpr uint32_t UNREGISTER_CONNECTION_OBSERVER = 2503;
#ifdef WITH_DLP
constexpr uint32_t GET_DLP_CONNECTION_INFOS = 2504;
#endif // WITH_DLP
constexpr uint32_t GET_CONNECTION_DATA = 2505;
constexpr int32_t CYCLE_LIMIT = 1000;
}
@ -96,6 +98,7 @@ int32_t ServiceProxyAdapter::UnregisterObserver(const sptr<IConnectionObserver>
return reply.ReadInt32();
}
#ifdef WITH_DLP
int32_t ServiceProxyAdapter::GetDlpConnectionInfos(std::vector<DlpConnectionInfo> &infos)
{
if (!remoteObj_) {
@ -141,6 +144,7 @@ int32_t ServiceProxyAdapter::GetDlpConnectionInfos(std::vector<DlpConnectionInfo
return result;
}
#endif // WITH_DLP
int32_t ServiceProxyAdapter::GetConnectionData(std::vector<ConnectionData> &connectionData)
{

View File

@ -857,7 +857,9 @@ public:
virtual int UnregisterObserver(const sptr<AbilityRuntime::IConnectionObserver> &observer) override;
#ifdef WITH_DLP
virtual int GetDlpConnectionInfos(std::vector<AbilityRuntime::DlpConnectionInfo> &infos) override;
#endif // WITH_DLP
virtual int GetConnectionData(std::vector<AbilityRuntime::ConnectionData> &connectionData) override;
@ -2093,9 +2095,11 @@ private:
AAFwk::EventInfo BuildEventInfo(const Want &want, int32_t userId);
#ifdef WITH_DLP
int CheckDlpForExtension(
const Want &want, const sptr<IRemoteObject> &callerToken,
int32_t userId, AAFwk::EventInfo &eventInfo, const EventName &eventName);
#endif // WITH_DLP
void InitStartupFlag();

View File

@ -20,8 +20,9 @@
#include <iremote_object.h>
#include <iremote_stub.h>
#ifdef WITH_DLP
#include "dlp_connection_info.h"
#endif // WITH_DLP
#include "iconnection_observer.h"
namespace OHOS {
@ -60,7 +61,9 @@ public:
virtual int UnregisterObserver(const sptr<AbilityRuntime::IConnectionObserver> &observer);
#ifdef WITH_DLP
virtual int GetDlpConnectionInfos(std::vector<AbilityRuntime::DlpConnectionInfo> &infos);
#endif // WITH_DLP
virtual int GetConnectionData(std::vector<AbilityRuntime::ConnectionData> &connectionData);
@ -188,7 +191,9 @@ private:
int UpdateMissionSnapShotFromWMSInner(MessageParcel &data, MessageParcel &reply);
int RegisterConnectionObserverInner(MessageParcel &data, MessageParcel &reply);
int UnregisterConnectionObserverInner(MessageParcel &data, MessageParcel &reply);
#ifdef WITH_DLP
int GetDlpConnectionInfosInner(MessageParcel &data, MessageParcel &reply);
#endif // WITH_DLP
int GetConnectionDataInner(MessageParcel &data, MessageParcel &reply);
int MoveAbilityToBackgroundInner(MessageParcel &data, MessageParcel &reply);
int32_t MoveUIAbilityToBackgroundInner(MessageParcel &data, MessageParcel &reply);

View File

@ -1050,8 +1050,10 @@ private:
bool IsSystemAbilityCall(const sptr<IRemoteObject> &callerToken, uint32_t callingTokenId = 0);
#ifdef WITH_DLP
void HandleDlpAttached();
void HandleDlpClosed();
#endif // WITH_DLP
void NotifyRemoveShellProcess(int32_t type);
void NotifyAnimationAbilityDied();
inline void SetCallerAccessTokenId(uint32_t callerAccessTokenId)

View File

@ -37,6 +37,8 @@ namespace AbilityUtil {
constexpr const char* SYSTEM_BASIC = "system_basic";
constexpr const char* SYSTEM_CORE = "system_core";
constexpr const char* DEFAULT_DEVICE_ID = "";
#ifdef WITH_DLP
constexpr const char* DLP_BUNDLE_NAME = "com.ohos.dlpmanager";
constexpr const char* DLP_MODULE_NAME = "entry";
constexpr const char* DLP_ABILITY_NAME = "ViewAbility";
@ -44,6 +46,7 @@ constexpr const char* DLP_PARAMS_SANDBOX = "ohos.dlp.params.sandbox";
constexpr const char* DLP_PARAMS_BUNDLE_NAME = "ohos.dlp.params.bundleName";
constexpr const char* DLP_PARAMS_MODULE_NAME = "ohos.dlp.params.moduleName";
constexpr const char* DLP_PARAMS_ABILITY_NAME = "ohos.dlp.params.abilityName";
#endif // WITH_DLP
constexpr const char* MARKET_BUNDLE_NAME = "com.huawei.hmsapp.appgallery";
constexpr const char* MARKET_CROWD_TEST_BUNDLE_PARAM = "crowd_test_bundle_name";
constexpr const char* BUNDLE_NAME_SELECTOR_DIALOG = "com.ohos.amsdialog";
@ -211,6 +214,7 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
return ret == ERR_OK;
}
#ifdef WITH_DLP
[[maybe_unused]] static bool HandleDlpApp(Want &want)
{
const std::unordered_set<std::string> whiteListDlpSet = { BUNDLE_NAME_SELECTOR_DIALOG };
@ -232,6 +236,7 @@ static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 mi
return false;
}
#endif // WITH_DLP
[[maybe_unused]] static bool IsStartIncludeAtomicService(const Want &want, const int32_t userId)
{

View File

@ -62,6 +62,7 @@ public:
*/
void NotifyExtensionDisconnected(const AbilityRuntime::ConnectionData& data);
#ifdef WITH_DLP
/**
* notify observers that dlp ability was opened.
*
@ -75,6 +76,7 @@ public:
* @param data dlp state data.
*/
void NotifyDlpAbilityClosed(const AbilityRuntime::DlpStateData& data);
#endif // WITH_DLP
private:
std::vector<sptr<AbilityRuntime::IConnectionObserver>> GetObservers();

View File

@ -24,8 +24,10 @@
#include "application_state_observer_stub.h"
#include "connection_state_item.h"
#include "connection_observer_controller.h"
#ifdef WITH_DLP
#include "dlp_connection_info.h"
#include "dlp_state_item.h"
#endif // WITH_DLP
namespace OHOS {
namespace AAFwk {
@ -113,6 +115,7 @@ public:
*/
void HandleDataAbilityCallerDied(int32_t callerPid);
#ifdef WITH_DLP
/**
* add dlp manager to manager.
*
@ -140,6 +143,7 @@ public:
* @param dlpAbility dlp manager record.
*/
void RemoveDlpAbility(const std::shared_ptr<AbilityRecord> &dlpAbility);
#endif // WITH_DLP
/**
* handle app process died.
@ -148,12 +152,14 @@ public:
*/
void HandleAppDied(int32_t pid);
#ifdef WITH_DLP
/**
* get exist dlp connection infos.
*
* @param infos output dlp connection result.
*/
void GetDlpConnectionInfos(std::vector<AbilityRuntime::DlpConnectionInfo> &infos);
#endif // WITH_DLP
/**
* Get exist connection data including Extension and Data connection.
@ -201,8 +207,12 @@ private:
std::shared_ptr<ConnectionStateItem> RemoveDiedCaller(int32_t callerPid);
void HandleDataAbilityDiedInner(const sptr<IRemoteObject> &abilityToken,
std::vector<AbilityRuntime::ConnectionData> &allData);
#ifdef WITH_DLP
bool HandleDlpAbilityInner(const std::shared_ptr<AbilityRecord> &dlpAbility,
bool isAdd, AbilityRuntime::DlpStateData &dlpData);
#endif // WITH_DLP
void InitAppStateObserver();
private:
@ -211,8 +221,10 @@ private:
ffrt::mutex stateLock_;
std::unordered_map<int32_t, std::shared_ptr<ConnectionStateItem>> connectionStates_;
#ifdef WITH_DLP
ffrt::mutex dlpLock_;
std::unordered_map<int32_t, std::shared_ptr<DlpStateItem>> dlpItems_;
#endif // WITH_DLP
sptr<InnerAppStateObserver> appStateObserver_;
std::shared_ptr<TaskHandlerWrap> handler_;

View File

@ -71,6 +71,7 @@ using Dlp = Security::DlpPermission::DlpPermissionKit;
return true;
}
#ifdef WITH_DLP
[[maybe_unused]]static bool OtherAppsAccessDlpCheck(const sptr<IRemoteObject> &callerToken, const Want &want)
{
int32_t dlpIndex = want.GetIntParam(AbilityRuntime::ServerConstant::DLP_INDEX, 0);
@ -88,6 +89,7 @@ using Dlp = Security::DlpPermission::DlpPermissionKit;
return PermissionVerification::GetInstance()->VerifyDlpPermission(const_cast<Want &>(want));
}
#endif // WITH_DLP_
[[maybe_unused]]static bool SandboxAuthCheck(const AbilityRecord &callerRecord, const Want &want)
{

View File

@ -45,9 +45,12 @@ struct StartAbilityParams {
validUserId = value;
}
bool IsCallerSandboxApp();
#ifdef WITH_DLP
bool OtherAppsAccessDlp();
bool DlpAccessOtherApps();
bool SandboxExternalAuth();
#endif // WITH_DLP
bool IsCallerSysApp();
std::shared_ptr<AbilityRecord> GetCallerRecord();
int32_t GetCallerAppIndex();
@ -55,8 +58,10 @@ struct StartAbilityParams {
EventInfo BuildEventInfo();
private:
int32_t validUserId = 0;
#ifdef WITH_DLP
std::optional<bool> otherAppsAccessDlp;
std::optional<bool> dlpAccessOtherApps;
#endif // WITH_DLP
std::optional<bool> sandboxExternalAuth;
std::optional<bool> isCallerSysApp;
std::optional<std::shared_ptr<AbilityRecord>> callerRecord;

View File

@ -56,7 +56,9 @@
#include "connection_state_manager.h"
#include "display_manager.h"
#include "distributed_client.h"
#ifdef WITH_DLP
#include "dlp_utils.h"
#endif // WITH_DLP
#include "errors.h"
#include "extension_config.h"
#include "freeze_util.h"
@ -992,6 +994,7 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptr<IRemot
}
}
{
#ifdef WITH_DLP
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, "CHECK_DLP");
if (!DlpUtils::OtherAppsAccessDlpCheck(callerToken, want) ||
VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED ||
@ -1005,6 +1008,7 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptr<IRemot
return StartExtensionAbilityInner(want, callerToken, userId,
AppExecFwk::ExtensionAbilityType::SERVICE, false, false, true);
}
#endif // WITH_DLP
}
AbilityUtil::RemoveWindowModeKey(const_cast<Want &>(want));
@ -1301,6 +1305,7 @@ int AbilityManagerService::StartAbilityDetails(const Want &want, const AbilitySt
EventInfo eventInfo = BuildEventInfo(want, userId);
SendAbilityEvent(EventName::START_ABILITY, HiSysEventType::BEHAVIOR, eventInfo);
#ifdef WITH_DLP
if (!DlpUtils::OtherAppsAccessDlpCheck(callerToken, want) ||
VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED ||
!DlpUtils::DlpAccessOtherAppsCheck(callerToken, want)) {
@ -1309,6 +1314,7 @@ int AbilityManagerService::StartAbilityDetails(const Want &want, const AbilitySt
SendAbilityEvent(EventName::START_ABILITY_ERROR, HiSysEventType::FAULT, eventInfo);
return CHECK_PERMISSION_FAILED;
}
#endif // WITH_DLP
if (callerToken != nullptr && !VerificationAllToken(callerToken)) {
eventInfo.errCode = ERR_INVALID_VALUE;
@ -1574,6 +1580,7 @@ int AbilityManagerService::StartAbilityForOptionInner(const Want &want, const St
EventInfo eventInfo = BuildEventInfo(want, userId);
SendAbilityEvent(EventName::START_ABILITY, HiSysEventType::BEHAVIOR, eventInfo);
#ifdef WITH_DLP
if (!DlpUtils::OtherAppsAccessDlpCheck(callerToken, want) ||
VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED ||
!DlpUtils::DlpAccessOtherAppsCheck(callerToken, want)) {
@ -1582,6 +1589,7 @@ int AbilityManagerService::StartAbilityForOptionInner(const Want &want, const St
SendAbilityEvent(EventName::START_ABILITY_ERROR, HiSysEventType::FAULT, eventInfo);
return CHECK_PERMISSION_FAILED;
}
#endif // WITH_DLP
if (callerToken != nullptr && !VerificationAllToken(callerToken)) {
eventInfo.errCode = ERR_INVALID_VALUE;
@ -1852,6 +1860,7 @@ int32_t AbilityManagerService::RequestDialogServiceInner(const Want &want, const
}
{
#ifdef WITH_DLP
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, "CHECK_DLP");
if (!DlpUtils::OtherAppsAccessDlpCheck(callerToken, want) ||
!DlpUtils::DlpAccessOtherAppsCheck(callerToken, want)) {
@ -1863,6 +1872,7 @@ int32_t AbilityManagerService::RequestDialogServiceInner(const Want &want, const
TAG_LOGE(AAFwkTag::ABILITYMGR, "Cannot handle dlp by RequestDialogService.");
return ERR_WRONG_INTERFACE_CALL;
}
#endif // WITH_DLP
}
AbilityUtil::RemoveShowModeKey(const_cast<Want &>(want));
@ -2646,12 +2656,15 @@ int AbilityManagerService::StartExtensionAbilityInner(const Want &want, const sp
}
EventInfo eventInfo = BuildEventInfo(want, userId);
eventInfo.extensionType = static_cast<int32_t>(extensionType);
auto result = CheckDlpForExtension(want, callerToken, userId, eventInfo, EventName::START_EXTENSION_ERROR);
int result;
#ifdef WITH_DLP
result = CheckDlpForExtension(want, callerToken, userId, eventInfo, EventName::START_EXTENSION_ERROR);
if (result != ERR_OK) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "CheckDlpForExtension error.");
return result;
}
#endif // WITH_DLP
if (callerToken != nullptr && !VerificationAllToken(callerToken)) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s VerificationAllToken failed.", __func__);
@ -2715,6 +2728,7 @@ int AbilityManagerService::StartExtensionAbilityInner(const Want &want, const sp
TAG_LOGD(AAFwkTag::ABILITYMGR, "userId is : %{public}d, singleton is : %{public}d",
validUserId, static_cast<int>(abilityInfo.applicationInfo.singleton));
#ifdef WITH_DLP
result = isDlp ? IN_PROCESS_CALL(
CheckOptExtensionAbility(want, abilityRequest, validUserId, extensionType, isImplicit)) :
CheckOptExtensionAbility(want, abilityRequest, validUserId, extensionType, isImplicit);
@ -2724,6 +2738,7 @@ int AbilityManagerService::StartExtensionAbilityInner(const Want &want, const sp
EventReport::SendExtensionEvent(EventName::START_EXTENSION_ERROR, HiSysEventType::FAULT, eventInfo);
return result;
}
#endif // WITH_DLP
AbilityInterceptorParam afterCheckParam = AbilityInterceptorParam(abilityRequest.want, 0, GetUserId(),
false, callerToken, std::make_shared<AppExecFwk::AbilityInfo>(abilityInfo));
@ -2904,6 +2919,7 @@ int AbilityManagerService::StartUIExtensionAbility(const sptr<SessionInfo> &exte
sptr<IRemoteObject> callerToken = extensionSessionInfo->callerToken;
#ifdef WITH_DLP
if (!DlpUtils::OtherAppsAccessDlpCheck(callerToken, extensionSessionInfo->want) ||
VerifyAccountPermission(userId) == CHECK_PERMISSION_FAILED ||
!DlpUtils::DlpAccessOtherAppsCheck(callerToken, extensionSessionInfo->want)) {
@ -2912,6 +2928,7 @@ int AbilityManagerService::StartUIExtensionAbility(const sptr<SessionInfo> &exte
EventReport::SendExtensionEvent(EventName::START_EXTENSION_ERROR, HiSysEventType::FAULT, eventInfo);
return CHECK_PERMISSION_FAILED;
}
#endif // WITH_DLP
if (callerToken != nullptr && !VerificationAllToken(callerToken)) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "StartUIExtensionAbility VerificationAllToken failed.");
@ -3037,12 +3054,15 @@ int AbilityManagerService::StopExtensionAbility(const Want &want, const sptr<IRe
}
EventInfo eventInfo = BuildEventInfo(want, userId);
eventInfo.extensionType = static_cast<int32_t>(extensionType);
auto result = CheckDlpForExtension(want, callerToken, userId, eventInfo, EventName::STOP_EXTENSION_ERROR);
int result;
#ifdef WITH_DLP
result = CheckDlpForExtension(want, callerToken, userId, eventInfo, EventName::STOP_EXTENSION_ERROR);
if (result != ERR_OK) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "CheckDlpForExtension error.");
return result;
}
#endif // WITH_DLP
if (callerToken != nullptr && !VerificationAllToken(callerToken)) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s VerificationAllToken failed.", __func__);
@ -3637,14 +3657,17 @@ int AbilityManagerService::ConnectAbilityCommon(
CHECK_CALLER_IS_SYSTEM_APP;
}
EventInfo eventInfo = BuildEventInfo(want, userId);
auto result = CheckDlpForExtension(want, callerToken, userId, eventInfo, EventName::CONNECT_SERVICE_ERROR);
int result;
#ifdef WITH_DLP
result = CheckDlpForExtension(want, callerToken, userId, eventInfo, EventName::CONNECT_SERVICE_ERROR);
if (result != ERR_OK) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "CheckDlpForExtension error.");
eventInfo.errCode = result;
EventReport::SendExtensionEvent(EventName::CONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo);
return result;
}
#endif // WITH_DLP
AbilityInterceptorParam interceptorParam = AbilityInterceptorParam(want, 0, GetUserId(), false, nullptr);
result = interceptorExecuter_ == nullptr ? ERR_INVALID_VALUE :
@ -3749,14 +3772,17 @@ int AbilityManagerService::ConnectUIExtensionAbility(const Want &want, const spt
EventReport::SendExtensionEvent(EventName::CONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo);
return ERR_INVALID_CALLER;
}
auto result = CheckDlpForExtension(want, callerToken, userId, eventInfo, EventName::CONNECT_SERVICE_ERROR);
int result;
#ifdef WITH_DLP
result = CheckDlpForExtension(want, callerToken, userId, eventInfo, EventName::CONNECT_SERVICE_ERROR);
if (result != ERR_OK) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "CheckDlpForExtension error.");
eventInfo.errCode = result;
EventReport::SendExtensionEvent(EventName::CONNECT_SERVICE_ERROR, HiSysEventType::FAULT, eventInfo);
return result;
}
#endif // WITH_DLP
AbilityInterceptorParam interceptorParam = AbilityInterceptorParam(want, 0, GetUserId(), false, nullptr);
result = interceptorExecuter_ == nullptr ? ERR_INVALID_VALUE :
@ -4198,6 +4224,7 @@ int AbilityManagerService::UnregisterObserver(const sptr<AbilityRuntime::IConnec
return DelayedSingleton<ConnectionStateManager>::GetInstance()->UnregisterObserver(observer);
}
#ifdef WITH_DLP
int AbilityManagerService::GetDlpConnectionInfos(std::vector<AbilityRuntime::DlpConnectionInfo> &infos)
{
if (!AAFwk::PermissionVerification::GetInstance()->IsSACall()) {
@ -4208,6 +4235,7 @@ int AbilityManagerService::GetDlpConnectionInfos(std::vector<AbilityRuntime::Dlp
return ERR_OK;
}
#endif // WITH_DLP
int AbilityManagerService::GetConnectionData(std::vector<AbilityRuntime::ConnectionData> &connectionData)
{
@ -9404,6 +9432,7 @@ int AbilityManagerService::AddStartControlParam(Want &want, const sptr<IRemoteOb
return ERR_OK;
}
#ifdef WITH_DLP
int AbilityManagerService::CheckDlpForExtension(
const Want &want, const sptr<IRemoteObject> &callerToken,
int32_t userId, EventInfo &eventInfo, const EventName &eventName)
@ -9426,6 +9455,7 @@ int AbilityManagerService::CheckDlpForExtension(
}
return ERR_OK;
}
#endif // WITH_DLP
bool AbilityManagerService::JudgeSelfCalled(const std::shared_ptr<AbilityRecord> &abilityRecord)
{
@ -9623,11 +9653,13 @@ int32_t AbilityManagerService::NotifySaveAsResult(const Want &want, int resultCo
{
TAG_LOGD(AAFwkTag::ABILITYMGR, "requestCode is %{public}d.", requestCode);
#ifdef WITH_DLP
//caller check
if (!DlpUtils::CheckCallerIsDlpManager(GetBundleManager())) {
TAG_LOGW(AAFwkTag::ABILITYMGR, "caller check failed");
return CHECK_PERMISSION_FAILED;
}
#endif // WITH_DLP
for (const auto &item : startAbilityChain_) {
if (item.second->GetHandlerName() == StartAbilitySandboxSavefile::handlerName_) {

View File

@ -519,9 +519,11 @@ int AbilityManagerStub::OnRemoteRequestInnerThirteenth(uint32_t code, MessagePar
if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_CONNECTION_OBSERVER) {
return UnregisterConnectionObserverInner(data, reply);
}
#ifdef WITH_DLP
if (interfaceCode == AbilityManagerInterfaceCode::GET_DLP_CONNECTION_INFOS) {
return GetDlpConnectionInfosInner(data, reply);
}
#endif // WITH_DLP
if (interfaceCode == AbilityManagerInterfaceCode::MOVE_ABILITY_TO_BACKGROUND) {
return MoveAbilityToBackgroundInner(data, reply);
}
@ -2623,11 +2625,13 @@ int AbilityManagerStub::UnregisterObserver(const sptr<AbilityRuntime::IConnectio
return NO_ERROR;
}
#ifdef WITH_DLP
int AbilityManagerStub::GetDlpConnectionInfos(std::vector<AbilityRuntime::DlpConnectionInfo> &infos)
{
// should implement in child
return NO_ERROR;
}
#endif // WITH_DLP
int AbilityManagerStub::GetConnectionData(std::vector<AbilityRuntime::ConnectionData> &infos)
{
@ -2919,6 +2923,7 @@ int AbilityManagerStub::UnregisterConnectionObserverInner(MessageParcel &data, M
return UnregisterObserver(observer);
}
#ifdef WITH_DLP
int AbilityManagerStub::GetDlpConnectionInfosInner(MessageParcel &data, MessageParcel &reply)
{
std::vector<AbilityRuntime::DlpConnectionInfo> infos;
@ -2942,6 +2947,7 @@ int AbilityManagerStub::GetDlpConnectionInfosInner(MessageParcel &data, MessageP
return ERR_OK;
}
#endif // WITH_DLP
int AbilityManagerStub::GetConnectionDataInner(MessageParcel &data, MessageParcel &reply)
{

View File

@ -84,7 +84,9 @@ const std::string DMS_SRC_NETWORK_ID = "dmsSrcNetworkId";
const std::string ABILITY_OWNER_USERID = "AbilityMS_Owner_UserId";
const std::u16string SYSTEM_ABILITY_TOKEN_CALLBACK = u"ohos.aafwk.ISystemAbilityTokenCallback";
const std::string SHOW_ON_LOCK_SCREEN = "ShowOnLockScreen";
#ifdef WITH_DLP
const std::string DLP_BUNDLE_NAME = "com.ohos.dlpmanager";
#endif // WITH_DLP
const std::string COMPONENT_STARTUP_NEW_RULES = "component.startup.newRules";
const std::string KEY_MISSION_ID = "ohos.anco.param.missionId";
const std::string NEED_STARTINGWINDOW = "ohos.ability.NeedStartingWindow";
@ -1256,7 +1258,9 @@ int AbilityRecord::TerminateAbility()
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
TAG_LOGI(AAFwkTag::ABILITYMGR, "ability:%{public}s.", abilityInfo_.name.c_str());
#ifdef WITH_DLP
HandleDlpClosed();
#endif // WITH_DLP
AAFwk::EventInfo eventInfo;
eventInfo.bundleName = GetAbilityInfo().bundleName;
eventInfo.abilityName = GetAbilityInfo().name;
@ -1440,7 +1444,9 @@ void AbilityRecord::SetScheduler(const sptr<IAbilityScheduler> &scheduler)
pid_ = static_cast<int32_t>(IPCSkeleton::GetCallingPid()); // set pid when ability attach to service.
// add collaborator mission bind pid
NotifyMissionBindPid();
#ifdef WITH_DLP
HandleDlpAttached();
#endif // WITH_DLP
} else {
TAG_LOGE(AAFwkTag::ABILITYMGR, "scheduler is nullptr");
isReady_ = false;
@ -1598,7 +1604,9 @@ void AbilityRecord::Terminate(const Closure &task)
} else {
TAG_LOGI(AAFwkTag::ABILITYMGR, "Is debug mode, no need to handle time out.");
}
#ifdef WITH_DLP
HandleDlpClosed();
#endif // WITH_DLP
// schedule background after updating AbilityState and sending timeout message to avoid ability async callback
// earlier than above actions.
#ifdef SUPPORT_SCREEN
@ -2440,7 +2448,9 @@ void AbilityRecord::OnSchedulerDied(const wptr<IRemoteObject> &remote)
#ifdef SUPPORT_GRAPHICS
NotifyAnimationAbilityDied();
#endif
#ifdef WITH_DLP
HandleDlpClosed();
#endif // WITH_DLP
NotifyRemoveShellProcess(CollaboratorType::RESERVE_TYPE);
NotifyRemoveShellProcess(CollaboratorType::OTHERS_TYPE);
FreezeUtil::GetInstance().DeleteLifecycleEvent(object);
@ -2475,7 +2485,9 @@ void AbilityRecord::OnProcessDied()
#ifdef SUPPORT_GRAPHICS
NotifyAnimationAbilityDied();
#endif
#ifdef WITH_DLP
HandleDlpClosed();
#endif // WITH_DLP
NotifyRemoveShellProcess(CollaboratorType::RESERVE_TYPE);
NotifyRemoveShellProcess(CollaboratorType::OTHERS_TYPE);
}
@ -3266,6 +3278,7 @@ void AbilityRecord::RevokeUriPermission()
}
}
#ifdef WITH_DLP
void AbilityRecord::HandleDlpAttached()
{
if (abilityInfo_.bundleName == DLP_BUNDLE_NAME) {
@ -3287,6 +3300,7 @@ void AbilityRecord::HandleDlpClosed()
DelayedSingleton<ConnectionStateManager>::GetInstance()->RemoveDlpAbility(shared_from_this());
}
}
#endif // WITH_DLP
void AbilityRecord::NotifyRemoveShellProcess(int32_t type)
{

View File

@ -82,6 +82,7 @@ void ConnectionObserverController::NotifyExtensionDisconnected(const AbilityRunt
CallObservers(&AbilityRuntime::IConnectionObserver::OnExtensionDisconnected, data);
}
#ifdef WITH_DLP
void ConnectionObserverController::NotifyDlpAbilityOpened(const AbilityRuntime::DlpStateData& data)
{
CallObservers(&AbilityRuntime::IConnectionObserver::OnDlpAbilityOpened, data);
@ -91,6 +92,7 @@ void ConnectionObserverController::NotifyDlpAbilityClosed(const AbilityRuntime::
{
CallObservers(&AbilityRuntime::IConnectionObserver::OnDlpAbilityClosed, data);
}
#endif // WITH_DLP
std::vector<sptr<AbilityRuntime::IConnectionObserver>> ConnectionObserverController::GetObservers()
{

View File

@ -230,6 +230,7 @@ void ConnectionStateManager::HandleDataAbilityCallerDied(int32_t callerPid)
HandleCallerDied(callerPid);
}
#ifdef WITH_DLP
void ConnectionStateManager::AddDlpManager(const std::shared_ptr<AbilityRecord> &dlpManger)
{
if (!dlpManger) {
@ -283,12 +284,14 @@ void ConnectionStateManager::RemoveDlpAbility(const std::shared_ptr<AbilityRecor
}
controller->NotifyDlpAbilityClosed(dlpData);
}
#endif // WITH_DLP
void ConnectionStateManager::HandleAppDied(int32_t pid)
{
HandleCallerDied(pid);
}
#ifdef WITH_DLP
void ConnectionStateManager::GetDlpConnectionInfos(std::vector<AbilityRuntime::DlpConnectionInfo> &infos)
{
std::lock_guard<ffrt::mutex> guard(dlpLock_);
@ -304,6 +307,7 @@ void ConnectionStateManager::GetDlpConnectionInfos(std::vector<AbilityRuntime::D
infos.emplace_back(info);
}
}
#endif // WITH_DLP
void ConnectionStateManager::GetConnectionData(std::vector<AbilityRuntime::ConnectionData> &connectionData)
{
@ -478,6 +482,7 @@ void ConnectionStateManager::HandleDataAbilityDiedInner(const sptr<IRemoteObject
}
}
#ifdef WITH_DLP
bool ConnectionStateManager::HandleDlpAbilityInner(const std::shared_ptr<AbilityRecord> &dlpAbility,
bool isAdd, AbilityRuntime::DlpStateData &dlpData)
{
@ -510,6 +515,7 @@ bool ConnectionStateManager::HandleDlpAbilityInner(const std::shared_ptr<Ability
return dlpItem->RemoveDlpConnectionState(dlpAbility, dlpData);
}
#endif // WITH_DLP
void ConnectionStateManager::InitAppStateObserver()
{

View File

@ -264,6 +264,7 @@ std::string ImplicitStartProcessor::MatchTypeAndUri(const AAFwk::Want &want)
return "";
}
type = uri.substr(suffixIndex);
#ifdef WITH_DLP
if (type == ".dlp") {
auto suffixDlpIndex = uri.rfind('.', suffixIndex - 1);
if (suffixDlpIndex == std::string::npos) {
@ -272,6 +273,7 @@ std::string ImplicitStartProcessor::MatchTypeAndUri(const AAFwk::Want &want)
}
type = uri.substr(suffixDlpIndex, suffixIndex - suffixDlpIndex);
}
#endif // WITH_DLP
}
return type;
}

View File

@ -15,7 +15,9 @@
#include "start_ability_handler.h"
#ifdef WITH_DLP
#include "dlp_utils.h"
#endif // WITH_DLP
namespace OHOS {
namespace AAFwk {
@ -24,6 +26,7 @@ bool StartAbilityParams::IsCallerSandboxApp()
return GetCallerAppIndex() > 0;
}
#ifdef WITH_DLP
bool StartAbilityParams::OtherAppsAccessDlp()
{
if (otherAppsAccessDlp.has_value()) {
@ -55,6 +58,7 @@ bool StartAbilityParams::SandboxExternalAuth()
sandboxExternalAuth = DlpUtils::SandboxAuthCheck(*record, want);
return sandboxExternalAuth.value();
}
#endif // WITH_DLP
bool StartAbilityParams::IsCallerSysApp()
{

View File

@ -25,8 +25,10 @@
namespace OHOS {
namespace AAFwk {
namespace {
#ifdef WITH_DLP
const std::string DLP_BUNDLE_NAME = "com.ohos.dlpmanager";
const std::string DLP_ABILITY_NAME = "SaveAsAbility";
#endif // WITH_DLP
class EmptyConnection : public IRemoteStub<IAbilityConnection> {
public:
@ -51,10 +53,12 @@ bool StartAbilitySandboxSavefile::MatchStartRequest(StartAbilityParams &params)
}
auto element = params.want.GetElement();
#ifdef WITH_DLP
if (element.GetBundleName() == DLP_BUNDLE_NAME && element.GetAbilityName() == DLP_ABILITY_NAME &&
!ContainRecord(params.requestCode)) {
return true;
}
#endif // WITH_DLP
return false;
}
@ -68,14 +72,18 @@ int StartAbilitySandboxSavefile::HandleStartRequest(StartAbilityParams &params)
return CHECK_PERMISSION_FAILED;
}
#ifdef WITH_DLP
if (!params.SandboxExternalAuth()) {
TAG_LOGW(AAFwkTag::ABILITYMGR, "sandbox external auth failed");
return CHECK_PERMISSION_FAILED;
}
#endif // WITH_DLP
auto reqCode = PushRecord(params.requestCode, callerRecord);
auto &want = params.want;
#ifdef WITH_DLP
want.SetElementName(DLP_BUNDLE_NAME, DLP_ABILITY_NAME);
#endif // WITH_DLP
want.SetParam("requestCode", reqCode);
want.SetParam("startMode", std::string("save_redirect"));

View File

@ -33,9 +33,11 @@ static uint32_t BuildStartFlags(const AAFwk::Want &want, const ApplicationInfo &
startFlags = startFlags | (START_FLAG_BASE << StartFlags::COLD_START);
}
#ifdef WITH_DLP
if (want.GetIntParam(DLP_PARAMS_INDEX, 0) != 0) {
startFlags = startFlags | (START_FLAG_BASE << StartFlags::DLP_MANAGER);
}
#endif // WITH_DLP
if (applicationInfo.debug) {
startFlags = startFlags | (START_FLAG_BASE << StartFlags::DEBUGGABLE);

View File

@ -146,7 +146,11 @@ constexpr const char* ENTER_SANDBOX = "sandboxApp";
constexpr const char* PERMISSION_INTERNET = "ohos.permission.INTERNET";
constexpr const char* PERMISSION_MANAGE_VPN = "ohos.permission.MANAGE_VPN";
constexpr const char* PERMISSION_ACCESS_BUNDLE_DIR = "ohos.permission.ACCESS_BUNDLE_DIR";
#ifdef WITH_DLP
constexpr const char* DLP_PARAMS_SECURITY_FLAG = "ohos.dlp.params.securityFlag";
#endif // WITH_DLP
constexpr const char* SUPPORT_ISOLATION_MODE = "persist.bms.supportIsolationMode";
constexpr const char* SUPPORT_SERVICE_EXT_MULTI_PROCESS = "component.startup.extension.multiprocess.enable";
constexpr const char* SERVICE_EXT_MULTI_PROCESS_WHITE_LIST = "component.startup.extension.multiprocess.whitelist";
@ -1972,7 +1976,9 @@ std::shared_ptr<AppRunningRecord> AppMgrServiceInner::CreateAppRunningRecord(spt
int32_t appIndex = 0;
(void)AbilityRuntime::StartupUtil::GetAppIndex(*want, appIndex);
appRecord->SetAppIndex(appIndex);
#ifdef WITH_DLP
appRecord->SetSecurityFlag(want->GetBoolParam(DLP_PARAMS_SECURITY_FLAG, false));
#endif // WITH_DLP
appRecord->SetRequestProcCode(want->GetIntParam(Want::PARAM_RESV_REQUEST_PROC_CODE, 0));
appRecord->SetCallerPid(want->GetIntParam(Want::PARAM_RESV_CALLER_PID, -1));
appRecord->SetCallerUid(want->GetIntParam(Want::PARAM_RESV_CALLER_UID, -1));
@ -2298,7 +2304,9 @@ void AppMgrServiceInner::StartAbility(sptr<IRemoteObject> token, sptr<IRemoteObj
}
if (want) {
#ifdef WITH_DLP
want->SetParam(DLP_PARAMS_SECURITY_FLAG, appRecord->GetSecurityFlag());
#endif // WITH_DLP
auto isDebugApp = want->GetBoolParam(DEBUG_APP, false);
if (isDebugApp && !appRecord->IsDebugApp()) {

View File

@ -54,6 +54,8 @@ bool PermissionVerification::VerifyCallingPermission(
const std::string &permissionName, const uint32_t specifyTokenId) const
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
TAG_LOGD(AAFwkTag::DEFAULT, "VerifyCallingPermission permission %{public}s, specifyTokenId is %{public}u",
permissionName.c_str(), specifyTokenId);
auto callerToken = specifyTokenId == 0 ? GetCallingTokenID() : specifyTokenId;
TAG_LOGD(AAFwkTag::DEFAULT, "callerToken is %{public}u", callerToken);
int32_t ret = Security::AccessToken::AccessTokenKit::VerifyAccessToken(callerToken, permissionName, false);

View File

@ -134,8 +134,10 @@ void DoSomethingInterestingWithMyAPI2(AbilityManagerService &abilityms, Want& wa
sptr<AbilityRuntime::IConnectionObserver> observer;
abilityms.RegisterObserver(observer);
abilityms.UnregisterObserver(observer);
#ifdef WITH_DLP
std::vector<AbilityRuntime::DlpConnectionInfo> infos;
abilityms.GetDlpConnectionInfos(infos);
#endif // WITH_DLP
std::vector<AbilityRuntime::ConnectionData> connectionData;
abilityms.GetConnectionData(connectionData);

View File

@ -35,7 +35,9 @@ const std::u16string ABILITYMGR_INTERFACE_TOKEN = u"ohos.aafwk.AbilityManager";
bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
{
#ifdef WITH_DLP
uint32_t code = static_cast<uint32_t>(AbilityManagerInterfaceCode::GET_DLP_CONNECTION_INFOS);
#endif // WITH_DLP
MessageParcel parcel;
parcel.WriteInterfaceToken(ABILITYMGR_INTERFACE_TOKEN);
@ -47,7 +49,9 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
std::make_shared<SubManagersHelper>(nullptr, nullptr);
DelayedSingleton<AbilityManagerService>::GetInstance()->subManagersHelper_->currentUIAbilityManager_ =
std::make_shared<UIAbilityLifecycleManager>();
#ifdef WITH_DLP
DelayedSingleton<AbilityManagerService>::GetInstance()->OnRemoteRequest(code, parcel, reply, option);
#endif // WITH_DLP
return true;
}

View File

@ -61,10 +61,12 @@ public:
{}
void OnExtensionDisconnected(const ConnectionData& data) override
{}
#ifdef WITH_DLP
void OnDlpAbilityOpened(const DlpStateData& data) override
{}
void OnDlpAbilityClosed(const DlpStateData& data) override
{}
#endif // WITH_DLP
sptr<IRemoteObject> AsObject() override
{
return {};

View File

@ -70,9 +70,11 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
AbilityRuntime::ConnectionData connectionData;
connectionObserverClientImpl->HandleExtensionConnected(connectionData);
connectionObserverClientImpl->HandleExtensionDisconnected(connectionData);
#ifdef WITH_DLP
AbilityRuntime::DlpStateData dlpStateData;
connectionObserverClientImpl->HandleDlpAbilityOpened(dlpStateData);
connectionObserverClientImpl->HandleDlpAbilityClosed(dlpStateData);
#endif // WITH_DLP
sptr<IRemoteObject> remoteObj;
auto serviceProxyAdapter = std::make_shared<ServiceProxyAdapter>(remoteObj);
connectionObserverClientImpl->UnregisterFromServiceLocked(serviceProxyAdapter);

View File

@ -61,10 +61,12 @@ public:
{}
void OnExtensionDisconnected(const ConnectionData& data) override
{}
#ifdef WITH_DLP
void OnDlpAbilityOpened(const DlpStateData& data) override
{}
void OnDlpAbilityClosed(const DlpStateData& data) override
{}
#endif // WITH_DLP
sptr<IRemoteObject> AsObject() override
{
return {};
@ -128,9 +130,11 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
connectionObserverController->RemoveObserver(observer);
connectionObserverController->NotifyExtensionConnected(connectionData);
connectionObserverController->NotifyExtensionDisconnected(connectionData);
#ifdef WITH_DLP
AbilityRuntime::DlpStateData dlpStateData;
connectionObserverController->NotifyDlpAbilityOpened(dlpStateData);
connectionObserverController->NotifyDlpAbilityClosed(dlpStateData);
#endif // WITH_DLP
connectionObserverController->GetObservers();
wptr<IRemoteObject> remote;
connectionObserverController->HandleRemoteDied(remote);
@ -198,14 +202,18 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
connectionStateManager->CheckDataAbilityConnectionParams(dataCaller, dataAbility);
connectionStateManager->HandleDataAbilityDied(dataAbility);
connectionStateManager->HandleDataAbilityCallerDied(int32Param);
#ifdef WITH_DLP
std::shared_ptr<AbilityRecord> dlpManger = GetFuzzAbilityRecord();
connectionStateManager->AddDlpManager(dlpManger);
connectionStateManager->RemoveDlpManager(dlpManger);
connectionStateManager->AddDlpAbility(dlpManger);
connectionStateManager->RemoveDlpAbility(dlpManger);
#endif // WITH_DLP
connectionStateManager->HandleAppDied(int32Param);
#ifdef WITH_DLP
std::vector<AbilityRuntime::DlpConnectionInfo> infos;
connectionStateManager->GetDlpConnectionInfos(infos);
#endif // WITH_DLP
connectionStateManager->AddConnectionInner(connectionRecord, connectionData);
connectionStateManager->RemoveConnectionInner(connectionRecord, connectionData);
connectionStateManager->HandleCallerDied(int32Param);
@ -213,8 +221,10 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
connectionStateManager->AddDataAbilityConnectionInner(dataCaller, dataAbility, connectionData);
connectionStateManager->RemoveDataAbilityConnectionInner(dataCaller, dataAbility, connectionData);
connectionStateManager->HandleDataAbilityDiedInner(token, datas);
#ifdef WITH_DLP
AbilityRuntime::DlpStateData dlpData;
connectionStateManager->HandleDlpAbilityInner(dlpManger, boolParam, dlpData);
#endif // WITH_DLP
connectionStateManager->InitAppStateObserver();
if (want) {
delete want;

View File

@ -44,7 +44,9 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size)
if (wantParcel.WriteBuffer(data, size)) {
want = Want::Unmarshalling(wantParcel);
if (want) {
#ifdef WITH_DLP
abilitymgr->HandleDlpApp(*want);
#endif // WITH_DLP
delete want;
want = nullptr;
}

View File

@ -1749,6 +1749,7 @@ HWTEST_F(AbilityManagerClientBranchTest, StartAbilityByUIContentSession_0200, Te
GTEST_LOG_(INFO) << "StartUIExtensionAbility_0200 end";
}
#ifdef WITH_DLP
/**
* @tc.number: NotifySaveAsResult_0100
* @tc.name: NotifySaveAsResult
@ -1760,6 +1761,7 @@ HWTEST_F(AbilityManagerClientBranchTest, NotifySaveAsResult_0100, TestSize.Level
auto result = client_->NotifySaveAsResult(want, 0, 0);
EXPECT_EQ(result, ERR_OK);
}
#endif // WITH_DLP
/**
* @tc.number: PrepareTerminateAbility_0100
@ -1787,6 +1789,7 @@ HWTEST_F(AbilityManagerClientBranchTest, PrepareTerminateAbilityBySCB_0100, Test
EXPECT_EQ(result, ERR_OK);
}
#ifdef WITH_DLP
/**
* @tc.number: UpdateMissionSnapShot_0100
* @tc.name: UpdateMissionSnapShot
@ -1799,6 +1802,7 @@ HWTEST_F(AbilityManagerClientBranchTest, UpdateMissionSnapShot_0100, TestSize.Le
auto pixelMap = std::shared_ptr<Media::PixelMap>();
client_->UpdateMissionSnapShot(token, pixelMap);
}
#endif // WITH_DLP
/**
* @tc.name: AbilityManagerClient_RegisterSessionHandler_0100

View File

@ -236,6 +236,7 @@ HWTEST_F(AbilityManagerServiceFirstTest, CheckStartByCallPermission_002, TestSiz
TAG_LOGI(AAFwkTag::TEST, "AbilityManagerServiceFirstTest CheckStartByCallPermission_002 end");
}
#ifdef WITH_DLP
/*
* Feature: AbilityManagerService
* Function: GetDlpConnectionInfos
@ -255,6 +256,7 @@ HWTEST_F(AbilityManagerServiceFirstTest, GetDlpConnectionInfos_001, TestSize.Lev
MyFlag::flag_ = 0;
TAG_LOGI(AAFwkTag::TEST, "AbilityManagerServiceFirstTest GetDlpConnectionInfos_001 end");
}
#endif // WITH_DLP
/*
* Feature: AbilityManagerService

View File

@ -42,10 +42,12 @@ bool PermissionVerification::VerifyControllerPerm() const
{
return !!(MyFlag::flag_);
}
#ifdef WITH_DLP
bool PermissionVerification::VerifyDlpPermission(Want &want) const
{
return !!(MyFlag::flag_);
}
#endif // WITH_DLP
int PermissionVerification::VerifyAccountPermission() const
{
return MyFlag::flag_;

View File

@ -51,7 +51,9 @@ public:
bool VerifyControllerPerm() const;
#ifdef WITH_DLP
bool VerifyDlpPermission(Want &want) const;
#endif // WITH_DLP
int VerifyAccountPermission() const;

View File

@ -42,10 +42,12 @@ bool PermissionVerification::VerifyControllerPerm() const
{
return !!(MyFlag::flag_);
}
#ifdef WITH_DLP
bool PermissionVerification::VerifyDlpPermission(Want &want) const
{
return !!(MyFlag::flag_);
}
#endif // WITH_DLP
int PermissionVerification::VerifyAccountPermission() const
{
return MyFlag::flag_;

View File

@ -2208,6 +2208,7 @@ HWTEST_F(AbilityManagerServiceThirdTest, ChangeUIAbilityVisibilityBySCB_001, Tes
EXPECT_EQ(result, ERR_WRONG_INTERFACE_CALL);
}
#ifdef WITH_DLP
/*
* Feature: AbilityManagerService
* Function: StartExtensionAbilityInner
@ -2268,6 +2269,36 @@ HWTEST_F(AbilityManagerServiceThirdTest, StartExtensionAbilityInner_003, TestSiz
EXPECT_EQ(result, ERR_INVALID_CALLER);
}
/*
* Feature: AbilityManagerService
* Function: StartExtensionAbilityInner
* FunctionPoints: AbilityManagerService StartExtensionAbilityInner
*/
HWTEST_F(AbilityManagerServiceThirdTest, StartExtensionAbilityInner_004, TestSize.Level1)
{
TAG_LOGI(AAFwkTag::TEST, "AbilityManagerServiceThirdTest StartExtensionAbilityInner_004 start");
auto abilityMs = std::make_shared<AbilityManagerService>();
Want want;
sptr<IRemoteObject> callerToken = nullptr;
int32_t userId = 0;
AppExecFwk::ExtensionAbilityType extensionType = AppExecFwk::ExtensionAbilityType::VPN;
bool checkSystemCaller = true;
bool isImplicit = true;
bool isDlp = true;
abilityMs->interceptorExecuter_ = std::make_shared<AbilityInterceptorExecuter>();
abilityMs->subManagersHelper_ = std::make_shared<SubManagersHelper>(nullptr, nullptr);
auto result = abilityMs->StartExtensionAbilityInner(want, callerToken, userId, extensionType, checkSystemCaller,
isImplicit, isDlp);
EXPECT_EQ(result, ERR_IMPLICIT_START_ABILITY_FAIL);
abilityMs-> implicitStartProcessor_ = std::make_shared<ImplicitStartProcessor>();
result = abilityMs->StartExtensionAbilityInner(want, callerToken, userId, extensionType, checkSystemCaller,
isImplicit, isDlp);
EXPECT_EQ(result, ERR_IMPLICIT_START_ABILITY_FAIL);
TAG_LOGI(AAFwkTag::TEST, "AbilityManagerServiceThirdTest StartExtensionAbilityInner_004 end");
}
#endif // WITH_DLP
/*
* Feature: AbilityManagerService
* Function: MoveAbilityToBackground

View File

@ -2338,6 +2338,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_UnregisterObserver_001, Test
EXPECT_EQ(res, NO_ERROR);
}
#ifdef WITH_DLP
/*
* Feature: AbilityManagerService
* Function: GetDlpConnectionInfos
@ -2352,6 +2353,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_GetDlpConnectionInfos_001, T
auto res = stub_->GetDlpConnectionInfos(infos);
EXPECT_EQ(res, NO_ERROR);
}
#endif // WITH_DLP
/*
* Feature: AbilityManagerService
@ -2665,6 +2667,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_UnregisterConnectionObserver
EXPECT_EQ(res, ERR_NULL_OBJECT);
}
#ifdef WITH_DLP
/*
* Feature: AbilityManagerService
* Function: GetDlpConnectionInfosInner
@ -2680,6 +2683,7 @@ HWTEST_F(AbilityManagerStubTest, AbilityManagerStub_GetDlpConnectionInfosInner_0
auto res = stub_->GetDlpConnectionInfosInner(data, reply);
EXPECT_EQ(res, ERR_OK);
}
#endif // WITH_DLP
/*
* Feature: AbilityManagerService

View File

@ -51,7 +51,9 @@ namespace OHOS {
namespace AAFwk {
namespace {
const std::string DEBUG_APP = "debugApp";
#ifdef WITH_DLP
const std::string DLP_BUNDLE_NAME = "com.ohos.dlpmanager";
#endif // WITH_DLP
const std::string SHELL_ASSISTANT_BUNDLENAME = "com.huawei.shell_assistant";
const std::string SHOW_ON_LOCK_SCREEN = "ShowOnLockScreen";
const std::string URI_PERMISSION_TABLE_NAME = "uri_permission";
@ -2292,6 +2294,7 @@ HWTEST_F(AbilityRecordTest, AbilityRecord_RevokeUriPermission_001, TestSize.Leve
abilityRecord->RevokeUriPermission();
}
#ifdef WITH_DLP
/*
* Feature: AbilityRecord
* Function: HandleDlpClosed
@ -2308,6 +2311,7 @@ HWTEST_F(AbilityRecordTest, AbilityRecord_HandleDlpClosed_001, TestSize.Level1)
abilityRecord->appIndex_ = 1;
abilityRecord->HandleDlpClosed();
}
#endif // WITH_DLP
/*
* Feature: AbilityRecord

View File

@ -51,7 +51,9 @@ struct VerificationInfo {
bool VerifyControllerPerm() const;
#ifdef WITH_DLP
bool VerifyDlpPermission(Want &want) const;
#endif // WITH_DLP
int VerifyAccountPermission() const;

View File

@ -42,10 +42,12 @@ bool PermissionVerification::VerifyControllerPerm() const
{
return !!(MyFlag::flag_);
}
#ifdef WITH_DLP
bool PermissionVerification::VerifyDlpPermission(Want &want) const
{
return !!(MyFlag::flag_);
}
#endif // WITH_DLP
int PermissionVerification::VerifyAccountPermission() const
{
return MyFlag::flag_;

View File

@ -51,7 +51,9 @@ struct VerificationInfo {
bool VerifyControllerPerm() const;
#ifdef WITH_DLP
bool VerifyDlpPermission(Want &want) const;
#endif // WITH_DLP
int VerifyAccountPermission() const;

View File

@ -44,10 +44,12 @@ bool PermissionVerification::VerifyControllerPerm() const
{
return !!(MyFlag::flag_);
}
#ifdef WITH_DLP
bool PermissionVerification::VerifyDlpPermission(Want &want) const
{
return !!(MyFlag::flag_);
}
#endif // WITH_DLP
int PermissionVerification::VerifyAccountPermission() const
{
return MyFlag::flag_;

View File

@ -3149,6 +3149,7 @@ HWTEST_F(AppMgrServiceInnerTest, AttachRenderProcess_002, TestSize.Level0)
TAG_LOGI(AAFwkTag::TEST, "AttachRenderProcess_002 end");
}
#ifdef WITH_DLP
/**
* @tc.name: BuildStartFlags_001
* @tc.desc: build start flags.
@ -3171,6 +3172,7 @@ HWTEST_F(AppMgrServiceInnerTest, BuildStartFlags_001, TestSize.Level0)
TAG_LOGI(AAFwkTag::TEST, "BuildStartFlags_001 end");
}
#endif // WITH_DLP
/**
* @tc.name: RegisterFocusListener_001

View File

@ -29,7 +29,9 @@ const int32_t ABILITY_INFO_FLAG = 4;
const int32_t DEFAULT_USERID = 100;
const int32_t FIRST_APP_INDEX = 1000;
const int32_t SECOND_APP_INDEX = 2000;
#ifdef WITH_DLP
const int32_t ERR_COD1 = 8519801;
#endif // WITH_DLP
const int32_t ERR_COD3 = 8519802;
const int32_t ERR_COD4 = 8519921;
const int32_t ERR_COD5 = 8519816;
@ -507,6 +509,7 @@ HWTEST_F(BundleMgrHelperTest, BundleMgrHelperTest_GetDefaultAppProxy_001, TestSi
EXPECT_NE(ret, nullptr);
}
#ifdef WITH_DLP
/**
* @tc.name: BundleMgrHelperTest_InstallSandboxApp_001
* @tc.desc: InstallSandboxApp
@ -536,6 +539,7 @@ HWTEST_F(BundleMgrHelperTest, BundleMgrHelperTest_InstallSandboxApp_002, TestSiz
auto ret = bundleMgrHelper->InstallSandboxApp(bundleName, dlpType, userId, appIndex);
EXPECT_EQ(ret, ERR_COD1);
}
#endif // WITH_DLP
/**
* @tc.name: BundleMgrHelperTest_UninstallSandboxApp_001

View File

@ -106,6 +106,7 @@ HWTEST_F(ConnectionObserverControllerTest, NotifyExtensionDisconnected_001, Test
connectionObserverController->NotifyExtensionDisconnected(data);
}
#ifdef WITH_DLP
/*
* Feature: ConnectionObserverController
* Function: NotifyDlpAbilityOpened
@ -137,6 +138,7 @@ HWTEST_F(ConnectionObserverControllerTest, NotifyDlpAbilityClosed_001, TestSize.
DlpStateData data;
connectionObserverController->NotifyDlpAbilityClosed(data);
}
#endif // WITH_DLP
/*
* Feature: ConnectionObserverController

View File

@ -23,7 +23,9 @@
#include "connection_data.h"
#include "connection_observer_client.h"
#include "connection_observer_client_impl.h"
#ifdef WITH_DLP
#include "dlp_state_data.h"
#endif // WITH_DLP
#include "hilog_tag_wrapper.h"
#include "mock_native_token.h"
#include "parcel.h"
@ -162,6 +164,7 @@ HWTEST_F(ConnectionObserverTest, ConnectionObserver_Data_0100, TestSize.Level1)
TAG_LOGI(AAFwkTag::TEST, "ConnectionObserver_Data_0100 end");
}
#ifdef WITH_DLP
/**
* @tc.name: ConnectionObserver_Data_0200
* @tc.desc: DlpState data test.
@ -298,5 +301,6 @@ HWTEST_F(ConnectionObserverTest, ConnectionObserver_Observer_0200, TestSize.Leve
SetSelfTokenID(currentID);
TAG_LOGI(AAFwkTag::TEST, "ConnectionObserver_Observer_0200 end");
}
#endif // WITH_DLP
} // namespace AbilityRuntime
} // namespace OHOS

View File

@ -21,7 +21,9 @@
#include "ability_record.h"
#include "connection_observer_errors.h"
#include "data_ability_record.h"
#ifdef WITH_DLP
#include "dlp_state_item.h"
#endif // WITH_DLP
using namespace testing::ext;
using namespace OHOS::AbilityRuntime;
@ -409,6 +411,7 @@ HWTEST_F(ConnectionStateManagerTest, HandleDataAbilityCallerDied_002, TestSize.L
manager_->HandleDataAbilityCallerDied(callerPid);
}
#ifdef WITH_DLP
/*
* Feature: ConnectionStateManager
* Function: AddDlpManager
@ -544,6 +547,7 @@ HWTEST_F(ConnectionStateManagerTest, RemoveDlpAbility_002, TestSize.Level1)
manager_->Init();
manager_->RemoveDlpAbility(abilityRecord);
}
#endif // WITH_DLP
/*
* Feature: ConnectionStateManager
@ -560,6 +564,7 @@ HWTEST_F(ConnectionStateManagerTest, HandleAppDied_001, TestSize.Level1)
manager_->HandleAppDied(pid);
}
#ifdef WITH_DLP
/*
* Feature: ConnectionStateManager
* Function: GetDlpConnectionInfos
@ -576,6 +581,7 @@ HWTEST_F(ConnectionStateManagerTest, GetDlpConnectionInfos_001, TestSize.Level1)
manager_->dlpItems_[1] = nullptr;
manager_->GetDlpConnectionInfos(infos);
}
#endif // WITH_DLP
/*
* Feature: ConnectionStateManager
@ -706,6 +712,7 @@ HWTEST_F(ConnectionStateManagerTest, HandleDataAbilityDiedInner_001, TestSize.Le
manager_->HandleDataAbilityDiedInner(abilityToken, allData);
}
#ifdef WITH_DLP
/*
* Feature: ConnectionStateManager
* Function: HandleDlpAbilityInner
@ -821,5 +828,6 @@ HWTEST_F(ConnectionStateManagerTest, HandleDlpAbilityInner_006, TestSize.Level1)
bool res = manager_->HandleDlpAbilityInner(dlpAbility, isAdd, dlpData);
EXPECT_FALSE(res);
}
#endif // WITH_DLP
} // namespace AAFwk
} // namespace OHOS

View File

@ -42,6 +42,7 @@ void DlpUtilsTest::SetUp()
void DlpUtilsTest::TearDown()
{}
#ifdef WITH_DLP
/**
* @tc.name: OtherAppsAccessDlpCheck_0100
* @tc.desc: OtherAppsAccessDlpCheck Test
@ -90,5 +91,6 @@ HWTEST_F(DlpUtilsTest, DlpAccessOtherAppsCheck_0100, TestSize.Level0)
bool result = DlpUtils::DlpAccessOtherAppsCheck(abilityRecord->GetToken(), want);
EXPECT_TRUE(result);
}
#endif // WITH_DLP
} // namespace AAFwk
} // namespace OHOS

View File

@ -33,7 +33,9 @@ using namespace OHOS::AppExecFwk;
namespace OHOS {
namespace AAFwk {
namespace {
#ifdef WITH_DLP
const std::string DLP_INDEX = "ohos.dlp.params.index";
#endif // WITH_DLP
}
class MissionListManagerTest : public testing::Test {
public:
@ -958,6 +960,7 @@ HWTEST_F(MissionListManagerTest, CreateOrReusedMissionInfo_007, TestSize.Level1)
missionListManager.reset();
}
#ifdef WITH_DLP
/*
* Feature: MissionListManager
* Function: BuildInnerMissionInfo
@ -1004,6 +1007,7 @@ HWTEST_F(MissionListManagerTest, BuildInnerMissionInfo_002, TestSize.Level1)
missionListManager->BuildInnerMissionInfo(info, missionName, abilityRequest);
missionListManager.reset();
}
#endif // WITH_DLP
/*
* Feature: MissionListManager

View File

@ -24,7 +24,9 @@ using namespace OHOS::AppExecFwk;
namespace OHOS {
namespace AAFwk {
namespace {
#ifdef WITH_DLP
const std::string DLP_PARAMS_INDEX = "ohos.dlp.params.index";
#endif // WITH_DLP
}
class PermissionVerificationTest : public testing::Test {
public:
@ -158,6 +160,7 @@ HWTEST_F(PermissionVerificationTest, VerifyControllerPerm_0100, TestSize.Level0)
EXPECT_FALSE(result);
}
#ifdef WITH_DLP
/**
* @tc.name: VerifyDlpPermission_0100
* @tc.desc: VerifyDlpPermission Test
@ -171,6 +174,7 @@ HWTEST_F(PermissionVerificationTest, VerifyDlpPermission_0100, TestSize.Level0)
bool result = AAFwk::PermissionVerification::GetInstance()->VerifyDlpPermission(want);
EXPECT_FALSE(result);
}
#endif // WITH_DLP
/**
* @tc.name: VerifyMissionPermission_0100

View File

@ -44,6 +44,7 @@ void AbilityUtilTest::SetUp()
void AbilityUtilTest::TearDown()
{}
#ifdef WITH_DLP
/**
* @tc.name: HandleDlpApp_0100
* @tc.desc: HandleDlpApp Test
@ -130,6 +131,7 @@ HWTEST_F(AbilityUtilTest, HandleDlpApp_0600, TestSize.Level0)
bool result = AbilityUtil::HandleDlpApp(want);
EXPECT_FALSE(result);
}
#endif // WITH_DLP
/**
* @tc.name: ProcessWindowMode_0100

View File

@ -50,7 +50,9 @@ public:
bool VerifyControllerPerm() const;
#ifdef WITH_DLP
bool VerifyDlpPermission(Want &want) const;
#endif // WITH_DLP
int VerifyAccountPermission() const;

View File

@ -41,10 +41,12 @@ bool PermissionVerification::VerifyControllerPerm() const
{
return !!(MyFlag::flag_);
}
#ifdef WITH_DLP
bool PermissionVerification::VerifyDlpPermission(Want &want) const
{
return !!(MyFlag::flag_);
}
#endif // WITH_DLP
int PermissionVerification::VerifyAccountPermission() const
{
return MyFlag::flag_;

View File

@ -38,7 +38,9 @@ using namespace testing::ext;
namespace OHOS {
namespace AAFwk {
namespace {
#ifdef WITH_DLP
const std::string DLP_INDEX = "ohos.dlp.params.index";
#endif // WITH_DLP
constexpr int32_t TEST_UID = 20010001;
};
class UIAbilityLifecycleManagerTest : public testing::Test {
@ -2295,6 +2297,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, OnAcceptWantResponse_001, TestSize.Level
uiAbilityLifecycleManager.reset();
}
#ifdef WITH_DLP
/**
* @tc.name: UIAbilityLifecycleManager_OnAcceptWantResponse_0200
* @tc.desc: OnAcceptWantResponse
@ -2335,6 +2338,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, OnAcceptWantResponse_002, TestSize.Level
uiAbilityLifecycleManager->OnAcceptWantResponse(want, flag);
uiAbilityLifecycleManager.reset();
}
#endif // WITH_DLP
/**
* @tc.name: UIAbilityLifecycleManager_StartSpecifiedAbilityBySCB_0100
@ -3875,6 +3879,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, DispatchBackground_002, TestSize.Level1)
EXPECT_EQ(uiAbilityLifecycleManager->DispatchBackground(abilityRecord), ERR_INVALID_VALUE);
}
#ifdef WITH_DLP
/**
* @tc.name: UIAbilityLifecycleManager_CheckProperties_0100
* @tc.desc: CheckProperties
@ -3946,6 +3951,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, CheckProperties_003, TestSize.Level1)
auto ret = uiAbilityLifecycleManager->CheckProperties(abilityRecord, abilityRequest, launchMode);
EXPECT_EQ(ret, true);
}
#endif // WITH_DLP
/**
* @tc.name: UIAbilityLifecycleManager_ResolveAbility_0100

View File

@ -53,7 +53,9 @@ struct VerificationInfo {
bool VerifyControllerPerm() const;
#ifdef WITH_DLP
bool VerifyDlpPermission(Want &want) const;
#endif // WITH_DLP
int VerifyAccountPermission() const;

View File

@ -79,10 +79,12 @@ bool PermissionVerification::VerifyControllerPerm() const
{
return !!(MyFlag::flag_);
}
#ifdef WITH_DLP
bool PermissionVerification::VerifyDlpPermission(Want &want) const
{
return !!(MyFlag::flag_);
}
#endif // WITH_DLP
int PermissionVerification::VerifyAccountPermission() const
{
return MyFlag::flag_;