mirror of
https://github.com/openharmony/security_security_component_manager.git
synced 2026-08-24 22:51:27 -04:00
fit multi-display
Signed-off-by: baoyang <baoyang9@huawei.com> Change-Id: Ibd6c68f3e0bd083952028b9aeef328a31fa23163
This commit is contained in:
@@ -71,6 +71,7 @@ void TestCommon::BuildLocationComponentInfo(nlohmann::json& jsonComponent)
|
||||
{ JsonTagConstants::JSON_BG_TAG, SecCompBackground::CIRCLE },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0;
|
||||
jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0;
|
||||
}
|
||||
|
||||
void TestCommon::BuildSaveComponentInfo(nlohmann::json& jsonComponent)
|
||||
@@ -127,6 +128,7 @@ void TestCommon::BuildSaveComponentInfo(nlohmann::json& jsonComponent)
|
||||
{ JsonTagConstants::JSON_BG_TAG, SecCompBackground::CIRCLE },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0;
|
||||
jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0;
|
||||
}
|
||||
|
||||
void TestCommon::BuildPasteComponentInfo(nlohmann::json& jsonComponent)
|
||||
@@ -183,6 +185,7 @@ void TestCommon::BuildPasteComponentInfo(nlohmann::json& jsonComponent)
|
||||
{ JsonTagConstants::JSON_BG_TAG, SecCompBackground::CIRCLE },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0;
|
||||
jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0;
|
||||
}
|
||||
} // namespace SecurityComponent
|
||||
} // namespace Security
|
||||
|
||||
@@ -62,6 +62,7 @@ const std::string JsonTagConstants::JSON_TEXT_TAG = "text";
|
||||
const std::string JsonTagConstants::JSON_ICON_TAG = "icon";
|
||||
const std::string JsonTagConstants::JSON_BG_TAG = "bg";
|
||||
const std::string JsonTagConstants::JSON_WINDOW_ID = "windowId";
|
||||
const std::string JsonTagConstants::JSON_DISPLAY_ID = "displayId";
|
||||
|
||||
bool SecCompBase::ParseDimension(const nlohmann::json& json, const std::string& tag, DimensionT& res)
|
||||
{
|
||||
@@ -295,6 +296,13 @@ bool SecCompBase::FromJson(const nlohmann::json& jsonSrc)
|
||||
return false;
|
||||
}
|
||||
windowId_ = jsonSrc.at(JsonTagConstants::JSON_WINDOW_ID).get<int32_t>();
|
||||
|
||||
if ((jsonSrc.find(JsonTagConstants::JSON_DISPLAY_ID) == jsonSrc.end()) ||
|
||||
!jsonSrc.at(JsonTagConstants::JSON_DISPLAY_ID).is_number()) {
|
||||
SC_LOG_ERROR(LABEL, "json: %{public}s tag invalid.", JsonTagConstants::JSON_DISPLAY_ID.c_str());
|
||||
return false;
|
||||
}
|
||||
displayId_ = jsonSrc.at(JsonTagConstants::JSON_DISPLAY_ID).get<uint64_t>();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -353,6 +361,7 @@ void SecCompBase::ToJson(nlohmann::json& jsonRes) const
|
||||
{ JsonTagConstants::JSON_BG_TAG, bg_ },
|
||||
};
|
||||
jsonRes[JsonTagConstants::JSON_WINDOW_ID] = windowId_;
|
||||
jsonRes[JsonTagConstants::JSON_DISPLAY_ID] = displayId_;
|
||||
}
|
||||
|
||||
std::string SecCompBase::ToJsonStr() const
|
||||
|
||||
@@ -78,6 +78,7 @@ public:
|
||||
static const std::string JSON_ICON_TAG;
|
||||
static const std::string JSON_BG_TAG;
|
||||
static const std::string JSON_WINDOW_ID;
|
||||
static const std::string JSON_DISPLAY_ID;
|
||||
};
|
||||
|
||||
class __attribute__((visibility("default"))) SecCompBase {
|
||||
@@ -131,6 +132,7 @@ public:
|
||||
SecCompBackground bg_ = SecCompBackground::UNKNOWN_BG;
|
||||
|
||||
int32_t windowId_ = 0;
|
||||
uint64_t displayId_ = 0;
|
||||
int32_t nodeId_ = 0;
|
||||
protected:
|
||||
virtual bool IsTextIconTypeValid() = 0;
|
||||
|
||||
@@ -38,7 +38,7 @@ class __attribute__((visibility("default"))) SecCompInfoHelper {
|
||||
public:
|
||||
static SecCompBase* ParseComponent(SecCompType type, const nlohmann::json& jsonComponent);
|
||||
static bool CheckComponentValid(SecCompBase* comp);
|
||||
static bool CheckRectValid(const SecCompRect& rect, const SecCompRect& windowRect);
|
||||
static bool CheckRectValid(const SecCompRect& rect, const SecCompRect& windowRect, const uint64_t displayId);
|
||||
|
||||
private:
|
||||
static float GetWindowScale(int32_t windowId);
|
||||
|
||||
@@ -47,6 +47,7 @@ const std::string TYPE_KEY = "ohos.user.security.type";
|
||||
const std::string TOKEN_KEY = "ohos.ability.params.token";
|
||||
const std::string CALLBACK_KEY = "ohos.ability.params.callback";
|
||||
const std::string CALLER_UID_KEY = "ohos.caller.uid";
|
||||
const std::string DISPLAY_ID = "ohos.display.id";
|
||||
|
||||
constexpr uint32_t MAX_CFG_FILE_SIZE = 100 * 1024; // 100k
|
||||
constexpr uint64_t LOCATION_BUTTON_FIRST_USE = 1 << 0;
|
||||
@@ -296,7 +297,7 @@ int32_t FirstUseDialog::GrantDialogWaitEntity(int32_t scId)
|
||||
}
|
||||
|
||||
void FirstUseDialog::StartDialogAbility(std::shared_ptr<SecCompEntity> entity,
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback)
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback, const uint64_t displayId)
|
||||
{
|
||||
int32_t typeNum;
|
||||
SecCompType type = entity->GetType();
|
||||
@@ -323,6 +324,7 @@ void FirstUseDialog::StartDialogAbility(std::shared_ptr<SecCompEntity> entity,
|
||||
want.SetParam(CALLBACK_KEY, srvCallback);
|
||||
int32_t uid = IPCSkeleton::GetCallingUid();
|
||||
want.SetParam(CALLER_UID_KEY, uid);
|
||||
want.SetParam(DISPLAY_ID, static_cast<long long>(displayId));
|
||||
int startRes = AAFwk::AbilityManagerClient::GetInstance()->StartExtensionAbility(want, callerToken);
|
||||
SC_LOG_INFO(LABEL, "start ability res %{public}d", startRes);
|
||||
if (startRes != 0) {
|
||||
@@ -373,7 +375,7 @@ bool FirstUseDialog::SetFirstUseMap(std::shared_ptr<SecCompEntity> entity)
|
||||
}
|
||||
|
||||
int32_t FirstUseDialog::NotifyFirstUseDialog(std::shared_ptr<SecCompEntity> entity,
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback)
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback, const uint64_t displayId)
|
||||
{
|
||||
if (entity == nullptr) {
|
||||
SC_LOG_ERROR(LABEL, "Entity is invalid.");
|
||||
@@ -409,7 +411,7 @@ int32_t FirstUseDialog::NotifyFirstUseDialog(std::shared_ptr<SecCompEntity> enti
|
||||
auto iter = firstUseMap_.find(tokenId);
|
||||
if (iter == firstUseMap_.end()) {
|
||||
SC_LOG_INFO(LABEL, "has not use record, start dialog");
|
||||
StartDialogAbility(entity, callerToken, dialogCallback);
|
||||
StartDialogAbility(entity, callerToken, dialogCallback, displayId);
|
||||
return SC_SERVICE_ERROR_WAIT_FOR_DIALOG_CLOSE;
|
||||
}
|
||||
|
||||
@@ -418,7 +420,7 @@ int32_t FirstUseDialog::NotifyFirstUseDialog(std::shared_ptr<SecCompEntity> enti
|
||||
SC_LOG_INFO(LABEL, "no need notify again.");
|
||||
return SC_OK;
|
||||
}
|
||||
StartDialogAbility(entity, callerToken, dialogCallback);
|
||||
StartDialogAbility(entity, callerToken, dialogCallback, displayId);
|
||||
return SC_SERVICE_ERROR_WAIT_FOR_DIALOG_CLOSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
|
||||
~FirstUseDialog() = default;
|
||||
int32_t NotifyFirstUseDialog(std::shared_ptr<SecCompEntity> entity,
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback);
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback, const uint64_t displayId);
|
||||
void Init(std::shared_ptr<SecEventHandler> secHandler);
|
||||
int32_t GrantDialogWaitEntity(int32_t scId);
|
||||
void RemoveDialogWaitEntitys(int32_t pid);
|
||||
@@ -73,7 +73,7 @@ private:
|
||||
void LoadFirstUseRecord(void);
|
||||
void SaveFirstUseRecord(void);
|
||||
void StartDialogAbility(std::shared_ptr<SecCompEntity> entity,
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback);
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback, const uint64_t displayId);
|
||||
void SendSaveEventHandler(void);
|
||||
|
||||
std::mutex useMapMutex_;
|
||||
|
||||
@@ -72,10 +72,10 @@ SecCompBase* SecCompInfoHelper::ParseComponent(SecCompType type, const nlohmann:
|
||||
return comp;
|
||||
}
|
||||
|
||||
static bool GetScreenSize(double& width, double& height)
|
||||
static bool GetScreenSize(double& width, double& height, const uint64_t displayId)
|
||||
{
|
||||
sptr<OHOS::Rosen::Display> display =
|
||||
OHOS::Rosen::DisplayManager::GetInstance().GetDefaultDisplaySync();
|
||||
OHOS::Rosen::DisplayManager::GetInstance().GetDisplayById(displayId);
|
||||
if (display == nullptr) {
|
||||
SC_LOG_ERROR(LABEL, "Get display manager failed");
|
||||
return false;
|
||||
@@ -94,11 +94,12 @@ static bool GetScreenSize(double& width, double& height)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SecCompInfoHelper::CheckRectValid(const SecCompRect& rect, const SecCompRect& windowRect)
|
||||
bool SecCompInfoHelper::CheckRectValid(const SecCompRect& rect, const SecCompRect& windowRect,
|
||||
const uint64_t displayId)
|
||||
{
|
||||
double curScreenWidth = 0.0F;
|
||||
double curScreenHeight = 0.0F;
|
||||
if (!GetScreenSize(curScreenWidth, curScreenHeight)) {
|
||||
if (!GetScreenSize(curScreenWidth, curScreenHeight, displayId)) {
|
||||
SC_LOG_ERROR(LABEL, "Get screen size is invalid");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -467,7 +467,8 @@ int32_t SecCompManager::CheckClickSecurityComponentInfo(std::shared_ptr<SecCompE
|
||||
"CALLER_BUNDLE_NAME", bundleName, "COMPONENT_INFO", jsonComponent.dump().c_str());
|
||||
}
|
||||
|
||||
if ((!SecCompInfoHelper::CheckRectValid(reportComponentInfo->rect_, reportComponentInfo->windowRect_))) {
|
||||
if ((!SecCompInfoHelper::CheckRectValid(reportComponentInfo->rect_, reportComponentInfo->windowRect_,
|
||||
report->displayId_))) {
|
||||
SC_LOG_ERROR(LABEL, "compare component info failed.");
|
||||
HiSysEventWrite(HiviewDFX::HiSysEvent::Domain::SEC_COMPONENT, "COMPONENT_INFO_CHECK_FAILED",
|
||||
HiviewDFX::HiSysEvent::EventType::SECURITY, "CALLER_UID", uid, "CALLER_BUNDLE_NAME", bundleName,
|
||||
@@ -538,7 +539,8 @@ int32_t SecCompManager::ReportSecurityComponentClickEvent(int32_t scId,
|
||||
return SC_SERVICE_ERROR_CLICK_EVENT_INVALID;
|
||||
}
|
||||
|
||||
if (FirstUseDialog::GetInstance().NotifyFirstUseDialog(sc, callerToken, dialogCallback) ==
|
||||
SecCompBase* report = SecCompInfoHelper::ParseComponent(sc->GetType(), jsonComponent);
|
||||
if (FirstUseDialog::GetInstance().NotifyFirstUseDialog(sc, callerToken, dialogCallback, report->displayId_) ==
|
||||
SC_SERVICE_ERROR_WAIT_FOR_DIALOG_CLOSE) {
|
||||
SC_LOG_INFO(LABEL, "start dialog, onclick will be trap after dialog closed.");
|
||||
return SC_SERVICE_ERROR_WAIT_FOR_DIALOG_CLOSE;
|
||||
|
||||
@@ -407,46 +407,46 @@ HWTEST_F(FirstUseDialogTest, NotifyFirstUseDialog001, TestSize.Level1)
|
||||
diag.secHandler_ = nullptr;
|
||||
|
||||
// no entity
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(nullptr, nullptr, nullptr), SC_SERVICE_ERROR_VALUE_INVALID);
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(nullptr, nullptr, nullptr, 0), SC_SERVICE_ERROR_VALUE_INVALID);
|
||||
|
||||
std::shared_ptr<SecCompEntity> entity = std::make_shared<SecCompEntity>(nullptr, 0, 0, 0, 0);
|
||||
// no handler
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, nullptr, nullptr), SC_SERVICE_ERROR_VALUE_INVALID);
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, nullptr, nullptr, 0), SC_SERVICE_ERROR_VALUE_INVALID);
|
||||
|
||||
// no calltoken
|
||||
std::shared_ptr<AppExecFwk::EventRunner> runner = AppExecFwk::EventRunner::Create(true);
|
||||
ASSERT_NE(nullptr, runner);
|
||||
std::shared_ptr<SecEventHandler> handler = std::make_shared<SecEventHandler>(runner);
|
||||
diag.secHandler_ = handler;
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, nullptr, nullptr), SC_SERVICE_ERROR_VALUE_INVALID);
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, nullptr, nullptr, 0), SC_SERVICE_ERROR_VALUE_INVALID);
|
||||
|
||||
// no dialogCallback
|
||||
sptr<TestRemoteObject> testRemoteObject = new TestRemoteObject(std::u16string());
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, nullptr), SC_SERVICE_ERROR_VALUE_INVALID);
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, nullptr, 0), SC_SERVICE_ERROR_VALUE_INVALID);
|
||||
|
||||
// type invalid
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject), SC_OK);
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject, 0), SC_OK);
|
||||
|
||||
// first use location button
|
||||
entity->componentInfo_ = std::make_shared<LocationButton>();
|
||||
entity->componentInfo_->type_ = LOCATION_COMPONENT;
|
||||
entity->tokenId_ = 0;
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject),
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject, 0),
|
||||
SC_SERVICE_ERROR_WAIT_FOR_DIALOG_CLOSE);
|
||||
EXPECT_EQ(0, static_cast<uint64_t>(diag.firstUseMap_[0]));
|
||||
|
||||
// first use save button
|
||||
entity->componentInfo_->type_ = SAVE_COMPONENT;
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject),
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject, 0),
|
||||
SC_SERVICE_ERROR_WAIT_FOR_DIALOG_CLOSE);
|
||||
EXPECT_EQ(0, static_cast<uint64_t>(diag.firstUseMap_[0]));
|
||||
|
||||
// second use save button
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject),
|
||||
EXPECT_EQ(diag.NotifyFirstUseDialog(entity, testRemoteObject, testRemoteObject, 0),
|
||||
SC_SERVICE_ERROR_WAIT_FOR_DIALOG_CLOSE);
|
||||
EXPECT_EQ(0, static_cast<uint64_t>(diag.firstUseMap_[0]));
|
||||
|
||||
diag.StartDialogAbility(entity, testRemoteObject, testRemoteObject);
|
||||
diag.StartDialogAbility(entity, testRemoteObject, testRemoteObject, 0);
|
||||
|
||||
// wait for event handler done
|
||||
sleep(3);
|
||||
|
||||
+15
-15
@@ -149,36 +149,36 @@ HWTEST_F(SecCompInfoHelperTest, ParseComponent004, TestSize.Level1)
|
||||
{
|
||||
SecCompRect rect = GetDefaultRect();
|
||||
SecCompRect windowRect = GetDefaultRect();
|
||||
ASSERT_TRUE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_TRUE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
|
||||
rect.x_ = ServiceTestCommon::TEST_INVALID_DIMENSION;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
rect.x_ = g_testWidth;
|
||||
|
||||
rect.y_ = ServiceTestCommon::TEST_INVALID_DIMENSION;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
rect.y_ = g_testHeight;
|
||||
|
||||
rect.x_ = g_curScreenWidth + 1;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
rect.x_ = g_testWidth;
|
||||
|
||||
rect.y_ = g_curScreenHeight + 1;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
rect.y_ = g_testHeight;
|
||||
|
||||
rect.width_ = g_curScreenWidth;
|
||||
rect.height_ = g_curScreenHeight;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
rect.width_ = g_testWidth;
|
||||
rect.height_ = g_testHeight;
|
||||
|
||||
rect.x_ = g_curScreenWidth - g_testWidth;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
rect.x_ = g_testWidth;
|
||||
rect.y_ = g_curScreenHeight - g_testHeight;
|
||||
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
rect.y_ = g_testHeight;
|
||||
}
|
||||
|
||||
@@ -192,30 +192,30 @@ HWTEST_F(SecCompInfoHelperTest, ParseComponent005, TestSize.Level1)
|
||||
{
|
||||
SecCompRect rect = GetDefaultRect();
|
||||
SecCompRect windowRect = GetDefaultRect();
|
||||
ASSERT_TRUE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_TRUE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
|
||||
windowRect.x_ = g_testWidth + 1;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
windowRect.x_ = g_testWidth;
|
||||
|
||||
windowRect.y_ = g_testHeight + 1;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
windowRect.y_ = g_testHeight;
|
||||
|
||||
windowRect.width_ = g_testWidth - 1;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
windowRect.width_ = g_testWidth;
|
||||
|
||||
windowRect.height_ = g_testHeight - 1;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
windowRect.height_ = g_testHeight;
|
||||
|
||||
windowRect.width_ = ServiceTestCommon::TEST_INVALID_DIMENSION;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
windowRect.width_ = g_testWidth;
|
||||
|
||||
windowRect.height_ = ServiceTestCommon::TEST_INVALID_DIMENSION;
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect));
|
||||
ASSERT_FALSE(SecCompInfoHelper::CheckRectValid(rect, windowRect, 0));
|
||||
windowRect.height_ = g_testHeight;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,7 @@ void ServiceTestCommon::BuildLocationComponentJson(nlohmann::json& jsonComponent
|
||||
{ JsonTagConstants::JSON_BG_TAG, SecCompBackground::CIRCLE },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0;
|
||||
jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0;
|
||||
}
|
||||
|
||||
void ServiceTestCommon::BuildSaveComponentJson(nlohmann::json& jsonComponent)
|
||||
@@ -127,6 +128,7 @@ void ServiceTestCommon::BuildSaveComponentJson(nlohmann::json& jsonComponent)
|
||||
{ JsonTagConstants::JSON_BG_TAG, SecCompBackground::CIRCLE },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0;
|
||||
jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0;
|
||||
}
|
||||
|
||||
void ServiceTestCommon::BuildPasteComponentJson(nlohmann::json& jsonComponent)
|
||||
@@ -183,6 +185,7 @@ void ServiceTestCommon::BuildPasteComponentJson(nlohmann::json& jsonComponent)
|
||||
{ JsonTagConstants::JSON_BG_TAG, SecCompBackground::CIRCLE },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0;
|
||||
jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0;
|
||||
}
|
||||
} // namespace SecurityComponent
|
||||
} // namespace Security
|
||||
|
||||
@@ -96,6 +96,7 @@ std::string CompoRandomGenerator::ConstructLocationJson()
|
||||
GetData<int32_t>() % static_cast<int32_t>(SecCompBackground::MAX_BG_TYPE) },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0;
|
||||
jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0;
|
||||
compoJson_ = jsonComponent;
|
||||
return compoJson_.dump();
|
||||
}
|
||||
@@ -138,6 +139,7 @@ std::string CompoRandomGenerator::ConstructSaveJson()
|
||||
GetData<int32_t>() % static_cast<int32_t>(SecCompBackground::MAX_BG_TYPE) },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0;
|
||||
jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0;
|
||||
compoJson_ = jsonComponent;
|
||||
return compoJson_.dump();
|
||||
}
|
||||
@@ -180,6 +182,7 @@ std::string CompoRandomGenerator::ConstructPasteJson()
|
||||
GetData<int32_t>() % static_cast<int32_t>(SecCompBackground::MAX_BG_TYPE) },
|
||||
};
|
||||
jsonComponent[JsonTagConstants::JSON_WINDOW_ID] = 0;
|
||||
jsonComponent[JsonTagConstants::JSON_DISPLAY_ID] = 0;
|
||||
compoJson_ = jsonComponent;
|
||||
return compoJson_.dump();
|
||||
}
|
||||
|
||||
@@ -30,6 +30,11 @@ public:
|
||||
{
|
||||
return sptr<Display>::MakeSptr();
|
||||
}
|
||||
|
||||
sptr<Display> GetDisplayById(uint64_t displayId)
|
||||
{
|
||||
return sptr<Display>::MakeSptr();
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // SECURITY_COMPONENT_MANAGER_DISPLAY_MANAGER_MOCK_H
|
||||
@@ -86,7 +86,7 @@ int32_t FirstUseDialog::GrantDialogWaitEntity(int32_t scId)
|
||||
}
|
||||
|
||||
void FirstUseDialog::StartDialogAbility(std::shared_ptr<SecCompEntity> entity,
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback)
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback, const uint64_t displayId)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ bool FirstUseDialog::SetFirstUseMap(std::shared_ptr<SecCompEntity> entity)
|
||||
}
|
||||
|
||||
int32_t FirstUseDialog::NotifyFirstUseDialog(std::shared_ptr<SecCompEntity> entity,
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback)
|
||||
sptr<IRemoteObject> callerToken, sptr<IRemoteObject> dialogCallback, const uint64_t displayId)
|
||||
{
|
||||
return SC_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user