From: seolheui, kim Date: Tue, 15 Jan 2019 10:03:30 +0000 (+0900) Subject: Emit 'unmount' signal before it stop the units X-Git-Tag: submit/tizen_4.0/20190130.090735~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0bb7b001479a4510f7208d9f6856920be48c4662;p=platform%2Fcore%2Fsecurity%2Fode.git Emit 'unmount' signal before it stop the units Change-Id: Idf91f3321a51878abf295c81e7b88e6c0c815158 Signed-off-by: seolheui, kim --- diff --git a/server/internal-encryption.cpp b/server/internal-encryption.cpp index d27fda9..8f40090 100644 --- a/server/internal-encryption.cpp +++ b/server/internal-encryption.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include @@ -56,6 +57,16 @@ namespace ode { namespace { const char *PRIVILEGE_PLATFORM = "http://tizen.org/privilege/internal/default/platform"; +const std::string ODE_OBJECT_PATH = "/Org/Tizen/OnDeviceEncryption"; +const std::string ODE_INTERFACE_EVENT = "org.tizen.OnDeviceEncryption.Event"; +const std::string ODE_SIGNAL_NAME = "unmount"; +const std::string manifest = + "" + " " + " " + " " + " " + ""; // watches systemd jobs class JobWatch { @@ -152,6 +163,15 @@ void stopSystemdUnits() std::vector preprocessUnits; std::set unitsToStop; + try { + systemDBus.emitSignal("", + ODE_OBJECT_PATH, + ODE_INTERFACE_EVENT, + ODE_SIGNAL_NAME, "()", nullptr); + } catch (runtime::Exception &e) { + ERROR(SINK, "Failed to emit signal : " + std::string(e.what())); + } + auto stopUnit = [&systemDBus](const std::string &unit) { JobWatch watch(systemDBus); WARN(SINK, "Stopping unit: " + unit); @@ -390,6 +410,13 @@ InternalEncryptionServer::InternalEncryptionServer(ServerContext& srv, std::to_string(v).c_str()); }) )); + + try { + dbus::Connection &systemDBus = dbus::Connection::getSystem(); + systemDBus.registerObject(ODE_OBJECT_PATH, manifest, nullptr, nullptr); + } catch (runtime::Exception &e) { + ERROR(SINK, e.what()); + } } InternalEncryptionServer::~InternalEncryptionServer()