<?xml version="1.0" encoding="utf-8"?>
<tizenModes xmlns="http://www.tizen.org" version="6.0">
<mode name="conflict1" type="normal">
- <action ID="test" rule="test.printInt" restrict="lock">2</action>
+ <action ID="test" rule="test.printInt" restrict="lock" stopOnErr="true">2</action>
</mode>
</tizenModes>
MODES_NAMESPACE_USE;
Action::Action()
- : isChanged(false), type(SYNC), plugin(nullptr), piAction(nullptr), stopOnErr(false), restriction(REQ_NONE)
+ : isChanged(false), type(SYNC), plugin(nullptr), piAction(nullptr), stopOnErr(false), restriction(REQ_NONE), locked(false)
{
}
Action::Action(const std::string &name)
- : ruleName(name), isChanged(false), type(SYNC), plugin(nullptr), piAction(nullptr), stopOnErr(false), restriction(REQ_NONE)
+ : ruleName(name), isChanged(false), type(SYNC), plugin(nullptr), piAction(nullptr), stopOnErr(false), restriction(REQ_NONE), locked(false)
{
}
return restriction;
}
+void Action::setLocked(bool lock)
+{
+ locked = lock;
+}
+
+bool Action::isLocked()
+{
+ return locked;
+}
+
void Action::setPlugin(Plugin *pi)
{
plugin = pi;
std::string getID();
void setRestrict(const ActionRestrict &data);
ActionRestrict getRestrict();
+ void setLocked(bool lock);
+ bool isLocked();
void setStopOnErr(bool val);
bool getStopOnErr();
void setType(ActionType val);
std::string privilege;
bool stopOnErr;
ActionRestrict restriction;
+ bool locked;
};
MODES_NAMESPACE_END
{
std::list<std::shared_ptr<Action>>::iterator it;
for (it = actionList.begin(); it != actionList.end(); it++) {
+ if ((*it)->isLocked()) //It was checked by ConflictManager(isConflict)
+ continue;
+
if (Action::ActionType::ASYNC == (*it)->getType()) {
std::thread(&Action::apply, *it).detach();
} else {
{
std::list<std::shared_ptr<Action>>::iterator it;
for (it = actionList.begin(); it != actionList.end(); it++) {
+ if ((*it)->isLocked()) //It was checked by ConflictManager(isConflict)
+ continue;
+
if (Action::ActionType::ASYNC == (*it)->getType()) {
std::thread(&Action::applyOneShot, *it).detach();
} else {
return exclusive;
}
-bool ModeCareTaker::findRestrictAction(const std::string &ruleName)
+bool ModeCareTaker::findLockedAction(const std::string &ruleName)
{
for (auto modeIt = savedModes.begin(); modeIt != savedModes.end(); modeIt++) {
std::list<std::shared_ptr<Action>> actionList = (modeIt->second).getActionList();
bool ModeCareTaker::checkConflictAction(const Mode &mode)
{
+ bool stopOnErr = false;
std::list<std::shared_ptr<Action>> actionList = mode.getActionList();
- for (auto it = actionList.begin(); it != actionList.end(); it++)
- if (findRestrictAction((*it)->getRuleName()))
- return true;
-
- return false;
+ for (auto it = actionList.begin(); it != actionList.end(); it++) {
+ if (findLockedAction((*it)->getRuleName())) {
+ (*it)->setLocked(true);
+ if ((*it)->getStopOnErr())
+ stopOnErr = true;
+ }
+ }
+ return stopOnErr;
}
bool isExclusive();
bool checkConflictAction(const Mode &mode);
private:
- bool findRestrictAction(const std::string &ruleName);
+ bool findLockedAction(const std::string &ruleName);
std::map<std::string, Mode> savedModes;
std::string undoDir;
bool exclusive;