From: Jaemin Ryu Date: Wed, 1 Jun 2016 00:05:21 +0000 (+0900) Subject: Add external storage restriction policy X-Git-Tag: accepted/tizen/ivi/20160602.231346~6^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0faf3a71446e181ed39369a9a4af131c1f435817;p=platform%2Fcore%2Fsecurity%2Fdevice-policy-manager.git Add external storage restriction policy Change-Id: I8b11f6f504a9b962c74a25b880da4018ec3bec18 Signed-off-by: Jaemin Ryu --- diff --git a/server/restriction.cpp b/server/restriction.cpp index ee9c233..2e49548 100644 --- a/server/restriction.cpp +++ b/server/restriction.cpp @@ -26,6 +26,12 @@ "/org/pulseaudio/StreamManager", \ "org.pulseaudio.StreamManager" +#define DEVICED_SYSNOTI_INTERFACE \ + "org.tizen.system.deviced", \ + "/Org/Tizen/System/DeviceD/SysNoti", \ + "org.tizen.system.deviced.SysNoti", \ + "control" + namespace DevicePolicyManager { RestrictionPolicy::RestrictionPolicy(PolicyControlContext& ctxt) : @@ -141,6 +147,18 @@ bool RestrictionPolicy::getUsbTetheringState() int RestrictionPolicy::setExternalStorageState(int enable) { + int ret; + std::string pid(std::to_string(::getpid())); + std::string state(std::to_string(enable)); + + dbus::Connection &systemDBus = dbus::Connection::getSystem(); + systemDBus.methodcall(DEVICED_SYSNOTI_INTERFACE, -1, + "(i)", "(sisss)", "control", + 3, pid.c_str(), "2", state.c_str()).get("(i)", &ret); + if (ret != 0) { + return -1; + } + SetPolicyAllowed(context, "external-storage", enable); return 0; }