#include "policy-client.h"
+#include <vconf.h>
+
+#define VCONFKEY_DPM_MODE_STATE "db/dpm/mode_state"
+
namespace {
const std::string SIGNAL_OBJECT_PATH = "/org/tizen/DevicePolicyManger/PIL";
const std::string POLICY_MANAGER_ADDRESS = "/tmp/.device-policy-manager.sock";
-int GetPolicyEnforceMode()
-{
- runtime::File policyManagerSocket(POLICY_MANAGER_ADDRESS);
-
- if (policyManagerSocket.exists()) {
- return 1;
- }
-
- return 0;
-}
-
} // namespace
DevicePolicyClient::DevicePolicyClient() noexcept :
- maintenanceMode(GetPolicyEnforceMode()), clientAddress(POLICY_MANAGER_ADDRESS)
+ clientAddress(POLICY_MANAGER_ADDRESS)
{
mainloop.reset(new ScopedGMainLoop);
}
const SignalHandler& handler,
void* data) noexcept
{
- if (!maintenanceMode)
+ if (!getMaintenanceMode())
return 0;
try {
int DevicePolicyClient::unsubscribeSignal(int id) noexcept
{
- if (!maintenanceMode)
+ if (!getMaintenanceMode())
return 0;
try {
return -1;
}
}
+
+int DevicePolicyClient::getMaintenanceMode()
+{
+ int value = 0;
+
+ ::vconf_get_bool(VCONFKEY_DPM_MODE_STATE, &value);
+
+ return value;
+}