Enhance dbus policy 54/235554/3 accepted/tizen/unified/20200607.214822 submit/tizen/20200605.111029
authorJeon Sang-Heon <sh95.jeon@samsung.com>
Fri, 5 Jun 2020 10:23:22 +0000 (19:23 +0900)
committerJeon Sang-Heon <sh95.jeon@samsung.com>
Fri, 5 Jun 2020 10:51:23 +0000 (19:51 +0900)
- Allow org.freedesktop.DBus.Properties
- Create proxy once
- Check not support external device

Change-Id: I5cd3ad41ef6d6cee8fee9ecf1cfcd10454938156
Signed-off-by: Jeon Sang-Heon <sh95.jeon@samsung.com>
packaging/update-manager.conf
src/update_control.c
update-manager/fota-storage-checker.c

index d92dcfe2bb3a13357537e5ebf002f28c943e5633..2eaf90b38c16fc50f5f43b29025c577294d4f273 100644 (file)
@@ -7,7 +7,8 @@
   </policy>
   <policy context="default">
     <deny own="org.tizen.update.manager"/>
-    <deny send_destination="org.tizen.update.manager"/>
-    <allow send_destination="org.tizen.update.manager" send_interface="org.tizen.update.manager" send_type="method_call" />
+    <deny send_destination="org.tizen.update.manager" send_type="method_call"/>
+    <allow send_destination="org.tizen.update.manager" send_interface="org.tizen.update.manager" send_member="install" />
+    <allow send_destination="org.tizen.update.manager" send_interface="org.freedesktop.DBus.Properties" send_member="GetAll" />
   </policy>
 </busconfig>
\ No newline at end of file
index 9960fb016647de62e4248ec3279eb76456107a10..6f4ce606bbfe0949e08713c6f0e2d1a4534d5810 100644 (file)
@@ -168,36 +168,38 @@ API int update_control_download_package(void)
 
 API int update_control_do_update(void)
 {
-    CHECK_FEATURE_SUPPORTED(DEVICE_UPDATE_FEATURE);
-    _I("Try to start update ...");
+       CHECK_FEATURE_SUPPORTED(DEVICE_UPDATE_FEATURE);
+       _I("Try to start update ...");
 
-    OrgTizenUpdateManager *proxy = NULL;
+       static OrgTizenUpdateManager *proxy = NULL;
        gint status = 0;
-    GError *error = NULL;
-
-    proxy = org_tizen_update_manager_proxy_new_for_bus_sync(
-        G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
-        "org.tizen.update.manager", "/org/tizen/update/manager", NULL, &error);
-    if (error == NULL) {
-        _I("Success to get proxy for org.tizen.update.manager");
-    } else {
-        _E("Failed get proxy for org.tizen.update.manager : %s", error->message);
-        return UPDATE_CONTROL_ERROR_SYSTEM_ERROR;
-    }
-
-    org_tizen_update_manager_call_install_sync(proxy, &status, NULL, &error);
-    if (error == NULL) {
-        _I("Success to call install to daemon");
-        if (status < 0) {
-            _E("Failed to do update : %d", status);
-            return UPDATE_CONTROL_ERROR_INVALID_OPERATION;
-        }
-    } else {
-        _E("Failed to call install to daemon : %s", error->message);
-        return UPDATE_CONTROL_ERROR_SYSTEM_ERROR;
-    }
-
-    return UPDATE_CONTROL_ERROR_NONE;
+       GError *error = NULL;
+
+       if (proxy == NULL) {
+               proxy = org_tizen_update_manager_proxy_new_for_bus_sync(
+                       G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE,
+                       "org.tizen.update.manager", "/org/tizen/update/manager", NULL, &error);
+               if (error == NULL) {
+                       _I("Success to get proxy for org.tizen.update.manager");
+               } else {
+                       _E("Failed get proxy for org.tizen.update.manager : %s", error->message);
+                       return UPDATE_CONTROL_ERROR_SYSTEM_ERROR;
+               }
+       }
+
+       org_tizen_update_manager_call_install_sync(proxy, &status, NULL, &error);
+       if (error == NULL) {
+               _I("Success to call install to daemon");
+               if (status < 0) {
+                       _E("Failed to do update : %d", status);
+                       return UPDATE_CONTROL_ERROR_INVALID_OPERATION;
+               }
+       } else {
+               _E("Failed to call install to daemon : %s", error->message);
+               return UPDATE_CONTROL_ERROR_SYSTEM_ERROR;
+       }
+
+       return UPDATE_CONTROL_ERROR_NONE;
 }
 
 API int update_control_make_reservation(struct tm *reservation_time)
index d3a046cc34788d0fba8e4e4865c9c0d488b509c9..709c81b6c65c0a0fd315ac549ab3fb6b43733191 100644 (file)
@@ -50,7 +50,9 @@ int fota_storage_checker_init()
 
     _I("Start process to get storage status");
     ret = storage_set_changed_cb(STORAGE_TYPE_EXTERNAL, fota_storage_checker_callback, NULL);
-    if (ret != STORAGE_ERROR_NONE) {
+    if (ret == STORAGE_ERROR_NOT_SUPPORTED) {
+        _I("External storage is not suppported, so local update will not be supported");
+    } else if (ret != STORAGE_ERROR_NONE) {
         _E("storage_set_changed_cb failed : %d", ret);
         return -1;
     }