<?xml version="1.0" encoding="utf-8"?>
<tizenModes xmlns="http://www.tizen.org" version="6.0">
- <mode name="async_valied" type="exclusive" hidden="true">
- <action rule="test.sleepErrorReturn" stopOnErr="true" type="async">5</action>
+ <mode name="async_valied" type="normal" hidden="true">
+ <action rule="test.sleepErrorReturn" restrict="lock" stopOnErr="true" type="async">5</action>
</mode>
</tizenModes>
<?xml version="1.0" encoding="utf-8"?>
<tizenModes xmlns="http://www.tizen.org" version="6.0">
- <mode name="conflict3" type="exclusive">
+ <mode name="conflict3" type="normal">
<action ID="test" rule="test.printBool" restrict="lock">true</action>
</mode>
</tizenModes>
<?xml version="1.0" encoding="utf-8"?>
<tizenModes xmlns="http://www.tizen.org" version="6.0">
- <mode name="invalid1" type="exclusive">
- <action rule="test.printBool">123</action>
+ <mode name="invalid1" type="normal">
+ <action rule="test.printBool" restrict="lock">123</action>
</mode>
</tizenModes>
<?xml version="1.0" encoding="utf-8"?>
<tizenModes xmlns="http://www.tizen.org" version="6.0">
- <mode name="invalid2" type="exclusive">
- <action rule="test.printInt">PRINT_TREE</action>
+ <mode name="invalid2" type="normal">
+ <action rule="test.printInt" restrict="lock">PRINT_TREE</action>
</mode>
</tizenModes>
<?xml version="1.0" encoding="utf-8"?>
<tizenModes xmlns="http://www.tizen.org" version="6.0">
- <mode name="ex2" type="exclusive" hidden="true">
+ <mode name="ex2" type="normal" hidden="true">
<action ID="1" rule="test.printInt" stopOnErr="true" restrict="lock" priority="-100">PRINT_FOUR</action>
<action ID="wifiOff" rule="test.printBool" restrict="lock" priority="-100">off</action>
</mode>
typedef enum {
MODES_TYPE_MODE_NORMAL = 0, /**< Indicates normal mode that is allowed to undo and apply other mode */
MODES_TYPE_MODE_ONESHOT = (1 << 0), /**< Indicates one-shot mode that has no management(undo) */
- // Exclusive is not valide type on making by user.
- //MODES_TYPE_MODE_EXCLUSIVE = (1 << 1), /**< Indicates exclusive mode that is only allowed to undo */
} modes_type_mode_e;
<xs:restriction base="xs:string">
<xs:enumeration value="normal"/>
<xs:enumeration value="oneshot"/>
- <xs:enumeration value="exclusive"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
bool ConflictManager::isConflict(const Mode &mode)
{
- if (careTaker.isSavedMode(mode.getName()) || careTaker.isExclusive())
+ if (careTaker.isSavedMode(mode.getName()))
return true;
if (careTaker.checkConflictAction(mode))
typedef enum {
MODE_NORMAL,
MODE_ONESHOT,
- MODE_EXCLUSIVE
} ModeType;
Mode();
MODES_NAMESPACE_USE;
ModeCareTaker::ModeCareTaker()
- : undoDir(MODES_UNDO_INFO_DEFAULT_DIR), exclusive(false)
+ : undoDir(MODES_UNDO_INFO_DEFAULT_DIR)
{
}
void ModeCareTaker::restoreMode(const Mode &mode)
{
savedModes.insert(std::pair<std::string, Mode>(mode.getName(), mode));
- exclusive = (Mode::MODE_EXCLUSIVE == mode.getModeType());
}
void ModeCareTaker::pushMode(const Mode &mode)
{
savedModes.insert(std::pair<std::string, Mode>(mode.getName(), mode));
- exclusive = (Mode::MODE_EXCLUSIVE == mode.getModeType());
if (mode.hasEssential())
handleEssentialAction(mode);
}
mode = found->second;
- if (Mode::MODE_EXCLUSIVE == mode.getModeType())
- exclusive = false;
-
savedModes.erase(found);
return MODES_ERROR_NONE;
return false;
}
-bool ModeCareTaker::isExclusive()
-{
- if (exclusive)
- ERR("exclusive Mode is applied");
- return exclusive;
-}
-
bool ModeCareTaker::findLockedAction(const std::string &ruleName)
{
for (auto modeIt = savedModes.begin(); modeIt != savedModes.end(); modeIt++) {
void pushMode(const Mode &mode);
int popMode(const std::string &name, Mode &mode);
bool isSavedMode(const std::string &name);
- bool isExclusive();
bool checkConflictAction(const Mode &mode);
void update(const std::string &rule);
private:
std::map<std::string, Mode> savedModes;
std::multimap<std::string, std::string> essentialMap;
std::string undoDir;
- bool exclusive;
};
MODES_NAMESPACE_END
Mode::ModeType type;
if ("normal" == val)
type = Mode::MODE_NORMAL;
- else if ("exclusive" == val)
- type = Mode::MODE_EXCLUSIVE;
else
type = Mode::MODE_ONESHOT;
return type;
switch (t) {
case Mode::MODE_ONESHOT:
return "oneshot";
- case Mode::MODE_EXCLUSIVE:
- return "exclusive";
case Mode::MODE_NORMAL:
default:
return "normal";
EXPECT_EQ(MODES_ERROR_NO_DATA, ret);
}
-TEST_F(ClientTest, canApplyModeConflictExclusive)
-{
- modes_undo_mode(handle, "ex2");
- g_idle_add(applyModeIdler, (gpointer)"ex2");
- g_main_loop_run(loop);
- int ret = modes_can_apply(handle, "ex1");
- EXPECT_EQ(MODES_ERROR_CONFLICT, ret);
- modes_undo_mode(handle, "ex2");
-}
-
TEST_F(ClientTest, registerMode)
{
g_idle_add(registerModeIdler, NULL);
TEST_F(ClientTest, getModes)
{
-const char* const typeList[3] = {
+const char* const typeList[2]= {
"MODES_TYPE_MODE_NORMAL",
- "MODES_TYPE_MODE_ONESHOT",
- "MODES_TYPE_MODE_EXCLUSIVE"
+ "MODES_TYPE_MODE_ONESHOT"
};
GList *list, *cur;
EXPECT_TRUE(careTaker.isSavedMode(modeparser.getModeName()));
}
-TEST_F(ConflictTest, isExclusive)
-{
- ModeXMLParser modeparser("tizen_conflictErrExclusive_mode.xml", ruleMgr);
-
- careTaker.pushMode(modeparser.getMode());
- EXPECT_TRUE(careTaker.isExclusive());
-
- Mode mode;
- careTaker.popMode(modeparser.getModeName(), mode);
- EXPECT_FALSE(careTaker.isExclusive());
-}
-
TEST_F(ConflictTest, checkConflictAction)
{
ModeXMLParser modeparser("tizen_conflictErr_mode.xml", ruleMgr);