Remove caching for device state check 45/316245/1 accepted/tizen_9.0_unified tizen_9.0 accepted/tizen/9.0/unified/20241215.191159
authorJeongmo Yang <jm80.yang@samsung.com>
Thu, 12 Dec 2024 05:26:22 +0000 (14:26 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Thu, 12 Dec 2024 05:26:22 +0000 (14:26 +0900)
- The invalid return value could be returned
  if camera device is added or removed.

[Version] 1.1.2
[Issue Type] Update

Change-Id: I6e09b1c235b1bbeea290f9b02b9f60d4b6c32149
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
muse/src/muse_camera_dispatcher.c
packaging/mmsvc-camera.spec

index 0290cd769cafc34df9f21c8dab4745b4c810145d..d784b5d4bb885a01ab98916111935df21264a0a1 100644 (file)
@@ -33,8 +33,6 @@
 
 #define CAMERA_FEATURE_NAME   "http://tizen.org/feature/camera"
 #define CAMERA_PRIVILEGE_NAME "http://tizen.org/privilege/camera"
-#define MUSED_KEY_DEVICE_STATE_CHECK  "camera_get_device_state_is_called"
-#define MUSED_KEY_DEVICE_STATE_RETURN "camera_get_device_state_return"
 #define MUSED_KEY_FLASH_STATE_CHECK   "camera_get_flash_state_is_called"
 #define MUSED_KEY_FLASH_STATE_RETURN  "camera_get_flash_state_return"
 #define MUSED_KEY_FLASH_STATE_COUNT   "camera_get_flash_state_count"
@@ -5643,7 +5641,6 @@ int camera_dispatcher_get_display_reuse_hint(muse_module_h module)
 int camera_dispatcher_get_device_state(muse_module_h module)
 {
        int ret = CAMERA_ERROR_NONE;
-       int is_called = false;
        char value_key[KEY_LENGTH] = {'\0',};
        bool camera_feature_supported = false;
        camera_h camera = NULL;
@@ -5663,33 +5660,24 @@ int camera_dispatcher_get_device_state(muse_module_h module)
                return MUSE_CAMERA_ERROR_NONE;
        }
 
-       muse_server_module_get_value(module, MUSED_KEY_DEVICE_STATE_CHECK, &is_called);
-
-       if (!is_called) {
-               ret = legacy_camera_create(device_type, &camera);
-               if (camera) {
-                       legacy_camera_destroy(camera);
-                       camera = NULL;
-               }
+       ret = legacy_camera_create(device_type, &camera);
+       if (camera) {
+               legacy_camera_destroy(camera);
+               camera = NULL;
+       }
 
-               /* camera feature support check */
-               if (ret == CAMERA_ERROR_NONE) {
-                       if (muse_server_get_platform_info(CAMERA_FEATURE_NAME, &camera_feature_supported) != MM_ERROR_NONE)
-                               CAM_LOG_ERROR("failed to get platform info for camera support");
+       /* camera feature support check */
+       if (ret == CAMERA_ERROR_NONE) {
+               if (muse_server_get_platform_info(CAMERA_FEATURE_NAME, &camera_feature_supported) != MM_ERROR_NONE)
+                       CAM_LOG_ERROR("failed to get platform info for camera support");
 
-                       if (!camera_feature_supported) {
-                               CAM_LOG_ERROR("CAMERA NOT SUPPORTED, BUT INI FILE FOR CAMERA IS EXISTED. RECOMMEND TO REMOVE IT.");
-                               ret = CAMERA_ERROR_NOT_SUPPORTED;
-                       }
+               if (!camera_feature_supported) {
+                       CAM_LOG_ERROR("CAMERA NOT SUPPORTED, BUT INI FILE FOR CAMERA IS EXISTED. RECOMMEND TO REMOVE IT.");
+                       ret = CAMERA_ERROR_NOT_SUPPORTED;
                }
-
-               muse_server_module_set_value(module, MUSED_KEY_DEVICE_STATE_RETURN, ret);
-               muse_server_module_set_value(module, MUSED_KEY_DEVICE_STATE_CHECK, (int)true);
-       } else {
-               muse_server_module_get_value(module, MUSED_KEY_DEVICE_STATE_RETURN, &ret);
        }
 
-       CAM_LOG_INFO("is_called[%d], ret[0x%x]", is_called, ret);
+       CAM_LOG_INFO("ret[0x%x]", ret);
 
        if (ret != CAMERA_ERROR_NONE) {
                CAM_LOG_ERROR("failed to create camera handle[0x%x]", ret);
index 3052ba4b992fdc3c82bbd9a653a1cc3974ae74e0..89cbdf8738681d146ecb6b02ebf0d79e45b1b47d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-camera
 Summary:    A Camera module for muse server
-Version:    1.1.1
+Version:    1.1.2
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0