Revert "Revert "modify default plugin's behavior by emulator"" 94/96694/2
authorJaewon Lim <jaewon81.lim@samsung.com>
Thu, 10 Nov 2016 01:52:19 +0000 (17:52 -0800)
committerSangjin Kim <sangjin3.kim@samsung.com>
Thu, 10 Nov 2016 04:46:18 +0000 (20:46 -0800)
This reverts commit b94610b00ff7573e1f16c8f08cc92d11d88d080a.

Change-Id: I8d4d37517c8cd13a6a8e763a68a5f1ccd19038bd

src/default_plugin_basic.c
src/default_plugin_event.c
src/plugin.c

index f8ceba0..2072824 100644 (file)
@@ -57,11 +57,7 @@ int get_plugin_capability ( parameters* in, parameters* out )
     } else if ( capability == CAPABILITY_FILESYNC ) {
         make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_PUSHPULL );
     } else if ( capability == CAPABILITY_USB_PROTOCOL ) {
-        if ( is_emulator() ) {
-            make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_DISABLED );
-        } else {
-            make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_ENABLED );
-        }
+        make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_ENABLED );
     } else if ( capability == CAPABILITY_SOCK_PROTOCOL ) {
         make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_ENABLED );
     } else if ( capability == CAPABILITY_ROOT_ONOFF ) {
@@ -77,7 +73,7 @@ int get_plugin_capability ( parameters* in, parameters* out )
     } else if ( capability == CAPABILITY_PRODUCT_VER ) {
         make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_UNKNOWN );
     } else if ( capability == CAPABILITY_LOG_ENABLE ) {
-        make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_DISABLED );
+        make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", PLUGIN_RET_ENABLED );
     } else if ( capability == CAPABILITY_LOG_PATH ) {
         make_string_parameter ( & ( out->array_of_parameter[0] ), "%s", LOG_DIRECTORY );
     } else if ( capability == CAPABILITY_APPCMD ) {
index 2f7d745..6731746 100644 (file)
 #include <vconf.h>
 #include <glib.h>
 
-#define TRACE_TAG TRACE_SDB
-#include "log.h"
-
 #include "sysdeps.h"
 #include "sdbd_plugin.h"
 #include "default_plugin.h"
 
-int get_lock_state ( parameters* in, parameters* out )
-{
-    if ( in == NULL || in->number_of_parameter != 1 || in->array_of_parameter == NULL
-            || in->array_of_parameter[0].type != type_int32 ) {
-        D ( "Invalid argument\n" );
-        return PLUGIN_CMD_FAIL;
-    }
-
-    if ( out == NULL ) {
-        D ( "Invalid argument\n" );
-        return PLUGIN_CMD_FAIL;
-    }
-
-    D ( "lock type: %d\n", in->array_of_parameter[0].v_int32);
-
-    out->number_of_parameter = 1;
-    out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
-    out->array_of_parameter[0].type = type_int32;
-    out->array_of_parameter[0].v_int32 = ( plugin_pwlocked() == 1 ) ? PLUGIN_RET_ON : PLUGIN_RET_OFF;
-
-    return PLUGIN_CMD_SUCCESS;
-}
-
 int plugin_pwlocked ( void )
 {
     int pwlock_status = 0;
@@ -82,6 +56,29 @@ int plugin_pwlocked ( void )
     return 0; // unlocked!
 }
 
+int get_lock_state ( parameters* in, parameters* out )
+{
+    if ( in == NULL || in->number_of_parameter != 1 || in->array_of_parameter == NULL
+            || in->array_of_parameter[0].type != type_int32 ) {
+        PLUGIN_LOG ( "Invalid argument\n" );
+        return PLUGIN_CMD_FAIL;
+    }
+
+    if ( out == NULL ) {
+        PLUGIN_LOG ( "Invalid argument\n" );
+        return PLUGIN_CMD_FAIL;
+    }
+
+    PLUGIN_LOG ( "lock type: %d\n", in->array_of_parameter[0].v_int32);
+
+    out->number_of_parameter = 1;
+    out->array_of_parameter = ( parameter* ) malloc ( sizeof ( parameter ) );
+    out->array_of_parameter[0].type = type_int32;
+    out->array_of_parameter[0].v_int32 = ( plugin_pwlocked() == 1 ) ? PLUGIN_RET_ON : PLUGIN_RET_OFF;
+
+    return PLUGIN_CMD_SUCCESS;
+}
+
 static void pwlock_cb ( keynode_t *key, void* data )
 {
     PLUGIN_LOG ( "pwlock callback is issued\n" );
@@ -131,8 +128,8 @@ void create_pwlock_thread()
 {
     sdb_thread_t t;
     if ( sdb_thread_create ( &t, pwlock_thread, NULL ) ) {
-        PLUGIN_LOG ( "cannot create_pwlock_thread.\n" );
+        PLUGIN_LOG ( "default plugin : cannot create_pwlock_thread.\n" );
         return;
     }
-    PLUGIN_LOG ( "created pwlock_thread\n" );
+    PLUGIN_LOG ( "default plugin : created pwlock_thread\n" );
 }
index 1cf11f7..ff9f19c 100644 (file)
@@ -73,7 +73,10 @@ int plugin_event_handler ( int event_type, parameters* data )
 static int plugin_register_command ( int command, priority cmd_priority )
 {
     if ( plugin_cmd_hashtable ) {
-        hashtable_put ( plugin_cmd_hashtable, command, cmd_priority );
+        int ret = hashtable_put ( plugin_cmd_hashtable, command, cmd_priority );
+        D ("register plugin command : cmd(%d), result(%d)\n", command, ret);
+    } else {
+        D ("hashtable is not created\n");
     }
     return 0;
 }
@@ -161,6 +164,9 @@ int is_supported_by_plugin ( int cmd )
     if ( plugin_cmd_hashtable ) {
         int value;
         ret = hashtable_get ( plugin_cmd_hashtable, cmd, &value );
+        D ("get from hashtable : cmd(%d), result(%d)\n", cmd, ret);
+    } else {
+        D ("hashtable is not created\n");
     }
 
     return ret;
@@ -263,12 +269,16 @@ int request_capability_to_plugin ( int cap, char* out_buf, unsigned int out_len
     in.array_of_parameter[0].type = type_int32;
     in.array_of_parameter[0].v_int32 = cap;
 
+    D ("requested capability : %d\n", cap);
+
     ret = request_sync_cmd ( PLUGIN_SYNC_CMD_CAPABILITY, &in, &out );
     if ( ret == PLUGIN_CMD_SUCCESS ) {
         strncpy ( out_buf, out.array_of_parameter[0].v_string.data, out_len - 1 );
         out_buf[out_len - 1] = '\0';
         success = 1;
         release_parameters ( &out );
+
+        D ("request capability success : %s\n", out_buf);
     }
 
     release_parameters ( &in );
@@ -294,10 +304,14 @@ int request_validity_to_plugin ( int cmd, const char* in_buf )
         in.array_of_parameter = NULL;
     }
 
+    D ("requested validity : %d, %s\n", cmd, in_buf);
+
     ret = request_sync_cmd ( cmd, &in, &out );
     if ( ret == PLUGIN_CMD_SUCCESS ) {
         success = ( out.array_of_parameter[0].v_int32 == PLUGIN_RET_VALID ) ? 1 : 0;
         release_parameters ( &out );
+
+        D ("request validity success : %d\n", out.array_of_parameter[0].v_int32);
     }
 
     release_parameters ( &in );