mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-19 17:08:11 -04:00
@@ -74,7 +74,8 @@ private:
|
||||
class ScreenManagerAdapter : public BaseAdapter {
|
||||
WM_DECLARE_SINGLE_INSTANCE(ScreenManagerAdapter);
|
||||
public:
|
||||
virtual ScreenId CreateVirtualScreen(VirtualScreenOption option);
|
||||
virtual ScreenId CreateVirtualScreen(VirtualScreenOption option,
|
||||
const sptr<IDisplayManagerAgent>& displayManagerAgent);
|
||||
virtual DMError DestroyVirtualScreen(ScreenId screenId);
|
||||
virtual DMError SetVirtualScreenSurface(ScreenId screenId, sptr<Surface> surface);
|
||||
virtual bool SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason);
|
||||
|
||||
@@ -28,6 +28,7 @@ enum class DisplayManagerAgentType : uint32_t {
|
||||
DISPLAY_STATE_LISTENER,
|
||||
SCREEN_EVENT_LISTENER,
|
||||
DISPLAY_EVENT_LISTENER,
|
||||
VIRTUAL_SCREEN_DIED_LISTENER,
|
||||
};
|
||||
|
||||
class IDisplayManagerAgent : public IRemoteBroker {
|
||||
|
||||
@@ -100,12 +100,13 @@ DMError ScreenManagerAdapter::SetScreenColorTransform(ScreenId screenId)
|
||||
return displayManagerServiceProxy_->SetScreenColorTransform(screenId);
|
||||
}
|
||||
|
||||
ScreenId ScreenManagerAdapter::CreateVirtualScreen(VirtualScreenOption option)
|
||||
ScreenId ScreenManagerAdapter::CreateVirtualScreen(VirtualScreenOption option,
|
||||
const sptr<IDisplayManagerAgent>& displayManagerAgent)
|
||||
{
|
||||
INIT_PROXY_CHECK_RETURN(SCREEN_ID_INVALID);
|
||||
|
||||
WLOGFI("DisplayManagerAdapter::CreateVirtualScreen");
|
||||
return displayManagerServiceProxy_->CreateVirtualScreen(option);
|
||||
return displayManagerServiceProxy_->CreateVirtualScreen(option, displayManagerAgent->AsObject());
|
||||
}
|
||||
|
||||
DMError ScreenManagerAdapter::DestroyVirtualScreen(ScreenId screenId)
|
||||
|
||||
@@ -39,6 +39,7 @@ public:
|
||||
bool UnregisterScreenListener(sptr<IScreenListener> listener);
|
||||
bool RegisterScreenGroupListener(sptr<IScreenGroupListener> listener);
|
||||
bool UnregisterScreenGroupListener(sptr<IScreenGroupListener> listener);
|
||||
ScreenId CreateVirtualScreen(VirtualScreenOption option);
|
||||
sptr<Screen> GetScreen(ScreenId screenId);
|
||||
sptr<ScreenGroup> GetScreenGroup(ScreenId screenId);
|
||||
std::vector<sptr<Screen>> GetAllScreens();
|
||||
@@ -57,6 +58,7 @@ private:
|
||||
std::recursive_mutex mutex_;
|
||||
std::set<sptr<IScreenListener>> screenListeners_;
|
||||
std::set<sptr<IScreenGroupListener>> screenGroupListeners_;
|
||||
sptr<IDisplayManagerAgent> virtualScreenAgent_ = nullptr;
|
||||
};
|
||||
|
||||
class ScreenManager::Impl::ScreenManagerListener : public DisplayManagerAgentDefault {
|
||||
@@ -139,6 +141,7 @@ public:
|
||||
private:
|
||||
sptr<Impl> pImpl_;
|
||||
};
|
||||
|
||||
WM_IMPLEMENT_SINGLE_INSTANCE(ScreenManager)
|
||||
|
||||
ScreenManager::ScreenManager()
|
||||
@@ -395,7 +398,16 @@ void ScreenManager::RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens)
|
||||
|
||||
ScreenId ScreenManager::CreateVirtualScreen(VirtualScreenOption option)
|
||||
{
|
||||
return SingletonContainer::Get<ScreenManagerAdapter>().CreateVirtualScreen(option);
|
||||
return pImpl_->CreateVirtualScreen(option);
|
||||
}
|
||||
|
||||
ScreenId ScreenManager::Impl::CreateVirtualScreen(VirtualScreenOption option)
|
||||
{
|
||||
// After the process creating the virtual screen is killed, DMS needs to delete the virtual screen
|
||||
if (virtualScreenAgent_ == nullptr) {
|
||||
virtualScreenAgent_ = new DisplayManagerAgentDefault();
|
||||
}
|
||||
return SingletonContainer::Get<ScreenManagerAdapter>().CreateVirtualScreen(option, virtualScreenAgent_);
|
||||
}
|
||||
|
||||
DMError ScreenManager::DestroyVirtualScreen(ScreenId screenId)
|
||||
|
||||
@@ -234,6 +234,7 @@ HWTEST_F(ScreenManagerTest, ScreenManager01, Function | MediumTest | Level2)
|
||||
DisplayTestUtils utils;
|
||||
ASSERT_TRUE(utils.CreateSurface());
|
||||
defaultOption_.surface_ = utils.psurface_;
|
||||
defaultOption_.isForShot_ = false;
|
||||
ScreenId virtualScreenId = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption_);
|
||||
ASSERT_NE(SCREEN_ID_INVALID, virtualScreenId);
|
||||
ASSERT_EQ(DMError::DM_OK, ScreenManager::GetInstance().DestroyVirtualScreen(virtualScreenId));
|
||||
@@ -249,6 +250,7 @@ HWTEST_F(ScreenManagerTest, ScreenManager02, Function | MediumTest | Level2)
|
||||
DisplayTestUtils utils;
|
||||
ASSERT_TRUE(utils.CreateSurface());
|
||||
defaultOption_.surface_ = utils.psurface_;
|
||||
defaultOption_.isForShot_ = false;
|
||||
ScreenId virtualScreenId = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption_);
|
||||
std::vector<ScreenId> mirrorIds;
|
||||
mirrorIds.push_back(virtualScreenId);
|
||||
@@ -265,9 +267,10 @@ HWTEST_F(ScreenManagerTest, ScreenManager02, Function | MediumTest | Level2)
|
||||
HWTEST_F(ScreenManagerTest, ScreenManager03, Function | MediumTest | Level2)
|
||||
{
|
||||
DisplayTestUtils utils;
|
||||
ASSERT_TRUE(utils.CreateSurface());
|
||||
defaultOption_.surface_ = utils.psurface_;
|
||||
defaultOption_.isForShot_ = false;
|
||||
for (uint32_t i = 0; i < execTimes_; i++) {
|
||||
ASSERT_TRUE(utils.CreateSurface());
|
||||
defaultOption_.surface_ = utils.psurface_;
|
||||
ScreenId virtualScreenId = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption_);
|
||||
ASSERT_NE(SCREEN_ID_INVALID, virtualScreenId);
|
||||
ASSERT_EQ(DMError::DM_OK, ScreenManager::GetInstance().DestroyVirtualScreen(virtualScreenId));
|
||||
@@ -282,9 +285,10 @@ HWTEST_F(ScreenManagerTest, ScreenManager03, Function | MediumTest | Level2)
|
||||
HWTEST_F(ScreenManagerTest, ScreenManager04, Function | MediumTest | Level2)
|
||||
{
|
||||
DisplayTestUtils utils;
|
||||
ASSERT_TRUE(utils.CreateSurface());
|
||||
defaultOption_.surface_ = utils.psurface_;
|
||||
defaultOption_.isForShot_ = false;
|
||||
for (uint32_t i = 0; i < execTimes_; i++) {
|
||||
ASSERT_TRUE(utils.CreateSurface());
|
||||
defaultOption_.surface_ = utils.psurface_;
|
||||
ScreenId virtualScreenId = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption_);
|
||||
std::vector<ScreenId> mirrorIds;
|
||||
mirrorIds.push_back(virtualScreenId);
|
||||
@@ -305,6 +309,7 @@ HWTEST_F(ScreenManagerTest, ScreenManager05, Function | MediumTest | Level2)
|
||||
utils.SetDefaultWH(defaultDisplay_);
|
||||
ASSERT_TRUE(utils.CreateSurface());
|
||||
defaultOption_.surface_ = utils.psurface_;
|
||||
defaultOption_.isForShot_ = true;
|
||||
ScreenId virtualScreenId = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption_);
|
||||
|
||||
ASSERT_NE(SCREEN_ID_INVALID, virtualScreenId);
|
||||
@@ -337,6 +342,7 @@ HWTEST_F(ScreenManagerTest, ScreenManager06, Function | MediumTest | Level2)
|
||||
DisplayTestUtils utils;
|
||||
utils.SetDefaultWH(defaultDisplay_);
|
||||
defaultOption_.surface_ = nullptr;
|
||||
defaultOption_.isForShot_ = true;
|
||||
ScreenId virtualScreenId = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption_);
|
||||
ASSERT_NE(SCREEN_ID_INVALID, virtualScreenId);
|
||||
|
||||
@@ -715,6 +721,23 @@ HWTEST_F(ScreenManagerTest, ScreenManager16, Function | MediumTest | Level2)
|
||||
ASSERT_EQ(static_cast<uint32_t>(display->GetOrientation()), static_cast<uint32_t>(Orientation::UNSPECIFIED));
|
||||
ScreenManager::GetInstance().UnregisterScreenListener(screenListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: ScreenManager17
|
||||
* @tc.desc: Create VirtualScreen for 10 times but do not destroy it
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(ScreenManagerTest, ScreenManager17, Function | MediumTest | Level2)
|
||||
{
|
||||
DisplayTestUtils utils;
|
||||
defaultOption_.isForShot_ = false;
|
||||
for (uint32_t i = 0; i < execTimes_; i++) {
|
||||
ASSERT_TRUE(utils.CreateSurface());
|
||||
defaultOption_.surface_ = utils.psurface_;
|
||||
ScreenId virtualScreenId = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption_);
|
||||
ASSERT_NE(SCREEN_ID_INVALID, virtualScreenId);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace Rosen
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -50,7 +50,8 @@ public:
|
||||
MOCK_METHOD2(UnregisterDisplayManagerAgent, bool(const sptr<IDisplayManagerAgent>& displayManagerAgent,
|
||||
DisplayManagerAgentType type));
|
||||
MOCK_METHOD2(RequestRotation, bool(ScreenId screenId, Rotation rotation));
|
||||
MOCK_METHOD1(CreateVirtualScreen, ScreenId(VirtualScreenOption option));
|
||||
MOCK_METHOD2(CreateVirtualScreen, ScreenId(VirtualScreenOption option,
|
||||
const sptr<IDisplayManagerAgent>& displayManagerAgent));
|
||||
MOCK_METHOD1(DestroyVirtualScreen, DMError(ScreenId screenId));
|
||||
MOCK_METHOD2(SetVirtualScreenSurface, DMError(ScreenId screenId, sptr<Surface> surface));
|
||||
MOCK_METHOD1(GetScreenGroupInfoById, sptr<ScreenGroupInfo>(ScreenId screenId));
|
||||
|
||||
@@ -60,7 +60,7 @@ HWTEST_F(ScreenManagerTest, CreateAndDestory01, Function | SmallTest | Level1)
|
||||
VirtualScreenOption wrongOption = {defaultName_, defaultWidth_, defaultHeight_,
|
||||
defaultDensity_, nullptr, defaultFlags_};
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateVirtualScreen(_)).Times(1).WillOnce(Return(SCREEN_ID_INVALID));
|
||||
EXPECT_CALL(m->Mock(), CreateVirtualScreen(_, _)).Times(1).WillOnce(Return(SCREEN_ID_INVALID));
|
||||
EXPECT_CALL(m->Mock(), DestroyVirtualScreen(_)).Times(1).WillOnce(Return(DMError::DM_ERROR_INVALID_PARAM));
|
||||
ScreenId id = ScreenManager::GetInstance().CreateVirtualScreen(wrongOption);
|
||||
DMError ret = ScreenManager::GetInstance().DestroyVirtualScreen(id);
|
||||
@@ -81,7 +81,7 @@ HWTEST_F(ScreenManagerTest, CreateAndDestory02, Function | SmallTest | Level1)
|
||||
defaultDensity_, utils.psurface_, defaultFlags_};
|
||||
ScreenId validId = 0;
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateVirtualScreen(_)).Times(1).WillOnce(Return(validId));
|
||||
EXPECT_CALL(m->Mock(), CreateVirtualScreen(_, _)).Times(1).WillOnce(Return(validId));
|
||||
EXPECT_CALL(m->Mock(), DestroyVirtualScreen(_)).Times(1).WillOnce(Return(DMError::DM_OK));
|
||||
ScreenId id = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption);
|
||||
DMError ret = ScreenManager::GetInstance().DestroyVirtualScreen(id);
|
||||
@@ -103,7 +103,7 @@ HWTEST_F(ScreenManagerTest, MakeExpand_001, Function | SmallTest | Level1)
|
||||
ScreenId validId = 0; // default srceenId(0)
|
||||
ScreenId virtualScreenId = 1; // VirtualScreen is the second screen(1)
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateVirtualScreen(_)).Times(1).WillOnce(Return(virtualScreenId));
|
||||
EXPECT_CALL(m->Mock(), CreateVirtualScreen(_, _)).Times(1).WillOnce(Return(virtualScreenId));
|
||||
EXPECT_CALL(m->Mock(), DestroyVirtualScreen(_)).Times(1).WillOnce(Return(DMError::DM_OK));
|
||||
EXPECT_CALL(m->Mock(), MakeExpand(_, _)).Times(1).WillOnce(Return(0));
|
||||
ScreenId vScreenId = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption);
|
||||
@@ -141,7 +141,7 @@ HWTEST_F(ScreenManagerTest, SetSurface01, Function | SmallTest | Level1)
|
||||
defaultDensity_, nullptr, defaultFlags_};
|
||||
ScreenId validId = 0;
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateVirtualScreen(_)).Times(1).WillOnce(Return(validId));
|
||||
EXPECT_CALL(m->Mock(), CreateVirtualScreen(_, _)).Times(1).WillOnce(Return(validId));
|
||||
EXPECT_CALL(m->Mock(), SetVirtualScreenSurface(_, _)).Times(1).WillOnce(Return(DMError::DM_OK));
|
||||
EXPECT_CALL(m->Mock(), DestroyVirtualScreen(_)).Times(1).WillOnce(Return(DMError::DM_OK));
|
||||
ScreenId id = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption);
|
||||
@@ -164,7 +164,7 @@ HWTEST_F(ScreenManagerTest, SetSurface02, Function | SmallTest | Level1)
|
||||
VirtualScreenOption defaultOption = {defaultName_, defaultWidth_, defaultHeight_,
|
||||
defaultDensity_, nullptr, defaultFlags_};
|
||||
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
|
||||
EXPECT_CALL(m->Mock(), CreateVirtualScreen(_)).Times(1).WillOnce(Return(SCREEN_ID_INVALID));
|
||||
EXPECT_CALL(m->Mock(), CreateVirtualScreen(_, _)).Times(1).WillOnce(Return(SCREEN_ID_INVALID));
|
||||
EXPECT_CALL(m->Mock(), SetVirtualScreenSurface(_, _)).Times(1).WillOnce(Return(DMError::DM_ERROR_INVALID_PARAM));
|
||||
EXPECT_CALL(m->Mock(), DestroyVirtualScreen(_)).Times(1).WillOnce(Return(DMError::DM_ERROR_INVALID_PARAM));
|
||||
ScreenId id = ScreenManager::GetInstance().CreateVirtualScreen(defaultOption);
|
||||
|
||||
@@ -25,8 +25,10 @@
|
||||
#include <transaction/rs_interfaces.h>
|
||||
|
||||
#include "abstract_screen.h"
|
||||
#include "display_manager_agent_controller.h"
|
||||
#include "dm_common.h"
|
||||
#include "screen.h"
|
||||
#include "zidl/display_manager_agent_interface.h"
|
||||
|
||||
namespace OHOS::Rosen {
|
||||
class AbstractScreenController : public RefBase {
|
||||
@@ -54,7 +56,7 @@ public:
|
||||
ScreenId ConvertToRsScreenId(ScreenId dmsScreenId) const;
|
||||
ScreenId ConvertToDmsScreenId(ScreenId rsScreenId) const;
|
||||
void RegisterAbstractScreenCallback(sptr<AbstractScreenCallback> cb);
|
||||
ScreenId CreateVirtualScreen(VirtualScreenOption option);
|
||||
ScreenId CreateVirtualScreen(VirtualScreenOption option, const sptr<IRemoteObject>& displayManagerAgent);
|
||||
DMError DestroyVirtualScreen(ScreenId screenId);
|
||||
DMError SetVirtualScreenSurface(ScreenId screenId, sptr<Surface> surface);
|
||||
bool SetOrientation(ScreenId screenId, Orientation orientation);
|
||||
@@ -64,6 +66,7 @@ public:
|
||||
void UpdateRSTree(ScreenId dmsScreenId, std::shared_ptr<RSSurfaceNode>& surfaceNode, bool isAdd);
|
||||
bool MakeMirror(ScreenId, std::vector<ScreenId> screens);
|
||||
bool MakeExpand(std::vector<ScreenId> screenIds, std::vector<Point> startPoints);
|
||||
void SetShotScreen(ScreenId mainScreenId, std::vector<ScreenId> shotScreenIds);
|
||||
void RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens);
|
||||
void DumpScreenInfo() const;
|
||||
bool SetScreenPowerForAll(ScreenPowerState state, PowerStateChangeReason reason) const;
|
||||
@@ -80,6 +83,8 @@ public:
|
||||
private:
|
||||
void RegisterRsScreenConnectionChangeListener();
|
||||
void OnRsScreenConnectionChange(ScreenId rsScreenId, ScreenEvent screenEvent);
|
||||
bool OnRemoteDied(const sptr<IRemoteObject>& agent);
|
||||
bool RegisterVirtualScreenAgent(const sptr<IRemoteObject>& displayManagerAgent);
|
||||
void ProcessScreenConnected(ScreenId rsScreenId);
|
||||
sptr<AbstractScreen> InitAndGetScreen(ScreenId rsScreenId);
|
||||
void ProcessScreenDisconnected(ScreenId rsScreenId);
|
||||
@@ -129,6 +134,8 @@ private:
|
||||
ScreenIdManager screenIdManager_;
|
||||
std::map<ScreenId, sptr<AbstractScreen>> dmsScreenMap_;
|
||||
std::map<ScreenId, sptr<AbstractScreenGroup>> dmsScreenGroupMap_;
|
||||
std::map<ScreenId, std::shared_ptr<RSDisplayNode>> displayNodeMap_;
|
||||
std::map<sptr<IRemoteObject>, std::vector<ScreenId>> screenAgentMap_;
|
||||
sptr<AbstractScreenCallback> abstractScreenCallback_;
|
||||
std::shared_ptr<AppExecFwk::EventHandler> controllerHandler_;
|
||||
};
|
||||
|
||||
@@ -25,11 +25,13 @@ namespace OHOS {
|
||||
namespace Rosen {
|
||||
class DisplayManagerAgentController {
|
||||
WM_DECLARE_SINGLE_INSTANCE_BASE(DisplayManagerAgentController)
|
||||
using VirtualScreenDestroyCallback = std::function<bool(const sptr<IRemoteObject>)>;
|
||||
public:
|
||||
bool RegisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
|
||||
DisplayManagerAgentType type);
|
||||
bool UnregisterDisplayManagerAgent(const sptr<IDisplayManagerAgent>& displayManagerAgent,
|
||||
DisplayManagerAgentType type);
|
||||
bool SetRemoveAgentCallback(const VirtualScreenDestroyCallback& callback, DisplayManagerAgentType type);
|
||||
|
||||
bool NotifyDisplayPowerEvent(DisplayPowerEvent event, EventStatus status);
|
||||
bool NotifyDisplayStateChanged(DisplayId id, DisplayState state);
|
||||
|
||||
@@ -76,7 +76,8 @@ public:
|
||||
virtual sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId) = 0;
|
||||
virtual sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) = 0;
|
||||
|
||||
virtual ScreenId CreateVirtualScreen(VirtualScreenOption option) = 0;
|
||||
virtual ScreenId CreateVirtualScreen(VirtualScreenOption option,
|
||||
const sptr<IRemoteObject>& displayManagerAgent) = 0;
|
||||
virtual DMError DestroyVirtualScreen(ScreenId screenId) = 0;
|
||||
virtual DMError SetVirtualScreenSurface(ScreenId screenId, sptr<Surface> surface) = 0;
|
||||
virtual bool SetOrientation(ScreenId screenId, Orientation orientation) = 0;
|
||||
|
||||
@@ -35,7 +35,8 @@ public:
|
||||
sptr<DisplayInfo> GetDisplayInfoById(DisplayId displayId) override;
|
||||
sptr<DisplayInfo> GetDisplayInfoByScreen(ScreenId screenId) override;
|
||||
|
||||
ScreenId CreateVirtualScreen(VirtualScreenOption option) override;
|
||||
ScreenId CreateVirtualScreen(VirtualScreenOption option,
|
||||
const sptr<IRemoteObject>& displayManagerAgent) override;
|
||||
DMError DestroyVirtualScreen(ScreenId screenId) override;
|
||||
DMError SetVirtualScreenSurface(ScreenId screenId, sptr<Surface> surface) override;
|
||||
bool SetOrientation(ScreenId screenId, Orientation orientation) override;
|
||||
|
||||
@@ -41,7 +41,8 @@ WM_DECLARE_SINGLE_INSTANCE_BASE(DisplayManagerService);
|
||||
public:
|
||||
void OnStart() override;
|
||||
void OnStop() override;
|
||||
ScreenId CreateVirtualScreen(VirtualScreenOption option) override;
|
||||
ScreenId CreateVirtualScreen(VirtualScreenOption option,
|
||||
const sptr<IRemoteObject>& displayManagerAgent) override;
|
||||
DMError DestroyVirtualScreen(ScreenId screenId) override;
|
||||
DMError SetVirtualScreenSurface(ScreenId screenId, sptr<Surface> surface) override;
|
||||
|
||||
@@ -93,7 +94,6 @@ private:
|
||||
~DisplayManagerService() = default;
|
||||
bool Init();
|
||||
void NotifyDisplayStateChange(DisplayId id, DisplayStateChangeType type);
|
||||
void SetShotScreen(ScreenId mainScreenId, std::vector<ScreenId> shotScreenIds);
|
||||
ScreenId GetScreenIdByDisplayId(DisplayId displayId) const;
|
||||
std::shared_ptr<RSDisplayNode> GetRSDisplayNodeByDisplayId(DisplayId displayId) const;
|
||||
|
||||
@@ -102,7 +102,6 @@ private:
|
||||
sptr<AbstractDisplayController> abstractDisplayController_;
|
||||
sptr<AbstractScreenController> abstractScreenController_;
|
||||
sptr<DisplayPowerController> displayPowerController_;
|
||||
std::map<ScreenId, std::shared_ptr<RSDisplayNode>> displayNodeMap_;
|
||||
sptr<IDisplayChangeListener> displayChangeListener_;
|
||||
};
|
||||
} // namespace OHOS::Rosen
|
||||
|
||||
@@ -63,6 +63,12 @@ void AbstractScreenController::RegisterRsScreenConnectionChangeListener()
|
||||
// posk task after 50 ms.
|
||||
controllerHandler_->PostTask(task, 50, AppExecFwk::EventQueue::Priority::HIGH);
|
||||
}
|
||||
bool callbackRegister = DisplayManagerAgentController::GetInstance().SetRemoveAgentCallback(
|
||||
std::bind(&AbstractScreenController::OnRemoteDied, this, std::placeholders::_1),
|
||||
DisplayManagerAgentType::VIRTUAL_SCREEN_DIED_LISTENER);
|
||||
if (!callbackRegister) {
|
||||
WLOGFE("virtualScreen callback registered failed");
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<ScreenId> AbstractScreenController::GetAllScreenIds() const
|
||||
@@ -460,7 +466,15 @@ sptr<AbstractScreenGroup> AbstractScreenController::AddAsSuccedentScreenLocked(s
|
||||
return screenGroup;
|
||||
}
|
||||
|
||||
ScreenId AbstractScreenController::CreateVirtualScreen(VirtualScreenOption option)
|
||||
bool AbstractScreenController::RegisterVirtualScreenAgent(const sptr<IRemoteObject>& displayManagerAgent)
|
||||
{
|
||||
return DisplayManagerAgentController::GetInstance().RegisterDisplayManagerAgent(
|
||||
iface_cast<IDisplayManagerAgent>(displayManagerAgent),
|
||||
DisplayManagerAgentType::VIRTUAL_SCREEN_DIED_LISTENER);
|
||||
}
|
||||
|
||||
ScreenId AbstractScreenController::CreateVirtualScreen(VirtualScreenOption option,
|
||||
const sptr<IRemoteObject>& displayManagerAgent)
|
||||
{
|
||||
ScreenId rsId = rsInterface_.CreateVirtualScreen(option.name_, option.width_,
|
||||
option.height_, option.surface_, SCREEN_ID_INVALID, option.flags_);
|
||||
@@ -468,7 +482,16 @@ ScreenId AbstractScreenController::CreateVirtualScreen(VirtualScreenOption optio
|
||||
if (rsId == SCREEN_ID_INVALID) {
|
||||
return SCREEN_ID_INVALID;
|
||||
}
|
||||
std::vector<ScreenId> virtualScreenIds;
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
std::map<sptr<IRemoteObject>, std::vector<ScreenId>>::iterator agIter = screenAgentMap_.find(displayManagerAgent);
|
||||
if (agIter == screenAgentMap_.end()) {
|
||||
if (!RegisterVirtualScreenAgent(displayManagerAgent)) {
|
||||
return SCREEN_ID_INVALID;
|
||||
}
|
||||
} else {
|
||||
virtualScreenIds = screenAgentMap_[displayManagerAgent];
|
||||
}
|
||||
ScreenId dmsScreenId = SCREEN_ID_INVALID;
|
||||
if (!screenIdManager_.ConvertToDmsScreenId(rsId, dmsScreenId)) {
|
||||
dmsScreenId = screenIdManager_.CreateAndGetNewScreenId(rsId);
|
||||
@@ -498,6 +521,8 @@ ScreenId AbstractScreenController::CreateVirtualScreen(VirtualScreenOption optio
|
||||
} else {
|
||||
WLOGFI("id: %{public}" PRIu64" appears in screenIdManager_. ", rsId);
|
||||
}
|
||||
virtualScreenIds.emplace_back(dmsScreenId);
|
||||
screenAgentMap_[displayManagerAgent] = virtualScreenIds;
|
||||
return dmsScreenId;
|
||||
}
|
||||
|
||||
@@ -507,13 +532,45 @@ DMError AbstractScreenController::DestroyVirtualScreen(ScreenId screenId)
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
ScreenId rsScreenId = SCREEN_ID_INVALID;
|
||||
screenIdManager_.ConvertToRsScreenId(screenId, rsScreenId);
|
||||
|
||||
sptr<IDisplayManagerAgent> displayManagerAgent = nullptr;
|
||||
bool agentFound = false;
|
||||
for (auto &agentIter : screenAgentMap_) {
|
||||
for (auto iter = agentIter.second.begin(); iter != agentIter.second.end(); iter++) {
|
||||
if (*iter == screenId) {
|
||||
iter = agentIter.second.erase(iter);
|
||||
agentFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (agentFound) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::map<ScreenId, std::shared_ptr<RSDisplayNode>>::iterator iter = displayNodeMap_.find(rsScreenId);
|
||||
if (iter == displayNodeMap_.end()) {
|
||||
WLOGFI("displayNode is nullptr");
|
||||
} else {
|
||||
displayNodeMap_[rsScreenId]->RemoveFromTree();
|
||||
WLOGFI("displayNode remove from tree rsScreenId: %{public}" PRIu64"", rsScreenId);
|
||||
displayNodeMap_.erase(rsScreenId);
|
||||
auto transactionProxy = RSTransactionProxy::GetInstance();
|
||||
if (transactionProxy != nullptr) {
|
||||
transactionProxy->FlushImplicitTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
if (rsScreenId != SCREEN_ID_INVALID && GetAbstractScreen(screenId) != nullptr) {
|
||||
ProcessScreenDisconnected(rsScreenId);
|
||||
}
|
||||
screenIdManager_.DeleteScreenId(screenId);
|
||||
if (rsScreenId != SCREEN_ID_INVALID) {
|
||||
rsInterface_.RemoveVirtualScreen(rsScreenId);
|
||||
|
||||
if (rsScreenId == SCREEN_ID_INVALID) {
|
||||
WLOGFE("DestroyVirtualScreen: No corresponding rsScreenId");
|
||||
return DMError::DM_ERROR_INVALID_PARAM;
|
||||
}
|
||||
rsInterface_.RemoveVirtualScreen(rsScreenId);
|
||||
WLOGFI("DumpScreenInfo after Destroy VirtualScreen");
|
||||
DumpScreenInfo();
|
||||
return DMError::DM_OK;
|
||||
@@ -814,6 +871,34 @@ bool AbstractScreenController::MakeExpand(std::vector<ScreenId> screenIds, std::
|
||||
return true;
|
||||
}
|
||||
|
||||
void AbstractScreenController::SetShotScreen(ScreenId mainScreenId, std::vector<ScreenId> shotScreenIds)
|
||||
{
|
||||
WLOGFI("SetShotScreen. mainScreenId: %{public}" PRIu64"", mainScreenId);
|
||||
if (shotScreenIds.empty()) {
|
||||
WLOGFI("shotScreenIds is empty");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<RSDisplayNode> displayNode = GetRSDisplayNodeByScreenId(mainScreenId);
|
||||
if (displayNode == nullptr) {
|
||||
WLOGFE("SetShotScreen error, cannot get DisplayNode");
|
||||
return;
|
||||
}
|
||||
NodeId nodeId = displayNode->GetId();
|
||||
WLOGI("SetShotScreen, mainScreen nodeId:%{public}" PRIu64"", nodeId);
|
||||
for (ScreenId shotScreenId : shotScreenIds) {
|
||||
shotScreenId = ConvertToRsScreenId(shotScreenId);
|
||||
if (shotScreenId == SCREEN_ID_INVALID) {
|
||||
continue;
|
||||
}
|
||||
struct RSDisplayNodeConfig config = {shotScreenId, true, nodeId};
|
||||
displayNodeMap_[shotScreenId] = RSDisplayNode::Create(config);
|
||||
}
|
||||
auto transactionProxy = RSTransactionProxy::GetInstance();
|
||||
if (transactionProxy != nullptr) {
|
||||
transactionProxy->FlushImplicitTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
void AbstractScreenController::RemoveVirtualScreenFromGroup(std::vector<ScreenId> screens)
|
||||
{
|
||||
if (screens.empty()) {
|
||||
@@ -841,6 +926,26 @@ void AbstractScreenController::RemoveVirtualScreenFromGroup(std::vector<ScreenId
|
||||
NotifyScreenGroupChanged(removeFromGroup, ScreenGroupChangeEvent::REMOVE_FROM_GROUP);
|
||||
}
|
||||
|
||||
bool AbstractScreenController::OnRemoteDied(const sptr<IRemoteObject>& agent)
|
||||
{
|
||||
if (agent == nullptr) {
|
||||
return false;
|
||||
}
|
||||
std::map<sptr<IRemoteObject>, std::vector<ScreenId>>::iterator agentIter = screenAgentMap_.find(agent);
|
||||
if (agentIter != screenAgentMap_.end()) {
|
||||
while (screenAgentMap_[agent].size() > 0) {
|
||||
auto diedId = screenAgentMap_[agent][0];
|
||||
WLOGI("destroy screenId in OnRemoteDied: %{public}" PRIu64"", diedId);
|
||||
DMError res = DestroyVirtualScreen(diedId);
|
||||
if (res != DMError::DM_OK) {
|
||||
WLOGE("destroy failed in OnRemoteDied: %{public}" PRIu64"", diedId);
|
||||
}
|
||||
}
|
||||
screenAgentMap_.erase(agent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void AbstractScreenController::DumpScreenInfo() const
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
|
||||
@@ -175,5 +175,11 @@ void DisplayManagerAgentController::OnDisplayChange(
|
||||
agent->OnDisplayChange(displayInfo, displayChangeEvent);
|
||||
}
|
||||
}
|
||||
|
||||
bool DisplayManagerAgentController::SetRemoveAgentCallback(const VirtualScreenDestroyCallback& callback,
|
||||
DisplayManagerAgentType type)
|
||||
{
|
||||
return dmAgentContainer_.SetRemoveAgentCallback(callback, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,8 @@ sptr<DisplayInfo> DisplayManagerProxy::GetDisplayInfoByScreen(ScreenId screenId)
|
||||
return info;
|
||||
}
|
||||
|
||||
ScreenId DisplayManagerProxy::CreateVirtualScreen(VirtualScreenOption virtualOption)
|
||||
ScreenId DisplayManagerProxy::CreateVirtualScreen(VirtualScreenOption virtualOption,
|
||||
const sptr<IRemoteObject>& displayManagerAgent)
|
||||
{
|
||||
sptr<IRemoteObject> remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
@@ -142,6 +143,10 @@ ScreenId DisplayManagerProxy::CreateVirtualScreen(VirtualScreenOption virtualOpt
|
||||
WLOGFW("CreateVirtualScreen: surface is nullptr");
|
||||
res = res && data.WriteBool(false);
|
||||
}
|
||||
if (displayManagerAgent != nullptr) {
|
||||
res = res &&
|
||||
data.WriteRemoteObject(displayManagerAgent);
|
||||
}
|
||||
if (!res) {
|
||||
WLOGFE("Write data failed");
|
||||
return SCREEN_ID_INVALID;
|
||||
|
||||
@@ -116,11 +116,12 @@ sptr<DisplayInfo> DisplayManagerService::GetDisplayInfoByScreen(ScreenId screenI
|
||||
}
|
||||
return display->ConvertToDisplayInfo();
|
||||
}
|
||||
|
||||
ScreenId DisplayManagerService::CreateVirtualScreen(VirtualScreenOption option)
|
||||
|
||||
ScreenId DisplayManagerService::CreateVirtualScreen(VirtualScreenOption option,
|
||||
const sptr<IRemoteObject>& displayManagerAgent)
|
||||
{
|
||||
WM_SCOPED_TRACE("dms:CreateVirtualScreen(%s)", option.name_.c_str());
|
||||
ScreenId screenId = abstractScreenController_->CreateVirtualScreen(option);
|
||||
ScreenId screenId = abstractScreenController_->CreateVirtualScreen(option, displayManagerAgent);
|
||||
CHECK_SCREEN_AND_RETURN(SCREEN_ID_INVALID);
|
||||
|
||||
WLOGFI("DumpScreenInfo after Create VirtualScreen");
|
||||
@@ -134,19 +135,6 @@ DMError DisplayManagerService::DestroyVirtualScreen(ScreenId screenId)
|
||||
CHECK_SCREEN_AND_RETURN(DMError::DM_ERROR_INVALID_PARAM);
|
||||
|
||||
WM_SCOPED_TRACE("dms:DestroyVirtualScreen(%" PRIu64")", screenId);
|
||||
auto rsScreenId = abstractScreenController_->ConvertToRsScreenId(screenId);
|
||||
std::map<ScreenId, std::shared_ptr<RSDisplayNode>>::iterator iter = displayNodeMap_.find(rsScreenId);
|
||||
if (iter == displayNodeMap_.end()) {
|
||||
WLOGFE("DisplayManagerService: displayNode is nullptr");
|
||||
return abstractScreenController_->DestroyVirtualScreen(screenId);
|
||||
}
|
||||
displayNodeMap_[rsScreenId]->RemoveFromTree();
|
||||
WLOGFE("DisplayManagerService: displayNode remove from tree");
|
||||
displayNodeMap_.erase(rsScreenId);
|
||||
auto transactionProxy = RSTransactionProxy::GetInstance();
|
||||
if (transactionProxy != nullptr) {
|
||||
transactionProxy->FlushImplicitTransaction();
|
||||
}
|
||||
return abstractScreenController_->DestroyVirtualScreen(screenId);
|
||||
}
|
||||
|
||||
@@ -345,34 +333,6 @@ std::shared_ptr<RSDisplayNode> DisplayManagerService::GetRSDisplayNodeByDisplayI
|
||||
return abstractScreenController_->GetRSDisplayNodeByScreenId(screenId);
|
||||
}
|
||||
|
||||
void DisplayManagerService::SetShotScreen(ScreenId mainScreenId, std::vector<ScreenId> shotScreenIds)
|
||||
{
|
||||
WLOGFI("SetShotScreen. mainScreenId: %{public}" PRIu64"", mainScreenId);
|
||||
if (shotScreenIds.empty()) {
|
||||
WLOGFI("shotScreenIds is empty");
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<RSDisplayNode> displayNode = abstractScreenController_->GetRSDisplayNodeByScreenId(mainScreenId);
|
||||
if (displayNode == nullptr) {
|
||||
WLOGFE("SetShotScreen error, cannot get DisplayNode");
|
||||
return;
|
||||
}
|
||||
NodeId nodeId = displayNode->GetId();
|
||||
WLOGI("SetShotScreen, mainScreen nodeId:%{public}" PRIu64"", nodeId);
|
||||
for (ScreenId shotScreenId : shotScreenIds) {
|
||||
shotScreenId = abstractScreenController_->ConvertToRsScreenId(shotScreenId);
|
||||
if (shotScreenId == INVALID_SCREEN_ID) {
|
||||
continue;
|
||||
}
|
||||
struct RSDisplayNodeConfig config = {shotScreenId, true, nodeId};
|
||||
displayNodeMap_[shotScreenId] = RSDisplayNode::Create(config);
|
||||
}
|
||||
auto transactionProxy = RSTransactionProxy::GetInstance();
|
||||
if (transactionProxy != nullptr) {
|
||||
transactionProxy->FlushImplicitTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
ScreenId DisplayManagerService::MakeMirror(ScreenId mainScreenId, std::vector<ScreenId> mirrorScreenIds)
|
||||
{
|
||||
WLOGFI("MakeMirror. mainScreenId :%{public}" PRIu64"", mainScreenId);
|
||||
@@ -390,7 +350,7 @@ ScreenId DisplayManagerService::MakeMirror(ScreenId mainScreenId, std::vector<Sc
|
||||
WLOGFI("create mirror fail, screen is invalid. Screen :%{public}" PRIu64"", mainScreenId);
|
||||
return SCREEN_ID_INVALID;
|
||||
}
|
||||
SetShotScreen(mainScreenId, shotScreenIds);
|
||||
abstractScreenController_->SetShotScreen(mainScreenId, shotScreenIds);
|
||||
WM_SCOPED_TRACE("dms:MakeMirror");
|
||||
if (!allMirrorScreenIds.empty() && !abstractScreenController_->MakeMirror(mainScreenId, allMirrorScreenIds)) {
|
||||
WLOGFE("make mirror failed.");
|
||||
@@ -481,7 +441,7 @@ ScreenId DisplayManagerService::MakeExpand(std::vector<ScreenId> expandScreenIds
|
||||
if (iter != allExpandScreenIds.end()) {
|
||||
allExpandScreenIds.erase(iter);
|
||||
}
|
||||
SetShotScreen(defaultScreenId, shotScreenIds);
|
||||
abstractScreenController_->SetShotScreen(defaultScreenId, shotScreenIds);
|
||||
WM_SCOPED_TRACE("dms:MakeExpand");
|
||||
if (!allExpandScreenIds.empty() && !abstractScreenController_->MakeExpand(allExpandScreenIds, startPoints)) {
|
||||
WLOGFE("make expand failed.");
|
||||
|
||||
@@ -69,6 +69,7 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
sptr<IBufferProducer> bp = iface_cast<IBufferProducer>(surfaceObject);
|
||||
surface = Surface::CreateSurfaceAsProducer(bp);
|
||||
}
|
||||
sptr<IRemoteObject> virtualScreenAgent = data.ReadRemoteObject();
|
||||
VirtualScreenOption option = {
|
||||
.name_ = name,
|
||||
.width_ = width,
|
||||
@@ -78,7 +79,7 @@ int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
|
||||
.flags_ = flags,
|
||||
.isForShot_ = isForShot
|
||||
};
|
||||
ScreenId screenId = CreateVirtualScreen(option);
|
||||
ScreenId screenId = CreateVirtualScreen(option, virtualScreenAgent);
|
||||
reply.WriteUint64(static_cast<uint64_t>(screenId));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ enum class DMError : int32_t {
|
||||
DM_ERROR_INVALID_MODE_ID = 160,
|
||||
DM_ERROR_WRITE_DATA_FAILED = 170,
|
||||
DM_ERROR_RENDER_SERVICE_FAILED = 180,
|
||||
DM_ERROR_UNREGISTER_AGENT_FAILED = 190,
|
||||
DM_ERROR_UNKNOWN,
|
||||
};
|
||||
using DisplayStateCallback = std::function<void(DisplayState)>;
|
||||
|
||||
@@ -21,22 +21,25 @@
|
||||
#include <set>
|
||||
#include "agent_death_recipient.h"
|
||||
#include "window_manager_hilog.h"
|
||||
#include "zidl/display_manager_agent_interface.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
template <typename T1, typename T2>
|
||||
class ClientAgentContainer {
|
||||
using DestroyCallback = std::function<bool(const sptr<IRemoteObject>)>;
|
||||
public:
|
||||
ClientAgentContainer();
|
||||
virtual ~ClientAgentContainer() = default;
|
||||
|
||||
bool RegisterAgent(const sptr<T1>& agent, T2 type);
|
||||
bool UnregisterAgent(const sptr<T1>& agent, T2 type);
|
||||
bool SetRemoveAgentCallback(const DestroyCallback& callback, T2 type);
|
||||
std::set<sptr<T1>> GetAgentsByType(T2 type);
|
||||
|
||||
private:
|
||||
void RemoveAgent(const sptr<IRemoteObject>& remoteObject);
|
||||
bool UnregisterAgentLocked(std::set<sptr<T1>>& agents, const sptr<IRemoteObject>& agent);
|
||||
sptr<T1> UnregisterAgentLocked(std::set<sptr<T1>>& agents, const sptr<IRemoteObject>& agent);
|
||||
|
||||
static constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "ClientAgentContainer"};
|
||||
|
||||
@@ -53,6 +56,7 @@ private:
|
||||
|
||||
std::recursive_mutex mutex_;
|
||||
std::map<T2, std::set<sptr<T1>>> agentMap_;
|
||||
std::map<T2, DestroyCallback> callbackMap_;
|
||||
sptr<AgentDeathRecipient> deathRecipient_;
|
||||
};
|
||||
|
||||
@@ -65,7 +69,6 @@ bool ClientAgentContainer<T1, T2>::RegisterAgent(const sptr<T1>& agent, T2 type)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
agentMap_[type].insert(agent);
|
||||
WLOGFI("agent registered type:%{public}u", type);
|
||||
if (deathRecipient_ == nullptr || !agent->AsObject()->AddDeathRecipient(deathRecipient_)) {
|
||||
WLOGFI("failed to add death recipient");
|
||||
}
|
||||
@@ -81,9 +84,20 @@ bool ClientAgentContainer<T1, T2>::UnregisterAgent(const sptr<T1>& agent, T2 typ
|
||||
return false;
|
||||
}
|
||||
auto& agents = agentMap_.at(type);
|
||||
bool ret = UnregisterAgentLocked(agents, agent->AsObject());
|
||||
agent->AsObject()->RemoveDeathRecipient(deathRecipient_);
|
||||
return ret;
|
||||
WLOGFI("UnregisterAgent: agent: %{public}p in ClientAgentContainer", agent->AsObject().GetRefPtr());
|
||||
auto ret = UnregisterAgentLocked(agents, agent->AsObject());
|
||||
if (ret != nullptr) {
|
||||
agent->AsObject()->RemoveDeathRecipient(deathRecipient_);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
bool ClientAgentContainer<T1, T2>::SetRemoveAgentCallback(const DestroyCallback& callback, T2 type)
|
||||
{
|
||||
callbackMap_[type] = callback;
|
||||
WLOG_I("ClientAgentContainer callback registered type:%{public}u", type);
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
@@ -98,17 +112,17 @@ std::set<sptr<T1>> ClientAgentContainer<T1, T2>::GetAgentsByType(T2 type)
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
bool ClientAgentContainer<T1, T2>::UnregisterAgentLocked(std::set<sptr<T1>>& agents,
|
||||
sptr<T1> ClientAgentContainer<T1, T2>::UnregisterAgentLocked(std::set<sptr<T1>>& agents,
|
||||
const sptr<IRemoteObject>& agent)
|
||||
{
|
||||
auto iter = std::find_if(agents.begin(), agents.end(), finder_t(agent));
|
||||
if (iter == agents.end()) {
|
||||
WLOGFW("could not find this agent");
|
||||
return false;
|
||||
return nullptr;
|
||||
}
|
||||
auto res = *iter;
|
||||
agents.erase(iter);
|
||||
WLOGFI("agent unregistered");
|
||||
return true;
|
||||
return res;
|
||||
}
|
||||
|
||||
template<typename T1, typename T2>
|
||||
@@ -116,8 +130,14 @@ void ClientAgentContainer<T1, T2>::RemoveAgent(const sptr<IRemoteObject>& remote
|
||||
{
|
||||
WLOGFI("RemoveAgent");
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex_);
|
||||
DestroyCallback removeAgentCallback = nullptr;
|
||||
for (auto& elem : agentMap_) {
|
||||
if (UnregisterAgentLocked(elem.second, remoteObject)) {
|
||||
auto agent = UnregisterAgentLocked(elem.second, remoteObject);
|
||||
if (agent != nullptr) {
|
||||
if (callbackMap_[elem.first] != nullptr) {
|
||||
removeAgentCallback = callbackMap_[elem.first];
|
||||
removeAgentCallback(remoteObject);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
||||
Reference in New Issue
Block a user