power: change power lock expired popup to use dbus method to notify to deviced 02/98902/2
authortaeyoung <ty317.kim@samsung.com>
Mon, 21 Nov 2016 06:33:48 +0000 (15:33 +0900)
committerKunhoon Baik <knhoon.baik@samsung.com>
Tue, 22 Nov 2016 00:02:57 +0000 (16:02 -0800)
- Previously, the popup sent dbus signal for deviced to receive
  the user input.
- Now, the popup calls dbus method for deviced to receive the
  user input.

Change-Id: I05b0f4b14c706e778af5e3bb12f37718ff311fc6
Signed-off-by: taeyoung <ty317.kim@samsung.com>
src/org.tizen.system-syspopup.xml
src/power/power.c

index 59b71beef519a2e323c82cff825dba9f4339f3d3..8a3da041a8055751a00a48721fea3e41a09035bf 100755 (executable)
@@ -8,6 +8,7 @@
        </ui-application>
        <privileges>
                <privilege>http://tizen.org/privilege/power</privilege>
+               <privilege>http://tizen.org/privilege/display</privilege>
                <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
                <privilege>http://tizen.org/privilege/window.priority.set</privilege>
        </privileges>
index b98986aaef02f48954a50883ffefd5567f8ab019..7bdd2ac92b711f85a7466ecb776887f4662550c3 100755 (executable)
 #define APP_COMM      "_APP_COMM_"
 #define REQ_ID        "_REQUEST_ID_"
 
-#define DBUS_POWER_PATH "/Org/Tizen/System/DeviceD/Power"
-#define DBUS_POWER_IFACE "org.tizen.system.deviced.power"
-#define METHOD_POWER_LOCK_EXPIRED "PowerLockExpired"
+#define DBUS_POWER_BUS   "org.tizen.system.deviced"
+#define DBUS_POWER_PATH  "/Org/Tizen/System/DeviceD/Display"
+#define DBUS_POWER_IFACE "org.tizen.system.deviced.display"
+#define METHOD_LOCK_TIMEOUT_INPUT "LockTimeoutInput"
 
 static const struct popup_ops power_lock_expired_ops;
-static bool signal_broadcasted;
+static bool result_sended;
 static char *request_id;
 
 enum button_selected {
        ALLOW_APP,
+       RESTRICT_APP,
        CLOSE_APP,
 };
 
-static void send_result_dbus_signal(int result)
+static void send_result(int result)
 {
        int ret;
        char buf[8];
        char *param[2];
 
-       if (signal_broadcasted)
+       if (result_sended)
                return;
 
-       signal_broadcasted = true;
+       result_sended = true;
 
        param[0] = request_id;
        snprintf(buf, sizeof(buf), "%d", result);
        param[1] = buf;
-       ret = broadcast_dbus_signal(DBUS_POWER_PATH,
+       ret = popup_dbus_method_sync(
+                       DBUS_POWER_BUS,
+                       DBUS_POWER_PATH,
                        DBUS_POWER_IFACE,
-                       METHOD_POWER_LOCK_EXPIRED,
+                       METHOD_LOCK_TIMEOUT_INPUT,
                        "si", param);
        if (ret < 0)
-               _E("FAIL: broadcast_dbus_signal(%d)", ret);
+               _E("Failed to deliver the result (%d)", ret);
 }
 
 static int power_lock_expired_get_content(const struct popup_ops *ops, char *content, unsigned int len)
@@ -111,7 +115,7 @@ static void power_lock_expired_allow_app(const struct popup_ops *ops)
 
        unload_simple_popup(ops);
 
-       send_result_dbus_signal(ALLOW_APP);
+       send_result(ALLOW_APP);
 
        terminate_if_no_popup();
 }
@@ -122,15 +126,15 @@ static void power_lock_expired_close_app(const struct popup_ops *ops)
 
        unload_simple_popup(ops);
 
-       send_result_dbus_signal(CLOSE_APP);
+       send_result(CLOSE_APP);
 
        terminate_if_no_popup();
 }
 
 static void power_lock_expired_terminate(const struct popup_ops *ops)
 {
-       send_result_dbus_signal(CLOSE_APP);
-       signal_broadcasted = false;
+       send_result(CLOSE_APP);
+       result_sended = false;
 }
 
 static const struct popup_ops power_lock_expired_ops = {