capi-system-info
)
-IF (X11_SUPPORT)
-pkg_check_modules(pkg_extra REQUIRED
- x11
- libdri2
- dri2proto
-)
-SET(REQUIRES_PKG_CONFIG "libdri2 dri2proto")
-ENDIF (X11_SUPPORT)
-
-IF (WAYLAND_SUPPORT)
-pkg_check_modules(pkg_extra REQUIRED
- wayland-client
-)
-SET(REQUIRES_PKG_CONFIG "wayland-client")
-ENDIF (WAYLAND_SUPPORT)
-
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
ADD_DEFINITIONS("-DLOG_TAG=\"WIDGET_SERVICE\"")
ADD_DEFINITIONS("-DNDEBUG")
ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET")
-ADD_DEFINITIONS("-DSERVICE_SOCKET=\"/tmp/.data-provider-master-service.socket\"")
-ADD_DEFINITIONS("-DRESOLUTION_FILE=\"/usr/share/data-provider-master/resolution.ini\"")
-ADD_DEFINITIONS("-DDB_FILE=\"/usr/dbspace/.widget.db\"")
-ADD_DEFINITIONS("-DDEFAULT_MASTER_CONF=\"/usr/share/data-provider-master/conf.ini\"")
+ADD_DEFINITIONS("-DRESOLUTION_FILE=\"/usr/share/widget-service/resolution.ini\"")
+ADD_DEFINITIONS("-DDEFAULT_MASTER_CONF=\"/usr/share/widget-service/conf.ini\"")
SET(BUILD_SOURCE
- src/dlist.c
src/widget_service.c
- src/util.c
src/widget_conf.c
- src/widget_abi.c
- src/widget_monitor.c
)
-IF (X11_SUPPORT)
- ADD_DEFINITIONS("-DHAVE_X11")
- SET(BUILD_SOURCE
- ${BUILD_SOURCE}
- src/util_x11.c
- )
-ENDIF (X11_SUPPORT)
-
-IF (WAYLAND_SUPPORT)
- INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/wayland-drm/include)
- ADD_DEFINITIONS("-DHAVE_WAYLAND")
- SET(BUILD_SOURCE
- ${BUILD_SOURCE}
- src/util_wayland.c
- wayland-drm/src/wayland-drm.c # This will be generated by wayland-scanner
- )
-ENDIF (WAYLAND_SUPPORT)
-
ADD_LIBRARY(${PROJECT_NAME} SHARED ${BUILD_SOURCE})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_service.h DESTINATION include/${PROJECT_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_service_internal.h DESTINATION include/${PROJECT_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_errno.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_cmd_list.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_buffer.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_script.h DESTINATION include/${PROJECT_NAME})
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_conf.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_abi.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/widget_util.h DESTINATION include/${PROJECT_NAME})
-
-IF (WAYLAND_SUPPORT)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wayland-drm/include/widget_wayland-drm-client-protocol.h DESTINATION include/${PROJECT_NAME})
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wayland-drm/include/widget_wayland-drm-server-protocol.h DESTINATION include/${PROJECT_NAME})
-ENDIF (WAYLAND_SUPPORT)
ADD_SUBDIRECTORY(parser)
--- /dev/null
+[c]
+package=org.tizen.data-provider-slave
+
+[cpp]
+package=org.tizen.data-provider-slave
+
+[html]
+package=widget.web-provider
+
+[osp]
+package=gi2qxenosh.osp-appwidget-service
+
+[app]
+package=/APPID/
+
+[svc]
+package=org.tizen.data-provider-slave.svc
+
+[meta]
+package=meta-key
--- /dev/null
+base_width=320
+base_height=480
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+#input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+#auto_align=true
--- /dev/null
+1x1=0x0
+2x1=0x0
+2x2=0x0
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=302x302
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=320x480
+base=320x480
--- /dev/null
+base_width=480
+base_height=800
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=20.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event1
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+use_event_time=true
+use_gettimeofday=false
+slave_event_boost_on=-10
+slave_event_boost_off=0
+event_filter=0.5
+#slave_limit_to_ttl=true
+#frame_skip=5
--- /dev/null
+1x1=126x126
+2x1=0x0
+2x2=0x0
+4x1=0x0
+4x2=470x234
+4x3=0x0
+4x4=470x470
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=480x800
+base=480x800
--- /dev/null
+base_width=540
+base_height=960
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=20.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=sec_touchscreen
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+use_event_time=true
+use_gettimeofday=false
+slave_event_boost_on=-10
+slave_event_boost_off=0
+event_filter=0.5
+#slave_limit_to_ttl=true
+#frame_skip=5
--- /dev/null
+1x1=130x150
+2x1=264x150
+2x2=264x304
+4x1=534x150
+4x2=534x304
+4x3=534x458
+4x4=534x612
+4x5=534x766
+4x6=534x920
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=540x960
+base=540x960
--- /dev/null
+base_width=720
+base_height=1280
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=104857600
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=shm
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+#input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+#auto_align=true
--- /dev/null
+1x1=175x175
+2x1=354x175
+2x2=354x354
+4x1=712x175
+4x2=712x354
+4x3=712x533
+4x4=712x712
+4x5=712x891
+4x6=712x1070
+21x21=224x215
+23x21=680x215
+23x23=680x653
+0x0=720x1280
--- /dev/null
+base_width=360
+base_height=360
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event0
+pd_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+check_lcd=false
--- /dev/null
+1x1=170x170
+2x1=0x0
+2x2=360x360
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=360x360
+base=360x360
--- /dev/null
+base_width=360
+base_height=480
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event0
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+check_lcd=false
--- /dev/null
+1x1=170x170
+2x1=0x0
+2x2=360x480
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=360x480
+base=360x480
--- /dev/null
+base_width=320
+base_height=320
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=104857600
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=shm
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+#input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+#auto_align=true
--- /dev/null
+1x1=320x320
+2x1=0x0
+2x2=320x320
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=320x320
+base=320x320
--- /dev/null
+base_width=320
+base_height=480
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+#input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+#auto_align=true
--- /dev/null
+1x1=0x0
+2x1=0x0
+2x2=0x0
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=302x302
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=320x480
+base=320x480
--- /dev/null
+base_width=480
+base_height=800
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=20.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event1
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+use_event_time=true
+use_gettimeofday=false
+slave_event_boost_on=-10
+slave_event_boost_off=0
+event_filter=0.5
+#slave_limit_to_ttl=true
+#frame_skip=5
--- /dev/null
+1x1=116x116
+2x1=234x116
+2x2=234x234
+4x1=470x116
+4x2=470x234
+4x3=470x352
+4x4=470x470
+4x5=470x588
+4x6=470x706
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=480x800
+base=480x800
--- /dev/null
+base_width=540
+base_height=960
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=20.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=sec_touchscreen
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+use_event_time=true
+use_gettimeofday=false
+slave_event_boost_on=-10
+slave_event_boost_off=0
+event_filter=0.5
+#slave_limit_to_ttl=true
+#frame_skip=5
--- /dev/null
+1x1=130x150
+2x1=264x150
+2x2=264x304
+4x1=534x150
+4x2=534x304
+4x3=534x458
+4x4=534x612
+4x5=534x766
+4x6=534x920
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=540x960
+base=540x960
--- /dev/null
+base_width=720
+base_height=1280
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=104857600
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+#input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+#auto_align=true
+#use_event_time=true
+event_filter=0.5
--- /dev/null
+1x1=175x175
+2x1=354x175
+2x2=354x354
+4x1=712x175
+4x2=712x354
+4x3=712x533
+4x4=712x712
+4x5=712x891
+4x6=712x1070
+21x21=224x215
+23x21=680x215
+23x23=680x653
+0x0=720x1280
--- /dev/null
+base_width=360
+base_height=360
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event0
+pd_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+check_lcd=false
--- /dev/null
+1x1=170x170
+2x1=0x0
+2x2=360x360
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=360x360
+base=360x360
--- /dev/null
+base_width=360
+base_height=480
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event0
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+check_lcd=false
--- /dev/null
+1x1=170x170
+2x1=0x0
+2x2=360x480
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=360x480
+base=360x480
--- /dev/null
+base_width=320
+base_height=320
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=104857600
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+#input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+#auto_align=true
+#use_event_time=true
+check_lcd=false
--- /dev/null
+1x1=170x170
+2x1=0x0
+2x2=320x320
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=320x320
+base=320x320
--- /dev/null
+[c]
+package=org.tizen.data-provider-slave
+
+[cpp]
+package=org.tizen.data-provider-slave
+
+[html]
+package=widget.web-provider
+
+[osp]
+package=gi2qxenosh.osp-appwidget-service
+
+[app]
+package=/APPID/
+
+[svc]
+package=org.tizen.data-provider-slave.svc
+
+[meta]
+package=meta-key
--- /dev/null
+base_width=320
+base_height=480
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+#input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+#auto_align=true
--- /dev/null
+1x1=0x0
+2x1=0x0
+2x2=0x0
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=302x302
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=320x480
+base=320x480
--- /dev/null
+base_width=480
+base_height=800
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=20.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event1
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+use_event_time=true
+use_gettimeofday=false
+slave_event_boost_on=-10
+slave_event_boost_off=0
+event_filter=0.5
+#slave_limit_to_ttl=true
+#frame_skip=5
--- /dev/null
+1x1=126x126
+2x1=0x0
+2x2=0x0
+4x1=0x0
+4x2=470x234
+4x3=0x0
+4x4=470x470
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=480x800
+base=480x800
--- /dev/null
+base_width=540
+base_height=960
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=20.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+use_event_time=true
+use_gettimeofday=false
+slave_event_boost_on=-10
+slave_event_boost_off=0
+event_filter=0.5
+#slave_limit_to_ttl=true
+#frame_skip=5
--- /dev/null
+1x1=130x150
+2x1=264x150
+2x2=264x304
+4x1=534x150
+4x2=534x304
+4x3=534x458
+4x4=534x612
+4x5=534x766
+4x6=534x920
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=540x960
+base=540x960
--- /dev/null
+base_width=720
+base_height=1280
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=104857600
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=shm
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+#input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=1
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+#auto_align=true
--- /dev/null
+1x1=175x175
+2x1=354x175
+2x2=354x354
+4x1=712x175
+4x2=712x354
+4x3=712x533
+4x4=712x712
+4x5=712x891
+4x6=712x1070
+21x21=224x215
+23x21=680x215
+23x23=680x653
+0x0=720x1280
--- /dev/null
+base_width=360
+base_height=360
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event0
+pd_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+check_lcd=false
--- /dev/null
+1x1=170x170
+2x1=0x0
+2x2=360x360
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=360x360
+base=360x360
--- /dev/null
+base_width=360
+base_height=480
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event0
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+check_lcd=false
--- /dev/null
+1x1=170x170
+2x1=0x0
+2x2=360x480
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=360x480
+base=360x480
--- /dev/null
+base_width=320
+base_height=320
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=104857600
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=shm
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+#input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+#auto_align=true
--- /dev/null
+1x1=320x320
+2x1=0x0
+2x2=320x320
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=320x320
+base=320x320
--- /dev/null
+base_width=320
+base_height=480
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+#auto_align=true
--- /dev/null
+1x1=0x0
+2x1=0x0
+2x2=0x0
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=302x302
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=320x480
+base=320x480
--- /dev/null
+base_width=480
+base_height=800
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=20.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+use_event_time=true
+use_gettimeofday=false
+slave_event_boost_on=-10
+slave_event_boost_off=0
+event_filter=0.5
+#slave_limit_to_ttl=true
+#frame_skip=5
--- /dev/null
+1x1=116x116
+2x1=234x116
+2x2=234x234
+4x1=470x116
+4x2=470x234
+4x3=470x352
+4x4=470x470
+4x5=470x588
+4x6=470x706
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=480x800
+base=480x800
--- /dev/null
+base_width=540
+base_height=960
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=20.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+use_event_time=true
+use_gettimeofday=false
+slave_event_boost_on=-10
+slave_event_boost_off=0
+event_filter=0.5
+#slave_limit_to_ttl=true
+#frame_skip=5
--- /dev/null
+1x1=130x150
+2x1=264x150
+2x2=264x304
+4x1=534x150
+4x2=534x304
+4x3=534x458
+4x4=534x612
+4x5=534x766
+4x6=534x920
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=540x960
+base=540x960
--- /dev/null
+base_width=720
+base_height=1280
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=104857600
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[utility],[badge]
+#auto_align=true
+#use_event_time=true
+event_filter=0.5
--- /dev/null
+1x1=175x175
+2x1=354x175
+2x2=354x354
+4x1=712x175
+4x2=712x354
+4x3=712x533
+4x4=712x712
+4x5=712x891
+4x6=712x1070
+21x21=224x215
+23x21=680x215
+23x23=680x653
+0x0=720x1280
--- /dev/null
+base_width=360
+base_height=360
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event2
+pd_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+auto_align=false
+check_lcd=false
--- /dev/null
+1x1=170x170
+2x1=0x0
+2x2=360x360
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=360x360
+base=360x360
--- /dev/null
+base_width=360
+base_height=480
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=1048576
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[notification],[badge]
+check_lcd=false
--- /dev/null
+1x1=170x170
+2x1=0x0
+2x2=360x480
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=360x480
+base=360x480
--- /dev/null
+base_width=320
+base_height=320
+minimum_period=1.0
+#script=edje
+#default_abi=c
+#default_group=disclosure
+default_period=-1.0
+default_packet_time=0.0001
+#default_content=default
+minimum_space=104857600
+#replace_tag=/APPID/
+slave_ttl=0.0
+slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+#db_path=/usr/dbspace/.widget.db
+#share_path=/opt/usr/share/live_magazine/
+log_path=/tmp/.widget.service
+#always_path=/opt/usr/share/live_magazine/always
+#reader_path=/opt/usr/share/live_magazine/reader
+#script_port_path=/usr/share/data-provider-master/plugin-script/
+ping_interval=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=pixmap
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
+input=/dev/input/event2
+gbar_request_timeout=5.0
+premultiplied=0
+#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M
+services=[widget],[shortcut],[badge]
+#auto_align=true
+#use_event_time=true
+check_lcd=false
--- /dev/null
+1x1=170x170
+2x1=0x0
+2x2=320x320
+4x1=0x0
+4x2=0x0
+4x3=0x0
+4x4=0x0
+4x5=0x0
+4x6=0x0
+21x21=0x0
+23x21=0x0
+23x23=0x0
+0x0=320x320
+base=320x320
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define dlist_remove_data(list, data) do { \
- struct dlist *l; \
- l = dlist_find_data(list, data); \
- list = dlist_remove(list, l); \
-} while (0)
-
-#define dlist_foreach(list, l, data) \
- for ((l) = (list); (l) && ((data) = dlist_data(l)); (l) = dlist_next(l))
-
-#define dlist_foreach_safe(list, l, n, data) \
- for ((l) = (list), (n) = dlist_next(l); \
- (l) && ((data) = dlist_data(l)); \
- (l) = (n), (n) = dlist_next(l))
-
-struct dlist;
-
-extern struct dlist *dlist_append(struct dlist *list, void *data);
-extern struct dlist *dlist_prepend(struct dlist *list, void *data);
-extern struct dlist *dlist_remove(struct dlist *list, struct dlist *l);
-extern struct dlist *dlist_find_data(struct dlist *list, void *data);
-extern void *dlist_data(struct dlist *l);
-extern struct dlist *dlist_next(struct dlist *l);
-extern struct dlist *dlist_prev(struct dlist *l);
-extern int dlist_count(struct dlist *l);
-extern struct dlist *dlist_nth(struct dlist *l, int nth);
-
-/* End of a file */
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-struct supported_size_list {
- int w;
- int h;
-};
-
-struct service_info {
- sqlite3 *handle;
- const char *dbfile;
- const char *conf_file;
- int init_count;
-
- const char *iso3lang;
- char country[ULOC_COUNTRY_CAPACITY];
- char *syslang;
- int country_len;
-
- int base_w;
- int base_h;
-
- int base_parse;
- widget_error_e last_status;
-};
-
-extern double util_timestamp(void);
-extern unsigned long util_free_space(const char *path);
-extern char *util_id_to_uri(const char *id); /* For FILENAME id */
-extern int util_update_resolution(struct service_info *info, struct supported_size_list *SIZE_LIST);
-extern int util_screen_size_get(unsigned int *width, unsigned int *height);
-
-#define DEFAULT_TIMEOUT 2.0
-#define SCHEMA_FILE "file://"
-#define SCHEMA_PIXMAP "pixmap://"
-#define SCHEMA_SHM "shm://"
-
-#define MAX_COLUMN 80
-
-static inline bool is_widget_feature_enabled(void)
-{
- static bool feature = false;
- static bool retrieved = false;
- int ret;
-
- if (retrieved == false) {
- ret = system_info_get_platform_bool("http://tizen.org/feature/shell.appwidget", &feature);
- if (ret != SYSTEM_INFO_ERROR_NONE) {
- ErrPrint("system_info: %d\n", ret);
- } else {
- retrieved = true;
- }
- }
-
- return feature;
-}
-
-/* End of a file */
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __WIDGET_SERVICE_ABI_H
-#define __WIDGET_SERVICE_ABI_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- */
-extern int widget_abi_init(void);
-
-/**
- */
-extern int widget_abi_fini(void);
-
-/**
- */
-extern const char *widget_abi_get_pkgname_by_abi(const char *abi);
-
-/**
- */
-extern const char *widget_abi_get_abi_by_pkgname(const char *pkgname);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-/* End of a file */
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __WIDGET_BUFFER_H
-#define __WIDGET_BUFFER_H
-
-#include <widget_service_internal.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file widget_buffer.h
- * @brief This file describe the buffer ADT and event definitions
- */
-
-/**
- * @addtogroup CAPI_WIDGET_SERVICE_MODULE
- * @{
- */
-
-/**
- * @internal
- * @brief Buffer type of widget
- */
-typedef enum widget_fb_type { /*!< Must have to be sync with libwidget-provider, libwidget-viewer */
- WIDGET_FB_TYPE_FILE,
- WIDGET_FB_TYPE_SHM,
- WIDGET_FB_TYPE_PIXMAP,
- WIDGET_FB_TYPE_ERROR
-} widget_fb_type_e;
-
-/**
- * @internal
- * @brief ADT for widget Buffer
- * @since_tizen 2.3.1
- */
-typedef struct widget_fb { /*!< Must has to be sync with slave & provider */
- enum widget_fb_state {
- WIDGET_FB_STATE_CREATED = 0x00beef00,
- WIDGET_FB_STATE_DESTROYED = 0x00dead00
- } state;
- widget_fb_type_e type;
- int refcnt;
- void *info;
- char data[];
-} *widget_fb_t;
-
-/**
- * @internal
- * @brief This enumeration value has to be sync'd with the libwidget interface. (only for inhouse widget)
- * @since_tizen 2.3.1
- */
-typedef enum widget_target_type {
- WIDGET_TYPE_WIDGET, /**< widget */
- WIDGET_TYPE_GBAR, /**< Glance Bar */
- WIDGET_TYPE_ERROR /**< Error */
-} widget_target_type_e;
-
-/**
- * @internal
- * @brief widget Frame Buffer Info
- * @since_tizen 2.3.1
- */
-struct fb_info {
- char *id;
- int w;
- int h;
- int bufsz;
- void *buffer;
-
- int pixels;
- int handle;
-
- void *gem;
-};
-
-/**
- * @internal
- * @brief Locking type - Read/Write
- * @since_tizen 2.3.1
- */
-typedef enum widget_lock_type {
- WIDGET_LOCK_READ = 0x01,
- WIDGET_LOCK_WRITE = 0x02,
-} widget_lock_type_e;
-
-/**
- * @internal
- * @brief Locking info
- * @since_tizen 2.3.1
- */
-typedef struct widget_lock_info {
- enum {
- LOCK_INITIALIZED = 0xb0e0e0f0,
- LOCK_CREATED = 0x0beef000,
- LOCK_DESTROYED = 0x0dead000
- } state;
- char *filename;
- int fd;
- widget_lock_type_e type;
-} *widget_lock_info_t;
-
-typedef struct widget_resource_lock_info {
- int fd;
- unsigned int resource_id;
- char *fname;
- widget_lock_type_e lock_type;
-} *widget_resource_lock_t;
-
-/**
- * @internal
- * @brief widget Buffer structure
- * @since_tizen 2.3.1
- */
-typedef struct widget_buffer {
- enum {
- BUFFER_INITIALIZED = 0x0b0e0e0f,
- BUFFER_CREATED = 0x00beef00,
- BUFFER_DESTROYED = 0x00dead00
- } state;
-
- widget_target_type_e type;
-
- union {
- int fd; /* File handle(descriptor) */
- int id; /* SHM handle(id) */
- } handle;
-
- char *pkgname;
- char *id;
- int width;
- int height;
- int pixel_size;
- int auto_align;
- int frame_skip; /**< To skip the first few frames to prevent from unexpected buffer clear */
-
- struct fb_info *fb;
-
- int (*handler)(struct widget_buffer *info, struct widget_buffer_event_data *event_info, void *data);
- void *data;
-
- void *user_data;
-
- unsigned int *extra_buffer;
-
- widget_lock_info_t lock_info;
-} *widget_buffer_h;
-
-/**
- * @internal
- * @brief Create a lock instance
- * @param[in] uri Instance URI
- * @param[in] type widget_target_type_e, WIDGET or GBAR
- * @param[in] option Read or Write
- * @return widget_lock_info_t
- * @retval NULL if it fails to create a lock, proper error code will be set on last_status
- * @retval info Lock information handler
- * @see widget_service_destroy_lock()
- * @see widget_service_acquire_lock()
- * @see widget_service_release_lock()
- */
-extern widget_lock_info_t widget_service_create_lock(const char *uri, widget_target_type_e type, widget_lock_type_e option);
-
-/**
- * @internal
- * @brief Destroy a lock instance
- * @param[in] info Lock information handler
- * @param[in] del delete a resource file if true
- * @return status
- * @retval #WIDGET_ERROR_INVALID_PARAMETER invalid paramter
- * @retval #WIDGET_ERROR_IO_ERROR Failed to manage the lock file
- * @retval #WIDGET_ERROR_NONE Successfully destroyed
- */
-extern int widget_service_destroy_lock(widget_lock_info_t info, int del);
-
-/**
- * @internal
- * @brief Acquire a lock instance
- * @param[in] info Lock information handler
- * @return status
- * @retval #WIDGET_ERROR_INVALID_PARAMETER invalid paramter
- * @retval #WIDGET_ERROR_NONE Successfully destroyed
- */
-extern int widget_service_acquire_lock(widget_lock_info_t info);
-
-/**
- * @internal
- * @brief Acquire a lock instance
- * @param[in] info Lock information handler
- * @return status
- * @retval #WIDGET_ERROR_INVALID_PARAMETER invalid paramter
- * @retval #WIDGET_ERROR_NONE Successfully destroyed
- */
-extern int widget_service_release_lock(widget_lock_info_t info);
-
-/**
- * @internal
- * @brief Create a resource lock instance
- * @param[in] pixmap Pixmap
- * @return widget_resource_lock_t
- * @retval @c NULL if it fails to create a lock
- */
-extern widget_resource_lock_t widget_service_create_resource_lock(unsigned int resource, widget_lock_type_e type);
-
-extern int widget_service_destroy_resource_lock(widget_resource_lock_t handle, int del);
-
-extern int widget_service_acquire_resource_lock(widget_resource_lock_t handle);
-
-extern int widget_service_release_resource_lock(widget_resource_lock_t handle);
-
-extern unsigned int widget_service_get_resource_lock_resource(widget_resource_lock_t handle);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* End of a file */
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __WIDGET_CMD_LIST_H
-#define __WIDGET_CMD_LIST_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file widget_cmd_list.h
- * @brief This file declares the list of command Id that are used for communicating with provider & viewer
- * Max length of CMD is 24 (PACKET_MAX_CMD from packet.h)
- */
-
-/**
- * @addtogroup CAPI_WIDGET_SERVICE_MODULE
- * @{
- */
-
-/**
- * @internal
- * @brief Command list for
- * Provider to Master,
- * or Master to Viewer
- */
-#define CMD_UPDATED 0x00000001 /**< WIDGET Updated */
-#define CMD_WIDGET_UPDATED 0x00000001 /**< Alias of CMD_UPDATED */
-#define CMD_DESC_UPDATED 0x00000101 /**< GBAR Updated */
-#define CMD_GBAR_UPDATED 0x00000101 /**< Alias of CMD_DESC_UPDATED */
-#define CMD_EXTRA_UPDATED 0x00000201
-#define CMD_EXTRA_INFO 0x00000301 /**< Extra information is updated */
-#define CMD_DELETED 0x00000401 /**< widget is deleted */
-#define CMD_FAULTED 0x00000501 /**< widget is faulted */
-#define CMD_FAULT_PACKAGE 0x00000501 /**< Faulted package */
-#define CMD_SCROLL 0x00000601
-#define CMD_WIDGET_UPDATE_BEGIN 0x00000701
-#define CMD_WIDGET_UPDATE_END 0x00000801
-#define CMD_GBAR_UPDATE_BEGIN 0x00000901
-#define CMD_GBAR_UPDATE_END 0x00000A01
-#define CMD_ACCESS_STATUS 0x00000B01
-#define CMD_KEY_STATUS 0x00000C01
-#define CMD_CLOSE_GBAR 0x00000D01
-
-#define CMD_STR_UPDATED "updated"
-#define CMD_STR_WIDGET_UPDATED "widget_updated"
-#define CMD_STR_DESC_UPDATED "desc_updated"
-#define CMD_STR_GBAR_UPDATED "gbar_updated"
-#define CMD_STR_EXTRA_UPDATED "extra_updated"
-#define CMD_STR_EXTRA_INFO "extra_info"
-#define CMD_STR_DELETED "deleted"
-#define CMD_STR_FAULTED "faulted"
-#define CMD_STR_FAULT_PACKAGE "fault_package"
-#define CMD_STR_SCROLL "scroll"
-#define CMD_STR_WIDGET_UPDATE_BEGIN "widget_update_begin"
-#define CMD_STR_WIDGET_UPDATE_END "widget_update_end"
-#define CMD_STR_GBAR_UPDATE_BEGIN "gbar_update_begin"
-#define CMD_STR_GBAR_UPDATE_END "gbar_update_end"
-#define CMD_STR_ACCESS_STATUS "access_status"
-#define CMD_STR_KEY_STATUS "key_status"
-#define CMD_STR_CLOSE_GBAR "close_gbar"
-
-/**
- * @internal
- * @brief Command list for
- * Provder to Master.
- */
-#define CMD_CALL 0x00000E01
-#define CMD_RET 0x00000F01
-#define CMD_ACQUIRE_BUFFER 0x00001001
-#define CMD_RESIZE_BUFFER 0x00001101
-#define CMD_RELEASE_BUFFER 0x00001201
-#define CMD_HELLO 0x00001301
-#define CMD_PING 0x00001401
-#define CMD_CTRL 0x00001501
-#define CMD_ACQUIRE_XBUFFER 0x00001601 // eXtra Buffer
-#define CMD_RELEASE_XBUFFER 0x00001701 // eXtra Buffer
-#define CMD_HELLO_SYNC 0x00001801
-#define CMD_HELLO_SYNC_PREPARE 0x00001901
-
-#define CMD_STR_CALL "call"
-#define CMD_STR_RET "ret"
-#define CMD_STR_ACQUIRE_BUFFER "acquire_buffer"
-#define CMD_STR_RESIZE_BUFFER "resize_buffer"
-#define CMD_STR_RELEASE_BUFFER "release_buffer"
-#define CMD_STR_HELLO "hello"
-#define CMD_STR_PING "ping"
-#define CMD_STR_CTRL "ctrl"
-#define CMD_STR_ACQUIRE_XBUFFER "acquire_xbuffer"
-#define CMD_STR_RELEASE_XBUFFER "release_xbuffer"
-#define CMD_STR_HELLO_SYNC "hello_sync"
-#define CMD_STR_HELLO_SYNC_PREPARE "hello_sync_prepare"
-
-
-/**
- * @internal
- * @brief Master to Viewer
- */
-#define CMD_GBAR_CREATED 0x00000E01
-#define CMD_GBAR_DESTROYED 0x00000F01
-#define CMD_CREATED 0x00001001
-#define CMD_GROUP_CHANGED 0x00001101
-#define CMD_PERIOD_CHANGED 0x00001201
-#define CMD_SIZE_CHANGED 0x00001301
-#define CMD_RESULT_PINUP 0x00001401 /**< To Viewer */
-#define CMD_RESULT_UPDATE_MODE 0x00001501 /**< To Viewer */
-#define CMD_WIDGET_CREATE_XBUF 0x00001601
-#define CMD_GBAR_CREATE_XBUF 0x00001701
-#define CMD_WIDGET_DESTROY_XBUF 0x00001801
-#define CMD_GBAR_DESTROY_XBUF 0x00001901
-#define CMD_UPDATE_ID 0x00001A01
-
-#define CMD_STR_GBAR_CREATED "gbar_created"
-#define CMD_STR_GBAR_DESTROYED "gbar_destroyed"
-#define CMD_STR_CREATED "created"
-#define CMD_STR_GROUP_CHANGED "group_changed"
-#define CMD_STR_PERIOD_CHANGED "period_changed"
-#define CMD_STR_SIZE_CHANGED "size_changed"
-#define CMD_STR_RESULT_PINUP "pinup"
-#define CMD_STR_RESULT_UPDATE_MODE "update_mode"
-#define CMD_STR_WIDGET_CREATE_XBUF "widget_create_xbuf"
-#define CMD_STR_GBAR_CREATE_XBUF "gbar_create_xbuf"
-#define CMD_STR_WIDGET_DESTROY_XBUF "widget_destroy_xbuf"
-#define CMD_STR_GBAR_DESTROY_XBUF "gbar_destroy_xbuf"
-#define CMD_STR_UPDATE_ID "update_id"
-
-/**
- * @internal
- * @brief Following list should be started after the common list of client_cmd_list
- * Master to Provider
- */
-#define CMD_GBAR_SHOW 0x00003C01
-#define CMD_GBAR_HIDE 0x00003D01
-#define CMD_WIDGET_PAUSE 0x00003E01
-#define CMD_WIDGET_RESUME 0x00003F01
-#define CMD_SCRIPT 0x00004001
-#define CMD_RENEW 0x00004101
-#define CMD_PINUP 0x00004201
-#define CMD_UPDATE_CONTENT 0x00004301
-#define CMD_PAUSE 0x00004401
-#define CMD_RESUME 0x00004501
-#define CMD_DISCONNECT 0x00004601
-#define CMD_VIEWER_CONNECTED 0x00004701
-#define CMD_VIEWER_DISCONNECTED 0x00004801
-#define CMD_CTRL_MODE 0x00004901
-
-#define CMD_STR_GBAR_SHOW "gbar_show"
-#define CMD_STR_GBAR_HIDE "gbar_hide"
-#define CMD_STR_WIDGET_PAUSE "widget_pause"
-#define CMD_STR_WIDGET_RESUME "widget_resume"
-#define CMD_STR_SCRIPT "script"
-#define CMD_STR_RENEW "renew"
-#define CMD_STR_PINUP "pinup"
-#define CMD_STR_UPDATE_CONTENT "update_content"
-#define CMD_STR_PAUSE "pause"
-#define CMD_STR_RESUME "resume"
-#define CMD_STR_DISCONNECT "disconnect"
-#define CMD_STR_VIEWER_CONNECTED "v_connected"
-#define CMD_STR_VIEWER_DISCONNECTED "v_disconnected"
-#define CMD_STR_CTRL_MODE "ctrl_mode"
-
-/**
- * @brief widget-mgr to master
- */
-#define CMD_INFO_HELLO 0x00000001
-#define CMD_INFO_SLAVE_LIST 0x00000101
-#define CMD_INFO_PKG_LIST 0x00000201
-#define CMD_INFO_INST_LIST 0x00000301
-#define CMD_INFO_SLAVE_CTRL 0x00000401
-#define CMD_INFO_PKG_CTRL 0x00000501
-#define CMD_INFO_MASTER_CTRL 0x00000601
-
-#define CMD_STR_INFO_HELLO "widget_mgr_hello"
-#define CMD_STR_INFO_SLAVE_LIST "slave_list"
-#define CMD_STR_INFO_PKG_LIST "pkg_list"
-#define CMD_STR_INFO_INST_LIST "inst_list"
-#define CMD_STR_INFO_SLAVE_CTRL "slave_ctrl"
-#define CMD_STR_INFO_PKG_CTRL "pkg_ctrl"
-#define CMD_STR_INFO_MASTER_CTRL "master_ctrl"
-
-/**
- * @internal
- * @brief Viewer to maser
- * or Master to provider
- */
-#define CMD_GBAR_MOUSE_MOVE 0x00000001
-#define CMD_WIDGET_MOUSE_MOVE 0x00000101
-#define CMD_GBAR_MOUSE_DOWN 0x00000201
-#define CMD_GBAR_MOUSE_UP 0x00000301
-#define CMD_WIDGET_MOUSE_DOWN 0x00000401
-#define CMD_WIDGET_MOUSE_UP 0x00000501
-#define CMD_GBAR_MOUSE_ENTER 0x00000601
-#define CMD_GBAR_MOUSE_LEAVE 0x00000701
-#define CMD_WIDGET_MOUSE_ENTER 0x00000801
-#define CMD_WIDGET_MOUSE_LEAVE 0x00000901
-#define CMD_WIDGET_MOUSE_ON_SCROLL 0x00000A01
-#define CMD_WIDGET_MOUSE_OFF_SCROLL 0x00000B01
-#define CMD_GBAR_MOUSE_ON_SCROLL 0x00000C01
-#define CMD_GBAR_MOUSE_OFF_SCROLL 0x00000D01
-#define CMD_WIDGET_MOUSE_ON_HOLD 0x00000E01
-#define CMD_WIDGET_MOUSE_OFF_HOLD 0x00000F01
-#define CMD_GBAR_MOUSE_ON_HOLD 0x00001001
-#define CMD_GBAR_MOUSE_OFF_HOLD 0x00001101
-#define CMD_CLICKED 0x00001201
-#define CMD_TEXT_SIGNAL 0x00001301
-#define CMD_DELETE 0x00001401
-#define CMD_RESIZE 0x00001501
-#define CMD_NEW 0x00001601
-#define CMD_SET_PERIOD 0x00001701
-#define CMD_CHANGE_GROUP 0x00001801
-#define CMD_GBAR_MOVE 0x00001901
-#define CMD_GBAR_ACCESS_HL 0x00001A01
-#define CMD_GBAR_ACCESS_ACTIVATE 0x00001B01
-#define CMD_GBAR_ACCESS_ACTION 0x00001C01
-#define CMD_GBAR_ACCESS_SCROLL 0x00001D01
-#define CMD_GBAR_ACCESS_VALUE_CHANGE 0x00001E01
-#define CMD_GBAR_ACCESS_MOUSE 0x00001F01
-#define CMD_GBAR_ACCESS_BACK 0x00002001
-#define CMD_GBAR_ACCESS_OVER 0x00002101
-#define CMD_GBAR_ACCESS_READ 0x00002201
-#define CMD_GBAR_ACCESS_ENABLE 0x00002301
-#define CMD_WIDGET_ACCESS_HL 0x00002401
-#define CMD_WIDGET_ACCESS_ACTIVATE 0x00002501
-#define CMD_WIDGET_ACCESS_ACTION 0x00002601
-#define CMD_WIDGET_ACCESS_SCROLL 0x00002701
-#define CMD_WIDGET_ACCESS_VALUE_CHANGE 0x00002801
-#define CMD_WIDGET_ACCESS_MOUSE 0x00002901
-#define CMD_WIDGET_ACCESS_BACK 0x00002A01
-#define CMD_WIDGET_ACCESS_OVER 0x00002B01
-#define CMD_WIDGET_ACCESS_READ 0x00002C01
-#define CMD_WIDGET_ACCESS_ENABLE 0x00002D01
-#define CMD_WIDGET_KEY_DOWN 0x00002E01
-#define CMD_WIDGET_KEY_UP 0x00002F01
-#define CMD_WIDGET_KEY_FOCUS_IN 0x00003001
-#define CMD_WIDGET_KEY_FOCUS_OUT 0x00003101
-#define CMD_GBAR_KEY_DOWN 0x00003201
-#define CMD_GBAR_KEY_UP 0x00003301
-#define CMD_GBAR_KEY_FOCUS_IN 0x00003401
-#define CMD_GBAR_KEY_FOCUS_OUT 0x00003501
-#define CMD_UPDATE_MODE 0x00003601
-#define CMD_WIDGET_MOUSE_SET 0x00003701
-#define CMD_WIDGET_MOUSE_UNSET 0x00003801
-#define CMD_GBAR_MOUSE_SET 0x00003901
-#define CMD_GBAR_MOUSE_UNSET 0x00003A01
-#define CMD_ORIENTATION 0x00003B01
-
-#define CMD_STR_GBAR_MOUSE_MOVE "gbar_mouse_move"
-#define CMD_STR_WIDGET_MOUSE_MOVE "widget_mouse_move"
-#define CMD_STR_GBAR_MOUSE_DOWN "gbar_mouse_down"
-#define CMD_STR_GBAR_MOUSE_UP "gbar_mouse_up"
-#define CMD_STR_WIDGET_MOUSE_DOWN "widget_mouse_down"
-#define CMD_STR_WIDGET_MOUSE_UP "widget_mouse_up"
-#define CMD_STR_GBAR_MOUSE_ENTER "gbar_mouse_enter"
-#define CMD_STR_GBAR_MOUSE_LEAVE "gbar_mouse_leave"
-#define CMD_STR_WIDGET_MOUSE_ENTER "widget_mouse_enter"
-#define CMD_STR_WIDGET_MOUSE_LEAVE "widget_mouse_leave"
-#define CMD_STR_WIDGET_MOUSE_ON_SCROLL "widget_mouse_on_scroll"
-#define CMD_STR_WIDGET_MOUSE_OFF_SCROLL "widget_mouse_off_scroll"
-#define CMD_STR_GBAR_MOUSE_ON_SCROLL "gbar_mouse_on_scroll"
-#define CMD_STR_GBAR_MOUSE_OFF_SCROLL "gbar_mouse_off_scroll"
-#define CMD_STR_WIDGET_MOUSE_ON_HOLD "widget_mouse_on_hold"
-#define CMD_STR_WIDGET_MOUSE_OFF_HOLD "widget_mouse_off_hold"
-#define CMD_STR_GBAR_MOUSE_ON_HOLD "gbar_mouse_on_hold"
-#define CMD_STR_GBAR_MOUSE_OFF_HOLD "gbar_mouse_off_hold"
-#define CMD_STR_CLICKED "clicked"
-#define CMD_STR_TEXT_SIGNAL "text_signal"
-#define CMD_STR_DELETE "delete"
-#define CMD_STR_RESIZE "resize"
-#define CMD_STR_NEW "new"
-#define CMD_STR_SET_PERIOD "set_period"
-#define CMD_STR_CHANGE_GROUP "change_group"
-#define CMD_STR_GBAR_MOVE "gbar_move"
-#define CMD_STR_GBAR_ACCESS_HL "gbar_acc_hl"
-#define CMD_STR_GBAR_ACCESS_ACTIVATE "gbar_acc_activate"
-#define CMD_STR_GBAR_ACCESS_ACTION "gbar_acc_action"
-#define CMD_STR_GBAR_ACCESS_SCROLL "gbar_acc_scroll"
-#define CMD_STR_GBAR_ACCESS_VALUE_CHANGE "gbar_acc_val_change"
-#define CMD_STR_GBAR_ACCESS_MOUSE "gbar_acc_mouse"
-#define CMD_STR_GBAR_ACCESS_BACK "gbar_acc_back"
-#define CMD_STR_GBAR_ACCESS_OVER "gbar_acc_over"
-#define CMD_STR_GBAR_ACCESS_READ "gbar_acc_read"
-#define CMD_STR_GBAR_ACCESS_ENABLE "gbar_acc_enable"
-#define CMD_STR_WIDGET_ACCESS_HL "widget_acc_hl"
-#define CMD_STR_WIDGET_ACCESS_ACTIVATE "widget_acc_activate"
-#define CMD_STR_WIDGET_ACCESS_ACTION "widget_acc_action"
-#define CMD_STR_WIDGET_ACCESS_SCROLL "widget_acc_scroll"
-#define CMD_STR_WIDGET_ACCESS_VALUE_CHANGE "widget_acc_val_change"
-#define CMD_STR_WIDGET_ACCESS_MOUSE "widget_acc_mouse"
-#define CMD_STR_WIDGET_ACCESS_BACK "widget_acc_back"
-#define CMD_STR_WIDGET_ACCESS_OVER "widget_acc_over"
-#define CMD_STR_WIDGET_ACCESS_READ "widget_acc_read"
-#define CMD_STR_WIDGET_ACCESS_ENABLE "widget_acc_enable"
-#define CMD_STR_WIDGET_KEY_DOWN "widget_key_down"
-#define CMD_STR_WIDGET_KEY_UP "widget_key_up"
-#define CMD_STR_WIDGET_KEY_FOCUS_IN "widget_key_focus_in"
-#define CMD_STR_WIDGET_KEY_FOCUS_OUT "widget_key_focus_out"
-#define CMD_STR_GBAR_KEY_DOWN "gbar_key_down"
-#define CMD_STR_GBAR_KEY_UP "gbar_key_up"
-#define CMD_STR_GBAR_KEY_FOCUS_IN "gbar_key_focus_in"
-#define CMD_STR_GBAR_KEY_FOCUS_OUT "gbar_key_focus_out"
-#define CMD_STR_UPDATE_MODE "update_mode"
-#define CMD_STR_WIDGET_MOUSE_SET "widget_mouse_set"
-#define CMD_STR_WIDGET_MOUSE_UNSET "widget_mouse_unset"
-#define CMD_STR_GBAR_MOUSE_SET "gbar_mouse_set"
-#define CMD_STR_GBAR_MOUSE_UNSET "gbar_mouse_unset"
-#define CMD_STR_ORIENTATION "orientation"
-
-/**
- * @internal
- * @brief viewer to master
- */
-#define CMD_CHANGE_VISIBILITY 0x00003C01
-#define CMD_WIDGET_ACQUIRE_PIXMAP 0x00003D01
-#define CMD_WIDGET_RELEASE_PIXMAP 0x00003E01
-#define CMD_GBAR_ACQUIRE_PIXMAP 0x00003F01
-#define CMD_GBAR_RELEASE_PIXMAP 0x00004001
-#define CMD_ACQUIRE 0x00004101
-#define CMD_RELEASE 0x00004201
-#define CMD_PINUP_CHANGED 0x00004301
-#define CMD_CREATE_GBAR 0x00004401
-#define CMD_DESTROY_GBAR 0x00004501
-#define CMD_ACTIVATE_PACKAGE 0x00004601
-#define CMD_SUBSCRIBE 0x00004701
-#define CMD_UNSUBSCRIBE 0x00004801
-#define CMD_DELETE_CLUSTER 0x00004901
-#define CMD_DELETE_CATEGORY 0x00004A01
-#define CMD_REFRESH_GROUP 0x00004B01
-#define CMD_UPDATE 0x00004C01
-#define CMD_WIDGET_KEY_SET 0x00004D01
-#define CMD_WIDGET_KEY_UNSET 0x00004E01
-#define CMD_GBAR_KEY_SET 0x00004F01
-#define CMD_GBAR_KEY_UNSET 0x00005001
-#define CMD_CLIENT_PAUSED 0x00005101
-#define CMD_CLIENT_RESUMED 0x00005201
-#define CMD_WIDGET_ACQUIRE_XPIXMAP 0x00005301
-#define CMD_GBAR_ACQUIRE_XPIXMAP 0x00005401
-#define CMD_SUBSCRIBE_CATEGORY 0x00005501
-#define CMD_UNSUBSCRIBE_CATEGORY 0x00005601
-
-#define CMD_STR_CHANGE_VISIBILITY "change,visibility"
-#define CMD_STR_WIDGET_ACQUIRE_PIXMAP "widget_acquire_pixmap"
-#define CMD_STR_WIDGET_RELEASE_PIXMAP "widget_release_pixmap"
-#define CMD_STR_GBAR_ACQUIRE_PIXMAP "gbar_acquire_pixmap"
-#define CMD_STR_GBAR_RELEASE_PIXMAP "gbar_release_pixmap"
-#define CMD_STR_ACQUIRE "acquire"
-#define CMD_STR_RELEASE "release"
-#define CMD_STR_PINUP_CHANGED "pinup_changed"
-#define CMD_STR_CREATE_GBAR "create_gbar"
-#define CMD_STR_DESTROY_GBAR "destroy_gbar"
-#define CMD_STR_ACTIVATE_PACKAGE "activate_package"
-#define CMD_STR_SUBSCRIBE "subscribe" /* pid, cluster, sub-cluster */
-#define CMD_STR_UNSUBSCRIBE "unsubscribe" /* pid, cluster, sub-cluster */
-#define CMD_STR_DELETE_CLUSTER "delete_cluster"
-#define CMD_STR_DELETE_CATEGORY "delete_category"
-#define CMD_STR_REFRESH_GROUP "refresh_group"
-#define CMD_STR_UPDATE "update"
-#define CMD_STR_WIDGET_KEY_SET "widget_key_set"
-#define CMD_STR_WIDGET_KEY_UNSET "widget_key_unset"
-#define CMD_STR_GBAR_KEY_SET "gbar_key_set"
-#define CMD_STR_GBAR_KEY_UNSET "gbar_key_unset"
-#define CMD_STR_CLIENT_PAUSED "client_paused"
-#define CMD_STR_CLIENT_RESUMED "client_resumed"
-#define CMD_STR_WIDGET_ACQUIRE_XPIXMAP "widget_acquire_xpixmap"
-#define CMD_STR_GBAR_ACQUIRE_XPIXMAP "gbar_acquire_xpixmap"
-#define CMD_STR_SUBSCRIBE_CATEGORY "subscribe,category"
-#define CMD_STR_UNSUBSCRIBE_CATEGORY "unsubscribe,category"
-
-/**
- * @internal
- * @brief Service API to Master
- */
-#define CMD_SERVICE_UPDATE 0x00000001
-#define CMD_SERVICE_CHANGE_PERIOD 0x00000101
-#define CMD_SERVICE_INST_CNT 0x00000201
-#define CMD_MONITOR_REGISTER 0x00000301
-#define CMD_MONITOR_UNREGISTER 0x00000401
-#define CMD_SERVICE_GET_CONTENT 0x00000501
-#define CMD_SERVICE_GET_INST_LIST 0x00000601
-
-#define CMD_STR_SERVICE_UPDATE "service_update"
-#define CMD_STR_SERVICE_CHANGE_PERIOD "service_change_period"
-#define CMD_STR_SERVICE_INST_CNT "service_inst_cnt"
-#define CMD_STR_MONITOR_REGISTER "monitor_register"
-#define CMD_STR_MONITOR_UNREGISTER "monitor_unregister"
-#define CMD_STR_SERVICE_GET_CONTENT "service_get_content"
-#define CMD_STR_SERVICE_GET_INST_LIST "service_get_inst_list"
-
-/**
- * @internal
- * @brief Master to Service (Monitor)
- */
-#define CMD_MONITOR_CREATE 0x00000001
-#define CMD_MONITOR_DESTROY 0x00000101
-#define CMD_MONITOR_PAUSE 0x00000201
-#define CMD_MONITOR_RESUME 0x00000301
-
-#define CMD_STR_MONITOR_CREATE "monitor_create"
-#define CMD_STR_MONITOR_DESTROY "monitor_destroy"
-#define CMD_STR_MONITOR_PAUSE "monitor_pause"
-#define CMD_STR_MONITOR_RESUME "monitor_resume"
-
-/**
- * @internal
- * @brief Viewer to Master (Shared FD)
- */
-#define CMD_DIRECT_HELLO 0x00000001
-#define CMD_STR_DIRECT_HELLO "direct_hello"
-
-/**
- * @internal
- * @brief Provider to Master (Shared FD)
- */
-#define CMD_DIRECT_CONNECTED 0x00000101
-#define CMD_STR_DIRECT_CONNECTED "direct_connected"
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* End of a file */
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __WIDGET_SCRIPT_H
-#define __WIDGET_SCRIPT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/**
- * @file widget_buffer.h
- * @brief This file describe the buffer ADT and event definitions
- */
-
-/**
- * @addtogroup CAPI_WIDGET_SERVICE_MODULE
- * @{
- */
-
-/**
- * @internal
- * @brief Enumeration for script event of widget.
- * @details
- * This enumeration values will be used for script plugin of data-provider-master.
- * Master will send down these accessibility events to the script plugin.
- * @since_tizen 2.3.1
- */
-typedef enum widget_script_event {
- WIDGET_SCRIPT_ACCESS_EVENT = 0x01000000, /**< Mask value */
- WIDGET_SCRIPT_MOUSE_EVENT = 0x02000000, /**< Mask value */
- WIDGET_SCRIPT_KEY_EVENT = 0x04000000, /**< Mask value */
-
- WIDGET_SCRIPT_ACCESS_HIGHLIGHT = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000001, /**< Highlight */
- WIDGET_SCRIPT_ACCESS_HIGHLIGHT_NEXT = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000002, /**< Move Highlight focus to the next object */
- WIDGET_SCRIPT_ACCESS_HIGHLIGHT_PREV = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000004, /**< Move Highlight focus to the prev object */
- WIDGET_SCRIPT_ACCESS_ACTIVATE = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000008, /**< Activate the highlighted object */
- WIDGET_SCRIPT_ACCESS_ACTION = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000010, /**< Do specified action for the highlighted object */
- WIDGET_SCRIPT_ACCESS_SCROLL = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000020, /**< Scroll operation */
- WIDGET_SCRIPT_ACCESS_UNHIGHLIGHT = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000040, /**< Remove highlight */
- WIDGET_SCRIPT_ACCESS_VALUE_CHANGE = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000080, /* TODO: deprecate this */
- WIDGET_SCRIPT_ACCESS_MOUSE = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000100, /* give mouse event to highlight object */
- WIDGET_SCRIPT_ACCESS_BACK = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000200, /* go back to a previous view ex: pop naviframe item */
- WIDGET_SCRIPT_ACCESS_OVER = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000400, /* mouse over an object */
- WIDGET_SCRIPT_ACCESS_READ = WIDGET_SCRIPT_ACCESS_EVENT | 0x00000800, /* highlight an object */
- WIDGET_SCRIPT_ACCESS_ENABLE = WIDGET_SCRIPT_ACCESS_EVENT | 0x00001000, /* enable highlight and read ability */
- WIDGET_SCRIPT_ACCESS_DISABLE = WIDGET_SCRIPT_ACCESS_EVENT | 0x00002000, /* disable highlight and read ability */
-
- WIDGET_SCRIPT_MOUSE_DOWN = WIDGET_SCRIPT_MOUSE_EVENT | 0x00001000, /**< Mouse down */
- WIDGET_SCRIPT_MOUSE_MOVE = WIDGET_SCRIPT_MOUSE_EVENT | 0x00002000, /**< Mouse move */
- WIDGET_SCRIPT_MOUSE_UP = WIDGET_SCRIPT_MOUSE_EVENT | 0x00004000, /**< Mouse up */
- WIDGET_SCRIPT_MOUSE_IN = WIDGET_SCRIPT_MOUSE_EVENT | 0x00008000, /**< Mouse in */
- WIDGET_SCRIPT_MOUSE_OUT = WIDGET_SCRIPT_MOUSE_EVENT | 0x00010000, /**< Mouse out */
-
- WIDGET_SCRIPT_MOUSE_ON_SCROLL = WIDGET_SCRIPT_MOUSE_EVENT | 0x00020000, /**< If the box in in scroller and it is scrolled */
- WIDGET_SCRIPT_MOUSE_OFF_SCROLL = WIDGET_SCRIPT_MOUSE_EVENT | 0x00040000, /**< If the box is in scroller but the scroll is stopped */
- WIDGET_SCRIPT_MOUSE_ON_HOLD = WIDGET_SCRIPT_MOUSE_EVENT | 0x00080000, /**< Even though the box gets mouse_up event, the click event will not be generated */
- WIDGET_SCRIPT_MOUSE_OFF_HOLD = WIDGET_SCRIPT_MOUSE_EVENT | 0x00100000, /**< Generate the click event if the mouse_up event occurred as normal */
-
- WIDGET_SCRIPT_KEY_DOWN = WIDGET_SCRIPT_KEY_EVENT | 0x00020000, /**< Key pressed */
- WIDGET_SCRIPT_KEY_UP = WIDGET_SCRIPT_KEY_EVENT | 0x00040000, /**< Key released */
- WIDGET_SCRIPT_KEY_FOCUS_IN = WIDGET_SCRIPT_KEY_EVENT | 0x00080000, /**< Key focus in */
- WIDGET_SCRIPT_KEY_FOCUS_OUT = WIDGET_SCRIPT_KEY_EVENT | 0x00100000, /**< Key focus out */
-} widget_script_event_e;
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* End of a file */
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __WIDGET_SERVICE_UTIL_H
-#define __WIDGET_SERVICE_UTIL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern char *widget_util_replace_string(const char *src, const char *pattern, const char *replace);
-extern const char *widget_util_uri_to_path(const char *uri);
-extern int widget_util_get_drm_fd(void *dpy, int *fd);
-extern int widget_util_release_drm_fd(int fd);
-extern const char *widget_util_basename(const char *name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
-/* End of a file */
License: Flora-1.1, MIT
Source0: %{name}-%{version}.tar.gz
Source1001: %{name}.manifest
-Source2001: wayland-drm.xml
BuildRequires: cmake, gettext-tools, coreutils
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gio-2.0)
-BuildRequires: pkgconfig(com-core)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(db-util)
BuildRequires: pkgconfig(pkgmgr)
BuildRequires: pkgconfig(icu-uc)
BuildRequires: pkgconfig(bundle)
BuildRequires: pkgconfig(capi-base-common)
-BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(capi-system-info)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(libxml-2.0)
-%if %{with wayland}
-BuildRequires: pkgconfig(wayland-client)
-%else
-BuildRequires: pkgconfig(x11)
-BuildRequires: pkgconfig(libdri2)
-BuildRequires: pkgconfig(dri2proto)
-%endif
-
%if "%{model_build_feature_widget}" == "0"
ExclusiveArch:
%endif
%prep
%setup -q
cp %{SOURCE1001} .
-%if %{with wayland}
-mkdir -p wayland-drm/include
-mkdir -p wayland-drm/src
-wayland-scanner client-header < %{SOURCE2001} > wayland-drm/include/widget_wayland-drm-client-protocol.h
-wayland-scanner server-header < %{SOURCE2001} > wayland-drm/include/widget_wayland-drm-server-protocol.h
-wayland-scanner code < %{SOURCE2001} > wayland-drm/src/wayland-drm.c
-%endif
%build
-%if 0%{?sec_build_binary_debug_enable}
-export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
-export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
-%endif
-
-%if 0%{?tizen_build_binary_release_type_eng}
-export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE"
-export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
-export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE"
-%endif
-
-%if %{with wayland}
-export WAYLAND_SUPPORT=On
-export X11_SUPPORT=Off
-%else
-export WAYLAND_SUPPORT=Off
-export X11_SUPPORT=On
-%endif
sqlite3 .widget.db < ./parser/widget.sql
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DWAYLAND_SUPPORT=${WAYLAND_SUPPORT} -DX11_SUPPORT=${X11_SUPPORT} \
- -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
make %{?jobs:-j%jobs}
%install
%{_includedir}/widget_service/widget_service.h
%{_includedir}/widget_service/widget_service_internal.h
%{_includedir}/widget_service/widget_errno.h
-%{_includedir}/widget_service/widget_cmd_list.h
-%{_includedir}/widget_service/widget_buffer.h
-%{_includedir}/widget_service/widget_script.h
%{_includedir}/widget_service/widget_conf.h
-%{_includedir}/widget_service/widget_abi.h
-%{_includedir}/widget_service/widget_util.h
-%if %{with wayland}
-%{_includedir}/widget_service/widget_wayland-drm-client-protocol.h
-%{_includedir}/widget_service/widget_wayland-drm-server-protocol.h
-%endif
%{_libdir}/pkgconfig/widget_service.pc
# End of a file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<protocol name="drm">
-
- <copyright>
- Copyright © 2008-2011 Kristian Høgsberg
- Copyright © 2010-2011 Intel Corporation
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that\n the above copyright notice appear in
- all copies and that both that copyright notice and this permission
- notice appear in supporting documentation, and that the name of
- the copyright holders not be used in advertising or publicity
- pertaining to distribution of the software without specific,
- written prior permission. The copyright holders make no
- representations about the suitability of this software for any
- purpose. It is provided "as is" without express or implied
- warranty.
-
- THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
- SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
- SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
- AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
- THIS SOFTWARE.
- </copyright>
-
- <!-- drm support. This object is created by the server and published
- using the display's global event. -->
- <interface name="wl_drm" version="2">
- <enum name="error">
- <entry name="authenticate_fail" value="0"/>
- <entry name="invalid_format" value="1"/>
- <entry name="invalid_name" value="2"/>
- </enum>
-
- <enum name="format">
- <!-- The drm format codes match the #defines in drm_fourcc.h.
- The formats actually supported by the compositor will be
- reported by the format event. -->
- <entry name="c8" value="0x20203843"/>
- <entry name="rgb332" value="0x38424752"/>
- <entry name="bgr233" value="0x38524742"/>
- <entry name="xrgb4444" value="0x32315258"/>
- <entry name="xbgr4444" value="0x32314258"/>
- <entry name="rgbx4444" value="0x32315852"/>
- <entry name="bgrx4444" value="0x32315842"/>
- <entry name="argb4444" value="0x32315241"/>
- <entry name="abgr4444" value="0x32314241"/>
- <entry name="rgba4444" value="0x32314152"/>
- <entry name="bgra4444" value="0x32314142"/>
- <entry name="xrgb1555" value="0x35315258"/>
- <entry name="xbgr1555" value="0x35314258"/>
- <entry name="rgbx5551" value="0x35315852"/>
- <entry name="bgrx5551" value="0x35315842"/>
- <entry name="argb1555" value="0x35315241"/>
- <entry name="abgr1555" value="0x35314241"/>
- <entry name="rgba5551" value="0x35314152"/>
- <entry name="bgra5551" value="0x35314142"/>
- <entry name="rgb565" value="0x36314752"/>
- <entry name="bgr565" value="0x36314742"/>
- <entry name="rgb888" value="0x34324752"/>
- <entry name="bgr888" value="0x34324742"/>
- <entry name="xrgb8888" value="0x34325258"/>
- <entry name="xbgr8888" value="0x34324258"/>
- <entry name="rgbx8888" value="0x34325852"/>
- <entry name="bgrx8888" value="0x34325842"/>
- <entry name="argb8888" value="0x34325241"/>
- <entry name="abgr8888" value="0x34324241"/>
- <entry name="rgba8888" value="0x34324152"/>
- <entry name="bgra8888" value="0x34324142"/>
- <entry name="xrgb2101010" value="0x30335258"/>
- <entry name="xbgr2101010" value="0x30334258"/>
- <entry name="rgbx1010102" value="0x30335852"/>
- <entry name="bgrx1010102" value="0x30335842"/>
- <entry name="argb2101010" value="0x30335241"/>
- <entry name="abgr2101010" value="0x30334241"/>
- <entry name="rgba1010102" value="0x30334152"/>
- <entry name="bgra1010102" value="0x30334142"/>
- <entry name="yuyv" value="0x56595559"/>
- <entry name="yvyu" value="0x55595659"/>
- <entry name="uyvy" value="0x59565955"/>
- <entry name="vyuy" value="0x59555956"/>
- <entry name="ayuv" value="0x56555941"/>
- <entry name="nv12" value="0x3231564e"/>
- <entry name="nv21" value="0x3132564e"/>
- <entry name="nv16" value="0x3631564e"/>
- <entry name="nv61" value="0x3136564e"/>
- <entry name="yuv410" value="0x39565559"/>
- <entry name="yvu410" value="0x39555659"/>
- <entry name="yuv411" value="0x31315559"/>
- <entry name="yvu411" value="0x31315659"/>
- <entry name="yuv420" value="0x32315559"/>
- <entry name="yvu420" value="0x32315659"/>
- <entry name="yuv422" value="0x36315559"/>
- <entry name="yvu422" value="0x36315659"/>
- <entry name="yuv444" value="0x34325559"/>
- <entry name="yvu444" value="0x34325659"/>
- </enum>
-
- <!-- Call this request with the magic received from drmGetMagic().
- It will be passed on to the drmAuthMagic() or
- DRIAuthConnection() call. This authentication must be
- completed before create_buffer could be used. -->
- <request name="authenticate">
- <arg name="id" type="uint"/>
- </request>
-
- <!-- Create a wayland buffer for the named DRM buffer. The DRM
- surface must have a name using the flink ioctl -->
- <request name="create_buffer">
- <arg name="id" type="new_id" interface="wl_buffer"/>
- <arg name="name" type="uint"/>
- <arg name="width" type="int"/>
- <arg name="height" type="int"/>
- <arg name="stride" type="uint"/>
- <arg name="format" type="uint"/>
- </request>
-
- <!-- Create a wayland buffer for the named DRM buffer. The DRM
- surface must have a name using the flink ioctl -->
- <request name="create_planar_buffer">
- <arg name="id" type="new_id" interface="wl_buffer"/>
- <arg name="name" type="uint"/>
- <arg name="width" type="int"/>
- <arg name="height" type="int"/>
- <arg name="format" type="uint"/>
- <arg name="offset0" type="int"/>
- <arg name="stride0" type="int"/>
- <arg name="offset1" type="int"/>
- <arg name="stride1" type="int"/>
- <arg name="offset2" type="int"/>
- <arg name="stride2" type="int"/>
- </request>
-
- <!-- Create a wayland buffer for the prime fd. Use for regular and planar
- buffers. Pass 0 for offset and stride for unused planes. -->
- <request name="create_prime_buffer" since="2">
- <arg name="id" type="new_id" interface="wl_buffer"/>
- <arg name="name" type="fd"/>
- <arg name="width" type="int"/>
- <arg name="height" type="int"/>
- <arg name="format" type="uint"/>
- <arg name="offset0" type="int"/>
- <arg name="stride0" type="int"/>
- <arg name="offset1" type="int"/>
- <arg name="stride1" type="int"/>
- <arg name="offset2" type="int"/>
- <arg name="stride2" type="int"/>
- </request>
-
- <!-- Notification of the path of the drm device which is used by
- the server. The client should use this device for creating
- local buffers. Only buffers created from this device should
- be be passed to the server using this drm object's
- create_buffer request. -->
- <event name="device">
- <arg name="name" type="string"/>
- </event>
-
- <event name="format">
- <arg name="format" type="uint"/>
- </event>
-
- <!-- Raised if the authenticate request succeeded -->
- <event name="authenticated"/>
-
- <enum name="capability" since="2">
- <description summary="wl_drm capability bitmask">
- Bitmask of capabilities.
- </description>
- <entry name="prime" value="1" summary="wl_drm prime available"/>
- </enum>
-
- <event name="capabilities">
- <arg name="value" type="uint"/>
- </event>
- </interface>
-
-</protocol>
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#include "dlist.h"
-
-/*!
- * \brief
- * This dlist is called Modified Doubly Linked List.
- *
- * Noramlly, The dobule linked list contains address of previous and next element.
- * This dlist also contains them, but the tail element only contains prev address.
- *
- * The head element's prev pointer indicates the last element.
- * But the last element's next pointer indicates NIL.
- *
- * So we can find the last element while crawling this DList
- * But we have to remember the address of the head element.
- */
-
-struct dlist {
- struct dlist *next;
- struct dlist *prev;
- void *data;
-};
-
-struct dlist *dlist_append(struct dlist *list, void *data)
-{
- struct dlist *item;
-
- item = malloc(sizeof(*item));
- if (!item) {
- return NULL;
- }
-
- item->next = NULL;
- item->data = data;
-
- if (!list) {
- item->prev = item;
-
- list = item;
- } else {
- item->prev = list->prev;
- item->prev->next = item;
- list->prev = item;
- }
-
- assert(!list->prev->next && "item NEXT");
-
- return list;
-}
-
-struct dlist *dlist_prepend(struct dlist *list, void *data)
-{
- struct dlist *item;
-
- item = malloc(sizeof(*item));
- if (!item) {
- return NULL;
- }
-
- item->data = data;
-
- if (!list) {
- item->prev = item;
- item->next = NULL;
- } else {
- if (list->prev->next) {
- list->prev->next = item;
- }
-
- item->prev = list->prev;
- item->next = list;
-
- list->prev = item;
-
- }
-
- return item;
-}
-
-struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
-{
- if (!list || !l) {
- return NULL;
- }
-
- if (l == list) {
- list = l->next;
- } else {
- l->prev->next = l->next;
- }
-
- if (l->next) {
- l->next->prev = l->prev;
- }
- /*!
- * \note
- * If the removed entry 'l' has no next element, it is the last element.
- * In this case, check the existence of the list first,
- * and if the list is not empty, update the 'prev' of the list (which is a head element of the list)
- *
- * If we didn't care about this, the head element(list) can indicates the invalid element.
- */
- else if (list) {
- list->prev = l->prev;
- }
-
- free(l);
- return list;
-}
-
-struct dlist *dlist_find_data(struct dlist *list, void *data)
-{
- struct dlist *l;
- void *_data;
-
- dlist_foreach(list, l, _data) {
- if (data == _data) {
- return l;
- }
- }
-
- return NULL;
-}
-
-void *dlist_data(struct dlist *l)
-{
- return l ? l->data : NULL;
-}
-
-struct dlist *dlist_next(struct dlist *l)
-{
- return l ? l->next : NULL;
-}
-
-struct dlist *dlist_prev(struct dlist *l)
-{
- return l ? l->prev : NULL;
-}
-
-int dlist_count(struct dlist *l)
-{
- register int i;
- struct dlist *n;
- void *data;
-
- i = 0;
- dlist_foreach(l, n, data) {
- i++;
- }
-
- return i;
-}
-
-struct dlist *dlist_nth(struct dlist *l, int nth)
-{
- register int i;
- struct dlist *n;
-
- i = 0;
- for (n = l; n; n = n->next) {
- if (i == nth) {
- return n;
- }
- i++;
- }
-
- return NULL;
-}
-
-/* End of a file */
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <sys/time.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/statvfs.h>
-#include <time.h>
-
-#include <sqlite3.h>
-#include <unicode/uloc.h>
-
-#include <dlog.h>
-#include <system_info.h>
-
-#include "debug.h"
-#include "widget_errno.h"
-#include "util.h"
-#include "debug.h"
-
-int errno;
-#if defined(_USE_ECORE_TIME_GET)
-static struct info {
- clockid_t type;
-} s_info = {
- .type = CLOCK_MONOTONIC,
-};
-#endif
-
-double util_timestamp(void)
-{
-#if defined(_USE_ECORE_TIME_GET)
- struct timespec ts;
-
- do {
- if (clock_gettime(s_info.type, &ts) == 0) {
- return ts.tv_sec + ts.tv_nsec / 1000000000.0f;
- }
-
- ErrPrint("%d: %s\n", s_info.type, errno);
- if (s_info.type == CLOCK_MONOTONIC) {
- s_info.type = CLOCK_REALTIME;
- } else if (s_info.type == CLOCK_REALTIME) {
- struct timeval tv;
- if (gettimeofday(&tv, NULL) < 0) {
- ErrPrint("gettimeofday: %d\n", errno);
- break;
- }
-
- return tv.tv_sec + tv.tv_usec / 1000000.0f;
- }
- } while (1);
-
- return 0.0f;
-#else
- struct timeval tv;
-
- if (gettimeofday(&tv, NULL) < 0) {
- ErrPrint("gettimeofday: %d\n", errno);
- tv.tv_sec = 0;
- tv.tv_usec = 0;
- }
-
- return tv.tv_sec + tv.tv_usec / 1000000.0f;
-#endif
-}
-
-EAPI const char *widget_util_basename(const char *name)
-{
- int length;
- length = name ? strlen(name) : 0;
- if (!length) {
- return ".";
- }
-
- while (--length > 0 && name[length] != '/');
-
- return length <= 0 ? name : (name + length + (name[length] == '/'));
-}
-
-unsigned long util_free_space(const char *path)
-{
- struct statvfs st;
- unsigned long space;
-
- if (statvfs(path, &st) < 0) {
- ErrPrint("statvfs: %d\n", errno);
- return 0lu;
- }
-
- space = st.f_bsize * st.f_bfree;
- /*!
- * \note
- * Must have to check the overflow
- */
- return space;
-}
-
-EAPI char *widget_util_replace_string(const char *src, const char *pattern, const char *replace)
-{
- int s_idx;
- int p_idx;
- int n_idx;
- int t_idx;
- int r_idx;
- int idx;
- char *result;
- int len;
- int rlen;
- int matched;
-
- if (!is_widget_feature_enabled()) {
- return NULL;
- }
-
- if (!src || !pattern || !replace || !src[0] || !pattern[0]) {
- ErrPrint("Invalid argument: %s %s %s\n", src, pattern, replace);
- return NULL;
- }
-
- rlen = strlen(replace);
- len = strlen(src);
- result = malloc(len + 1);
- if (!result) {
- ErrPrint("Heap:%d\n", errno);
- return NULL;
- }
-
- r_idx = 0;
- idx = 0;
- matched = 0;
- for (s_idx = 0; src[s_idx]; s_idx++) {
- if (idx == len) {
- char *tmp;
-
- len += (rlen > len ? rlen : len);
- tmp = realloc(result, len + 1);
- if (!tmp) {
- ErrPrint("Heap: %d\n", errno);
- free(result);
- return NULL;
- }
- result = tmp;
- }
-
- if (src[s_idx] == pattern[0]) {
- n_idx = -1;
- t_idx = s_idx;
- r_idx = idx;
-
- if (r_idx == len) {
- char *tmp;
- len += (rlen > len ? rlen : len);
- tmp = realloc(result, len + 1);
- if (!tmp) {
- ErrPrint("Heap: %d\n", errno);
- free(result);
- return NULL;
- }
- result = tmp;
- }
- result[r_idx++] = src[t_idx++];
- p_idx = 1;
- while (pattern[p_idx]) {
- if (src[t_idx] == pattern[p_idx]) {
- if (n_idx < 0) {
- if (src[t_idx] == pattern[0]) {
- n_idx = t_idx;
- } else {
- if (r_idx == len) {
- char *tmp;
- len += (rlen > len ? rlen : len);
- tmp = realloc(result, len + 1);
- if (!tmp) {
- ErrPrint("Heap: %d\n", errno);
- free(result);
- return NULL;
- }
- result = tmp;
- }
- result[r_idx++] = src[t_idx];
- }
- }
-
- p_idx++;
- t_idx++;
- continue;
- }
-
-#if 0 /* Not used value? */
- if (n_idx < 0) {
- s_idx = t_idx;
- } else {
- s_idx = n_idx;
- }
-#endif
-
- break;
- }
-
- if (pattern[p_idx] == '\0') {
- if (idx + rlen >= len) {
- char *tmp;
- len += (rlen > len ? rlen : len);
- tmp = realloc(result, len + 1);
- if (!tmp) {
- ErrPrint("Heap: %d\n", errno);
- free(result);
- return NULL;
- }
- result = tmp;
- }
- matched++;
- strncpy(result + idx, replace, len + 1);
- idx += strlen(replace);
- s_idx = t_idx - 1;
- } else {
- idx = r_idx;
- s_idx = (n_idx < 0 ? t_idx : n_idx) - 1;
- }
- } else {
- result[idx++] = src[s_idx];
- }
- }
-
- result[idx] = '\0';
-
- if (!matched) {
- free(result);
- result = NULL;
- }
-
- return result;
-}
-
-EAPI const char *widget_util_uri_to_path(const char *uri)
-{
- int len;
-
- if (!is_widget_feature_enabled()) {
- return NULL;
- }
-
- if (!uri) {
- return NULL;
- }
-
- len = strlen(SCHEMA_FILE);
- if (strncasecmp(uri, SCHEMA_FILE, len)) {
- return NULL;
- }
-
- return uri + len;
-}
-
-char *util_id_to_uri(const char *id)
-{
- char *uri;
-
- if (!id) {
- uri = strdup("");
- if (!uri) {
- ErrPrint("Heap: %d\n", errno);
- return NULL;
- }
- } else if (strncmp(id, SCHEMA_FILE, strlen(SCHEMA_FILE))) {
- int len;
- len = strlen(SCHEMA_FILE) + strlen(id) + 2;
- uri = malloc(len);
- if (!uri) {
- ErrPrint("Heap: %d\n", errno);
- return NULL;
- }
-
- snprintf(uri, len, SCHEMA_FILE"%s", id);
- } else {
- uri = strdup(id);
- if (!uri) {
- ErrPrint("Heap: %d\n", errno);
- return NULL;
- }
- }
-
- return uri;
-}
-
-/* End of a file */
+++ /dev/null
-#include <stdio.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h> /* access */
-#include <stdlib.h> /* free */
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <dlog.h>
-
-#include <sqlite3.h>
-#include <unicode/uloc.h>
-#include <system_info.h>
-
-#include <wayland-client.h>
-#include <xf86drm.h>
-#include <xf86drmMode.h>
-
-#include "debug.h"
-#include "widget_errno.h"
-#include "util.h"
-#include "widget_service.h"
-#include "widget_service_internal.h"
-#include "widget_wayland-drm-client-protocol.h"
-#include "widget_wayland-drm-server-protocol.h"
-
-#define CONF_PATH_FORMAT "/usr/share/data-provider-master/%dx%d/resolution.ini"
-
-int errno;
-
-static struct {
- unsigned int w;
- unsigned int h;
- int res_resolved;
-} s_info = {
- .w = 0,
- .h = 0,
- .res_resolved = 0,
-};
-
-static int update_info(struct supported_size_list *SIZE_LIST, int width_type, int height_type, int width, int height)
-{
- int idx;
-
- if (width_type == 1 && height_type == 1) {
- idx = 0;
- } else if (width_type == 2 && height_type == 1) {
- idx = 1;
- } else if (width_type == 2 && height_type == 2) {
- idx = 2;
- } else if (width_type == 4 && height_type == 1) {
- idx = 3;
- } else if (width_type == 4 && height_type == 2) {
- idx = 4;
- } else if (width_type == 4 && height_type == 3) {
- idx = 5;
- } else if (width_type == 4 && height_type == 4) {
- idx = 6;
- } else if (width_type == 4 && height_type == 5) {
- idx = 7;
- } else if (width_type == 4 && height_type == 6) {
- idx = 8;
- } else if (width_type == 21 && height_type == 21) {
- idx = 9;
- } else if (width_type == 23 && height_type == 21) {
- idx = 10;
- } else if (width_type == 23 && height_type == 23) {
- idx = 11;
- } else if (width_type == 0 && height_type == 0) {
- idx = 12;
- } else {
- ErrPrint("Unknown size type: %dx%d (%dx%d)\n", width_type, height_type, width, height);
- return 0;
- }
-
- SIZE_LIST[idx].w = width;
- SIZE_LIST[idx].h = height;
- return 1;
-}
-
-static inline int update_from_file(struct service_info *info, struct supported_size_list *SIZE_LIST)
-{
- FILE *fp;
- int updated;
- int width_type;
- int height_type;
- int width;
- int height;
- char buffer[MAX_COLUMN];
- int ch;
- int idx;
- enum status {
- START = 0x0,
- TYPE = 0x01,
- SIZE = 0x02,
- COMMENT = 0x03,
- ERROR = 0x04,
- EOL = 0x05,
- TYPE_END = 0x06,
- SIZE_START = 0x07
- } status;
-
- fp = fopen(info->conf_file, "r");
- if (!fp) {
- ErrPrint("Open failed: %d\n", errno);
- return WIDGET_ERROR_IO_ERROR;
- }
-
- updated = 0;
- status = START;
- idx = 0;
- do {
- ch = fgetc(fp);
-
- if (idx == MAX_COLUMN) {
- ErrPrint("Buffer overflow. Too long line. LINE MUST BE SHOT THAN %d\n", MAX_COLUMN);
- status = ERROR;
- }
-
- switch (status) {
- case START:
- if (isspace(ch) || ch == EOF) {
- continue;
- }
-
- info->base_parse = 0;
-
- if (ch == '#') {
- status = COMMENT;
- } else {
- status = TYPE;
- idx = 0;
- ungetc(ch, fp);
- }
- break;
- case TYPE:
- if (isblank(ch)) {
- buffer[idx] = '\0';
- status = TYPE_END;
- if (sscanf(buffer, "%dx%d", &width_type, &height_type) != 2) {
- if (!strcasecmp(buffer, "base")) {
- info->base_parse = 1;
- } else {
- ErrPrint("Invalid syntax: [%s]\n", buffer);
- status = ERROR;
- }
- }
- break;
- } else if (ch == '=') {
- buffer[idx] = '\0';
- status = SIZE_START;
- if (sscanf(buffer, "%dx%d", &width_type, &height_type) != 2) {
- if (!strcasecmp(buffer, "base")) {
- info->base_parse = 1;
- } else {
- ErrPrint("Invalid syntax: [%s]\n", buffer);
- status = ERROR;
- }
- }
- break;
- } else if (ch == EOF) {
- ErrPrint("Invalid Syntax\n");
- status = ERROR;
- continue;
- }
- buffer[idx++] = ch;
- break;
- case TYPE_END:
- if (ch == '=') {
- status = SIZE_START;
- }
- break;
- case SIZE_START:
- if (isspace(ch) || ch == EOF) {
- continue;
- }
-
- status = SIZE;
- idx = 0;
- ungetc(ch, fp);
- break;
- case SIZE:
- if (isspace(ch) || ch == EOF) {
- buffer[idx] = '\0';
- status = EOL;
-
- if (sscanf(buffer, "%dx%d", &width, &height) != 2) {
- ErrPrint("Invalid syntax: [%s]\n", buffer);
- status = ERROR;
- } else if (ch == EOF) {
- if (info->base_parse) {
- info->base_w = width;
- info->base_h = height;
- } else {
- updated += update_info(SIZE_LIST, width_type, height_type, width, height);
- }
- }
- break;
- }
- buffer[idx++] = ch;
- break;
- case EOL:
- if (!info->base_parse) {
- updated += update_info(SIZE_LIST, width_type, height_type, width, height);
- } else {
- info->base_w = width;
- info->base_h = height;
- }
- status = START;
- ungetc(ch, fp);
- break;
- case ERROR:
- if (ch == '\n' || ch == '\r' || ch == '\f') {
- status = START;
- }
- break;
- case COMMENT:
- if (ch == '\n' || ch == '\r' || ch == '\f') {
- status = START;
- }
- break;
- default:
- ErrPrint("Unknown status. couldn't be reach to here\n");
- break;
- }
- } while (!feof(fp));
-
- if (fclose(fp) != 0) {
- ErrPrint("fclose: %d\n", errno);
- }
-
- return WIDGET_NR_OF_SIZE_LIST - updated;
-}
-
-/*
- * Find proper configuration and install(link) it to conf path.
- */
-static char *conf_path(void)
-{
- char *path;
- int length;
-
- length = strlen(CONF_PATH_FORMAT) + 12; /* 12 == RESERVED SPACE */
- path = calloc(1, length);
- if (!path) {
- ErrPrint("calloc: %d\n", errno);
- return NULL;
- }
-
- if (s_info.w == 0 || s_info.h == 0) {
- /* Try to update resolution first if it is not initialized */
- util_screen_size_get(NULL, NULL);
- }
-
- snprintf(path, length, CONF_PATH_FORMAT, s_info.w, s_info.h);
- DbgPrint("Selected conf file: %s\n", path);
- if (access(path, F_OK) != 0) {
- ErrPrint("Fallback to default, access: %d\n", errno);
- strncpy(path, RESOLUTION_FILE, length);
- if (access(path, F_OK) != 0) {
- ErrPrint("Serious error - there is no conf file, use default setting: %d\n", errno);
- free(path);
- path = NULL;
- }
- }
-
- return path;
-}
-
-int util_screen_size_get(unsigned int *width, unsigned int *height)
-{
- return WIDGET_ERROR_NONE;
-}
-
-int util_update_resolution(struct service_info *info, struct supported_size_list *SIZE_LIST)
-{
- if (s_info.res_resolved) {
- return WIDGET_ERROR_NONE;
- }
-
- if (!info->conf_file) {
- info->conf_file = conf_path();
- }
-
- if (info->conf_file) {
- register int i;
- unsigned int width = 0;
- unsigned int height = 0;
-
- i = util_screen_size_get(&width, &height);
- if (i != WIDGET_ERROR_NONE) {
- return i;
- }
-
- if (update_from_file(info, SIZE_LIST) == 0) {
- DbgPrint("Resolution info is all updated by file\n");
- }
-
- if (width != info->base_w) {
- for (i = 0; i < WIDGET_NR_OF_SIZE_LIST; i++) {
- SIZE_LIST[i].w = (unsigned int)((double)SIZE_LIST[i].w * (double)width / (double)info->base_w);
- SIZE_LIST[i].h = (unsigned int)((double)SIZE_LIST[i].h * (double)width / (double)info->base_w);
- }
- }
- } else {
- DbgPrint("Conf file is not loaded\n");
- }
-
- s_info.res_resolved = 1;
- return WIDGET_ERROR_NONE;
-}
-
-struct wl_drm_info {
- struct wl_event_queue *wl_queue;
- struct wl_drm *wl_drm;
- int authenticated;
- int fd;
- int inf_checked;
-};
-
-static void wl_client_drm_handle_device(void *data, struct wl_drm *drm, const char *device)
-{
- struct wl_drm_info *drm_info = (struct wl_drm_info *)data;
- drm_magic_t magic;
-
- DbgPrint("device[%s]\n", device);
- drm_info->fd = open(device, O_RDWR | O_CLOEXEC);
- if (drm_info->fd < 0) {
- ErrPrint("Failed to open a device: %d (%s)\n", errno, device);
- return;
- }
-
- drmGetMagic(drm_info->fd, &magic);
- DbgPrint("magic[%x]\n", magic);
- wl_drm_authenticate(drm_info->wl_drm, magic);
-}
-
-static void wl_client_drm_handle_format(void *data, struct wl_drm *drm, uint32_t format)
-{
- /* Do nothing */
- DbgPrint("");
-}
-
-static void wl_client_drm_handle_authenticated(void *data, struct wl_drm *drm)
-{
- struct wl_drm_info *drm_info = (struct wl_drm_info *)data;
- drm_info->authenticated = 1;
- DbgPrint("");
-}
-
-static void wl_client_drm_handle_capabilities(void *data, struct wl_drm *drm, uint32_t value)
-{
- /* Do nothing */
- DbgPrint("");
-}
-
-static void wl_client_registry_handle_global(void *data, struct wl_registry *registry, uint32_t name, const char *interface, uint32_t version)
-{
- struct wl_drm_info *info = (struct wl_drm_info *)data;
- static const struct wl_drm_listener wl_drm_client_listener = {
- wl_client_drm_handle_device,
- wl_client_drm_handle_format,
- wl_client_drm_handle_authenticated,
- wl_client_drm_handle_capabilities
- };
-
- DbgPrint("interface[%s]\n", interface);
- if (!strcmp(interface, "wl_drm")) {
- info->wl_drm = wl_registry_bind(registry, name, &wl_drm_interface, (version > 2) ? 2 : version);
- wl_proxy_set_queue((struct wl_proxy *)info->wl_drm, info->wl_queue);
- wl_drm_add_listener(info->wl_drm, &wl_drm_client_listener, data);
- }
-
- info->inf_checked++;
-}
-
-EAPI int widget_util_get_drm_fd(void *dpy, int *fd)
-{
- struct wl_display *disp = NULL;
- struct wl_event_queue *wl_queue;
- struct wl_registry *wl_registry;
- int ret = 0;
- struct wl_drm_info info = {
- .wl_drm = NULL,
- .authenticated = 0,
- .fd = -1,
- };
- static const struct wl_registry_listener registry_listener = {
- wl_client_registry_handle_global,
- NULL
- };
-
- if (!fd) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (!dpy) {
- disp = wl_display_connect(NULL);
- if (!disp) {
- ErrPrint("Failed to create a new display connection\n");
- return WIDGET_ERROR_FAULT;
- }
- dpy = disp;
- }
-
- wl_queue = wl_display_create_queue(dpy);
- if (!wl_queue) {
- ErrPrint("Failed to create a WL Queue\n");
- if (disp == dpy) {
- wl_display_disconnect(disp);
- }
- return WIDGET_ERROR_FAULT;
- }
-
- wl_registry = wl_display_get_registry(dpy);
- if (!wl_registry) {
- ErrPrint("Failed to get registry\n");
- wl_event_queue_destroy(wl_queue);
- if (disp == dpy) {
- wl_display_disconnect(disp);
- }
- return WIDGET_ERROR_FAULT;
- }
-
- wl_proxy_set_queue((struct wl_proxy *)wl_registry, wl_queue);
- wl_registry_add_listener(wl_registry, ®istry_listener, &info);
- info.wl_queue = wl_queue;
-
- info.inf_checked = 0;
- DbgPrint("Consuming Dispatch Queue begin\n");
- while (ret != -1 && !info.inf_checked) {
- ret = wl_display_dispatch_queue(dpy, wl_queue);
- DbgPrint("Dispatch Queue consumed: %d\n", ret);
- }
- DbgPrint("Consuming Dispatch Queue end\n");
-
- wl_event_queue_destroy(wl_queue);
- wl_registry_destroy(wl_registry);
-
- if (info.wl_drm) {
- wl_drm_destroy(info.wl_drm);
- }
-
- if (disp == dpy) {
- wl_display_disconnect(disp);
- }
-
- if (!info.inf_checked || !info.authenticated) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- *fd = info.fd;
- return *fd >= 0 ? WIDGET_ERROR_NONE : WIDGET_ERROR_FAULT;
-}
-
-EAPI int widget_util_release_drm_fd(int fd)
-{
- if (fd < 0) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (close(fd) < 0) {
- ErrPrint("close: %d\n", errno);
- return WIDGET_ERROR_FAULT;
- }
-
- return WIDGET_ERROR_NONE;
-}
-
-/* End of a file */
+++ /dev/null
-#include <stdio.h>
-#include <ctype.h>
-#include <errno.h>
-#include <unistd.h> /* access */
-#include <stdlib.h> /* free */
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <fcntl.h>
-
-#include <X11/X.h>
-#include <X11/Xlib.h>
-
-#include <dlog.h>
-
-#include <sqlite3.h>
-#include <unicode/uloc.h>
-#include <system_info.h>
-
-#include <X11/Xproto.h>
-#include <dri2.h>
-#include <xf86drm.h>
-#include <xf86drmMode.h>
-
-#include "debug.h"
-#include "widget_errno.h"
-#include "util.h"
-#include "widget_service.h"
-#include "widget_service_internal.h"
-
-#define CONF_PATH_FORMAT "/usr/share/data-provider-master/%dx%d/resolution.ini"
-
-int errno;
-
-static struct {
- unsigned int w;
- unsigned int h;
- int res_resolved;
-} s_info = {
- .w = 0,
- .h = 0,
- .res_resolved = 0,
-};
-
-static int update_info(struct supported_size_list *SIZE_LIST, int width_type, int height_type, int width, int height)
-{
- int idx;
-
- if (width_type == 1 && height_type == 1) {
- idx = 0;
- } else if (width_type == 2 && height_type == 1) {
- idx = 1;
- } else if (width_type == 2 && height_type == 2) {
- idx = 2;
- } else if (width_type == 4 && height_type == 1) {
- idx = 3;
- } else if (width_type == 4 && height_type == 2) {
- idx = 4;
- } else if (width_type == 4 && height_type == 3) {
- idx = 5;
- } else if (width_type == 4 && height_type == 4) {
- idx = 6;
- } else if (width_type == 4 && height_type == 5) {
- idx = 7;
- } else if (width_type == 4 && height_type == 6) {
- idx = 8;
- } else if (width_type == 21 && height_type == 21) {
- idx = 9;
- } else if (width_type == 23 && height_type == 21) {
- idx = 10;
- } else if (width_type == 23 && height_type == 23) {
- idx = 11;
- } else if (width_type == 0 && height_type == 0) {
- idx = 12;
- } else {
- ErrPrint("Unknown size type: %dx%d (%dx%d)\n", width_type, height_type, width, height);
- return 0;
- }
-
- SIZE_LIST[idx].w = width;
- SIZE_LIST[idx].h = height;
- return 1;
-}
-
-static inline int update_from_file(struct service_info *info, struct supported_size_list *SIZE_LIST)
-{
- FILE *fp;
- int updated;
- int width_type = 0;
- int height_type = 0;
- int width = 0;
- int height = 0;
- char buffer[MAX_COLUMN];
- int ch;
- int idx;
- enum status {
- START = 0x0,
- TYPE = 0x01,
- SIZE = 0x02,
- COMMENT = 0x03,
- ERROR = 0x04,
- EOL = 0x05,
- TYPE_END = 0x06,
- SIZE_START = 0x07
- } status;
-
- fp = fopen(info->conf_file, "r");
- if (!fp) {
- ErrPrint("Open failed: %d\n", errno);
- return WIDGET_ERROR_IO_ERROR;
- }
-
- updated = 0;
- status = START;
- idx = 0;
- do {
- ch = fgetc(fp);
-
- if (idx == MAX_COLUMN) {
- ErrPrint("Buffer overflow. Too long line. LINE MUST BE SHOT THAN %d\n", MAX_COLUMN);
- status = ERROR;
- }
-
- switch (status) {
- case START:
- if (isspace(ch) || ch == EOF) {
- continue;
- }
-
- info->base_parse = 0;
-
- if (ch == '#') {
- status = COMMENT;
- } else {
- status = TYPE;
- idx = 0;
- ungetc(ch, fp);
- }
- break;
- case TYPE:
- if (isblank(ch)) {
- buffer[idx] = '\0';
- status = TYPE_END;
- if (sscanf(buffer, "%dx%d", &width_type, &height_type) != 2) {
- if (!strcasecmp(buffer, "base")) {
- info->base_parse = 1;
- } else {
- ErrPrint("Invalid syntax: [%s]\n", buffer);
- status = ERROR;
- }
- }
- break;
- } else if (ch == '=') {
- buffer[idx] = '\0';
- status = SIZE_START;
- if (sscanf(buffer, "%dx%d", &width_type, &height_type) != 2) {
- if (!strcasecmp(buffer, "base")) {
- info->base_parse = 1;
- } else {
- ErrPrint("Invalid syntax: [%s]\n", buffer);
- status = ERROR;
- }
- }
- break;
- } else if (ch == EOF) {
- ErrPrint("Invalid Syntax\n");
- status = ERROR;
- continue;
- }
- buffer[idx++] = ch;
- break;
- case TYPE_END:
- if (ch == '=') {
- status = SIZE_START;
- }
- break;
- case SIZE_START:
- if (isspace(ch) || ch == EOF) {
- continue;
- }
-
- status = SIZE;
- idx = 0;
- ungetc(ch, fp);
- break;
- case SIZE:
- if (isspace(ch) || ch == EOF) {
- buffer[idx] = '\0';
- status = EOL;
-
- if (sscanf(buffer, "%dx%d", &width, &height) != 2) {
- if (!strncasecmp(buffer, "screen", strlen("screen"))) {
- width = s_info.w;
- height = s_info.h;
- DbgPrint("Select screen size: %dx%d\n", width, height);
- } else {
- ErrPrint("Invalid syntax: [%s]\n", buffer);
- status = ERROR;
- }
- }
-
- if (status != ERROR && ch == EOF) {
- if (info->base_parse) {
- info->base_w = width;
- info->base_h = height;
- } else {
- updated += update_info(SIZE_LIST, width_type, height_type, width, height);
- }
- }
- break;
- }
- buffer[idx++] = ch;
- break;
- case EOL:
- if (!info->base_parse) {
- updated += update_info(SIZE_LIST, width_type, height_type, width, height);
- } else {
- info->base_w = width;
- info->base_h = height;
- }
- status = START;
- ungetc(ch, fp);
- break;
- case ERROR:
- if (ch == '\n' || ch == '\r' || ch == '\f') {
- status = START;
- }
- break;
- case COMMENT:
- if (ch == '\n' || ch == '\r' || ch == '\f') {
- status = START;
- }
- break;
- default:
- ErrPrint("Unknown status. couldn't be reach to here\n");
- break;
- }
- } while (!feof(fp));
-
- if (fclose(fp) != 0) {
- ErrPrint("fclose: %d\n", errno);
- }
-
- return WIDGET_NR_OF_SIZE_LIST - updated;
-}
-
-/*
- * Find proper configuration and install(link) it to conf path.
- */
-static char *conf_path(void)
-{
- char *path;
- int length;
-
- length = strlen(CONF_PATH_FORMAT) + 12; /* 12 == RESERVED SPACE */
- path = calloc(1, length);
- if (!path) {
- ErrPrint("calloc: %d\n", errno);
- return NULL;
- }
-
- if (s_info.w == 0 || s_info.h == 0) {
- /* Try to update resolution first if it is not initialized */
- util_screen_size_get(NULL, NULL);
- }
-
- snprintf(path, length, CONF_PATH_FORMAT, s_info.w, s_info.h);
- DbgPrint("Selected conf file: %s\n", path);
- if (access(path, F_OK) != 0) {
- ErrPrint("Fallback to default, access: %d\n", errno);
- strncpy(path, RESOLUTION_FILE, length);
- if (access(path, F_OK) != 0) {
- ErrPrint("Serious error - there is no conf file, use default setting: %d\n", errno);
- free(path);
- path = NULL;
- }
- }
-
- return path;
-}
-
-int util_screen_size_get(unsigned int *width, unsigned int *height)
-{
- Display *disp;
- Window root;
- Window dummy;
- unsigned int border;
- unsigned int depth;
- int x;
- int y;
- int ret;
- unsigned int _width;
- unsigned int _height;
-
- if (!width) {
- width = &_width;
- }
-
- if (!height) {
- height = &_height;
- }
-
- if (s_info.w != 0 && s_info.h != 0) {
- DbgPrint("Already prepared (%dx%d)\n", s_info.w, s_info.h);
- goto out;
- }
-
- disp = XOpenDisplay(NULL);
- if (!disp) {
- ErrPrint("Failed to open a display\n");
- return WIDGET_ERROR_FAULT;
- }
-
- root = XDefaultRootWindow(disp);
- ret = XGetGeometry(disp, root, &dummy, &x, &y, &s_info.w, &s_info.h, &border, &depth);
- XCloseDisplay(disp);
- if (!ret) {
- ErrPrint("Failed to get geometry\n");
- return WIDGET_ERROR_FAULT;
- }
-
-out:
- *width = s_info.w;
- *height = s_info.h;
- return WIDGET_ERROR_NONE;
-}
-
-int util_update_resolution(struct service_info *info, struct supported_size_list *SIZE_LIST)
-{
- if (s_info.res_resolved) {
- return WIDGET_ERROR_NONE;
- }
-
- if (!info->conf_file) {
- info->conf_file = conf_path();
- }
-
- if (info->conf_file) {
- register int i;
- unsigned int width;
- unsigned int height;
-
- i = util_screen_size_get(&width, &height);
- if (i != WIDGET_ERROR_NONE) {
- return i;
- }
-
- if (update_from_file(info, SIZE_LIST) == 0) {
- DbgPrint("Resolution info is all updated by file\n");
- }
-
- if (width != info->base_w) {
- for (i = 0; i < WIDGET_NR_OF_SIZE_LIST; i++) {
- SIZE_LIST[i].w = (unsigned int)((double)SIZE_LIST[i].w * (double)width / (double)info->base_w);
- SIZE_LIST[i].h = (unsigned int)((double)SIZE_LIST[i].h * (double)width / (double)info->base_w);
- }
- }
- } else {
- DbgPrint("Conf file is not loaded\n");
- }
-
- s_info.res_resolved = 1;
- return WIDGET_ERROR_NONE;
-}
-
-EAPI int widget_util_get_drm_fd(void *dpy, int *fd)
-{
- int dri2Major, dri2Minor;
- char *driverName, *deviceName;
- drm_magic_t magic;
- int evt_base;
- int err_base;
-
- if (!fd || !dpy) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (!DRI2QueryExtension(dpy, &evt_base, &err_base)) {
- ErrPrint("DRI2 is not supported\n");
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!DRI2QueryVersion(dpy, &dri2Major, &dri2Minor)) {
- ErrPrint("DRI2 is not supported\n");
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!DRI2Connect(dpy, DefaultRootWindow(dpy), &driverName, &deviceName)) {
- ErrPrint("DRI2 is not supported\n");
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- *fd = open(deviceName, O_RDWR);
- free(deviceName);
- free(driverName);
- if (*fd < 0) {
- ErrPrint("Failed to open a drm device: (%d)\n", errno);
- return WIDGET_ERROR_IO_ERROR;
- }
-
- drmGetMagic(*fd, &magic);
- DbgPrint("DRM Magic: 0x%X\n", magic);
- if (!DRI2Authenticate(dpy, DefaultRootWindow(dpy), (unsigned int)magic)) {
- ErrPrint("Failed to do authenticate for DRI2\n");
- if (close(*fd) < 0) {
- ErrPrint("close: %d\n", errno);
- }
- *fd = -1;
- return WIDGET_ERROR_PERMISSION_DENIED;
- }
-
- return WIDGET_ERROR_NONE;
-}
-
-EAPI int widget_util_release_drm_fd(int fd)
-{
- if (fd < 0) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (close(fd) < 0) {
- ErrPrint("close: %d\n", errno);
- return WIDGET_ERROR_FAULT;
- }
-
- return WIDGET_ERROR_NONE;
-}
-
-/* End of a file */
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <sqlite3.h>
-#include <unicode/uloc.h>
-#include <stdlib.h>
-#include <ctype.h>
-
-#include <dlog.h>
-#include <widget_errno.h>
-#include <system_info.h>
-
-#include "debug.h"
-#include "util.h"
-#include "debug.h"
-#include "dlist.h"
-
-int errno;
-
-#define MAX_ABI 256
-#define MAX_PKGNAME 512
-
-struct item {
- char *abi;
- char *pkgname; /*!< Slave package name */
-};
-
-static struct {
- struct dlist *list;
-} s_abi = {
- .list = NULL,
-};
-
-static int abi_add_entry(const char *abi, const char *pkgname)
-{
- struct item *item;
-
- item = malloc(sizeof(*item));
- if (!item) {
- ErrPrint("Failed to add a new entry for abi[%s - %s]\n", abi, pkgname);
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
-
- item->abi = strdup(abi);
- if (!item->abi) {
- ErrPrint("Heap: %d\n", errno);
- free(item);
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
-
- item->pkgname = strdup(pkgname);
- if (!item->pkgname) {
- ErrPrint("Heap: %d\n", errno);
- free(item->abi);
- free(item);
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
-
- s_abi.list = dlist_append(s_abi.list, item);
- return WIDGET_ERROR_NONE;
-}
-
-static int abi_load_table(void)
-{
- FILE *fp;
- int ch;
- int idx = 0;
- int tag_id = 0;
- enum {
- INIT = 0x0,
- GROUP = 0x1,
- TAG = 0x02,
- VALUE = 0x03,
- ERROR = 0x05
- } state;
- enum {
- PKGNAME = 0x0,
- };
- static const char *field[] = {
- "package",
- NULL,
- };
- const char *ptr = NULL;
-
- char group[MAX_ABI + 1];
- char pkgname[MAX_PKGNAME + 1];
-
- fp = fopen("/usr/share/data-provider-master/abi.ini", "rt");
- if (!fp) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- state = INIT;
- while ((ch = getc(fp)) != EOF && state != ERROR) {
- switch (state) {
- case INIT:
- if (isspace(ch)) {
- continue;
- }
- if (ch == '[') {
- state = GROUP;
- idx = 0;
- } else {
- state = ERROR;
- }
- break;
- case GROUP:
- if (ch == ']') {
- if (idx == 0) {
- state = ERROR;
- } else {
- group[idx] = '\0';
- state = TAG;
- idx = 0;
- ptr = NULL;
- }
- } else if (idx < MAX_ABI) {
- group[idx++] = ch;
- } else {
- ErrPrint("Overflow\n");
- state = ERROR;
- }
- break;
- case TAG:
- if (ptr == NULL) {
- if (idx == 0) {
- if (isspace(ch)) {
- continue;
- }
-
- /* New group started */
- if (ch == '[') {
- ungetc(ch, fp);
- state = INIT;
- continue;
- }
- }
-
- ptr = field[idx];
- }
-
- if (ptr == NULL) {
- ErrPrint("unknown tag\n");
- state = ERROR;
- continue;
- }
-
- if (*ptr == '\0' && ch == '=') {
- /* MATCHED */
- state = VALUE;
- tag_id = idx;
- idx = 0;
- ptr = NULL;
- } else if (*ptr == ch) {
- ptr++;
- } else {
- ungetc(ch, fp);
- ptr--;
- while (ptr >= field[idx]) {
- ungetc(*ptr, fp);
- ptr--;
- }
- ptr = NULL;
- idx++;
- }
- break;
- case VALUE:
- switch (tag_id) {
- case PKGNAME:
- if (idx == 0) { /* LTRIM */
- if (isspace(ch)) {
- continue;
- }
-
- pkgname[idx] = ch;
- idx++;
- } else if (isspace(ch)) {
- int ret;
- pkgname[idx] = '\0';
-
- ret = abi_add_entry(group, pkgname);
- if (ret != 0) {
- ErrPrint("Failed to add %s for %s\n", pkgname, group);
- }
-
- state = TAG;
- idx = 0;
- } else if (idx < MAX_PKGNAME) {
- pkgname[idx] = ch;
- idx++;
- } else {
- ErrPrint("Overflow\n");
- state = ERROR;
- }
- break;
- default:
- break;
- }
- break;
- /* case ERROR: */
- default:
- break;
- }
- }
-
- if (state == VALUE) {
- switch (tag_id) {
- case PKGNAME:
- if (idx) {
- int ret;
- pkgname[idx] = '\0';
- ret = abi_add_entry(group, pkgname);
- if (ret != 0) {
- ErrPrint("Failed to add %s for %s\n", pkgname, group);
- }
- }
- break;
- default:
- break;
- }
- }
-
- if (fclose(fp) != 0) {
- ErrPrint("fclose: %d\n", errno);
- }
- return WIDGET_ERROR_NONE;
-}
-
-static void abi_del_all(void)
-{
- struct item *item;
- struct dlist *l;
- struct dlist *n;
-
- dlist_foreach_safe(s_abi.list, l, n, item) {
- s_abi.list = dlist_remove(s_abi.list, l);
- free(item->abi);
- free(item->pkgname);
- free(item);
- }
-}
-
-EAPI int widget_abi_init(void)
-{
- return abi_load_table();
-}
-
-EAPI int widget_abi_fini(void)
-{
- abi_del_all();
- return WIDGET_ERROR_NONE;
-}
-
-EAPI const char *widget_abi_get_pkgname_by_abi(const char *abi)
-{
- struct dlist *l;
- struct item *item;
-
- dlist_foreach(s_abi.list, l, item) {
- if (!strcasecmp(item->abi, abi)) {
- return item->pkgname;
- }
- }
-
- return NULL;
-}
-
-EAPI const char *widget_abi_get_abi_by_pkgname(const char *pkgname)
-{
- struct dlist *l;
- struct item *item;
-
- dlist_foreach(s_abi.list, l, item) {
- if (!strcmp(item->pkgname, pkgname)) {
- return item->abi;
- }
- }
-
- return NULL;
-}
-
-/* End of a file */
#include "debug.h"
#include "widget_conf.h"
-#include "util.h"
#include "debug.h"
#define BASE_SHARE_DIR "/opt/usr/share/live_magazine/"
return WIDGET_ERROR_ALREADY_EXIST;
}
- util_screen_size_get(&s_conf.width, &s_conf.height);
+
+// util_screen_size_get(&s_conf.width, &s_conf.height);
+
conf_file = conf_path();
if (!conf_file) {
+++ /dev/null
-/*
- * Copyright 2013 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h> /* malloc */
-#include <string.h> /* strdup, strerror */
-
-#include <sqlite3.h>
-#include <unicode/uloc.h>
-
-#include <com-core_packet.h>
-#include <packet.h>
-#include <dlog.h>
-#include <system_info.h>
-
-#include "dlist.h"
-#include "widget_errno.h"
-#include "debug.h"
-#include "widget_service.h"
-#include "widget_cmd_list.h"
-#include "util.h"
-
-int errno;
-
-struct lifecycle_monitor_item {
- char *widget_id;
- widget_lifecycle_event_cb cb;
- void *data;
-};
-
-static struct info {
- struct dlist *lifecycle_monitor_list;
- int lifecycle_monitor_handle;
-} s_info = {
- .lifecycle_monitor_list = NULL,
- .lifecycle_monitor_handle = -1,
-};
-
-static inline void send_monitor_command(unsigned int cmd, const char *widget_id)
-{
- struct packet *packet;
-
- if (s_info.lifecycle_monitor_handle < 0) {
- ErrPrint("Not yet initialized\n");
- return;
- }
-
- packet = packet_create_noack((const char *)&cmd, "s", widget_id ? widget_id : "*");
- if (!packet) {
- ErrPrint("Failed to create a packet\n");
- } else {
- if (com_core_packet_send_only(s_info.lifecycle_monitor_handle, packet) < 0) {
- ErrPrint("Failed to send packet\n");
- }
- packet_destroy(packet);
- }
-}
-
-static inline void invoke_handler(widget_lifecycle_event_e event, const char *widget_id, const char *instance_id)
-{
- struct lifecycle_monitor_item *item;
- struct dlist *l;
-
- DbgPrint("%s %s\n", widget_id, instance_id);
- dlist_foreach(s_info.lifecycle_monitor_list, l, item) {
- if (item->widget_id == NULL) {
- item->cb(widget_id, event, instance_id, item->data);
- } else if (!strcmp(item->widget_id, widget_id)) {
- item->cb(widget_id, event, instance_id, item->data);
- }
- }
-}
-
-static struct packet *monitor_create_handler(pid_t pid, int handle, const struct packet *packet)
-{
- const char *widget_id;
- const char *instance_id;
- const char *content_info;
- double timestamp;
-
- if (packet_get(packet, "dsss", ×tamp, &widget_id, &instance_id, &content_info) != 4) {
- ErrPrint("Invalid packet\n");
- } else {
- invoke_handler(WIDGET_LIFE_CYCLE_EVENT_CREATE, widget_id, instance_id);
- }
-
- return NULL;
-}
-
-static struct packet *monitor_destroy_handler(pid_t pid, int handle, const struct packet *packet)
-{
- const char *widget_id;
- const char *instance_id;
- const char *content_info;
- double timestamp;
-
- if (packet_get(packet, "dsss", ×tamp, &widget_id, &instance_id, &content_info) != 4) {
- ErrPrint("Invalid packet\n");
- } else {
- invoke_handler(WIDGET_LIFE_CYCLE_EVENT_DESTROY, widget_id, instance_id);
- }
-
- return NULL;
-}
-
-static struct packet *monitor_pause_handler(pid_t pid, int handle, const struct packet *packet)
-{
- const char *widget_id;
- const char *instance_id;
- const char *content_info;
- double timestamp;
-
- if (packet_get(packet, "dsss", ×tamp, &widget_id, &instance_id, &content_info) != 4) {
- ErrPrint("Invalid packet\n");
- } else {
- invoke_handler(WIDGET_LIFE_CYCLE_EVENT_PAUSE, widget_id, instance_id);
- }
-
- return NULL;
-}
-
-static struct packet *monitor_resume_handler(pid_t pid, int handle, const struct packet *packet)
-{
- const char *widget_id;
- const char *instance_id;
- const char *content_info;
- double timestamp;
-
- if (packet_get(packet, "dsss", ×tamp, &widget_id, &instance_id, &content_info) != 4) {
- ErrPrint("Invalid packet\n");
- } else {
- invoke_handler(WIDGET_LIFE_CYCLE_EVENT_RESUME, widget_id, instance_id);
- }
-
- return NULL;
-}
-
-EAPI int widget_service_set_lifecycle_event_cb(const char *widget_id, widget_lifecycle_event_cb cb, void *data)
-{
- struct lifecycle_monitor_item *item;
- struct dlist *l;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!cb) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (!widget_id) {
- DbgPrint("Register monitor for all widgets\n");
- }
-
- dlist_foreach(s_info.lifecycle_monitor_list, l, item) {
- if (item->widget_id == NULL && widget_id == NULL) {
- return WIDGET_ERROR_ALREADY_EXIST;
- } else if (item->widget_id && widget_id) {
- if (!strcmp(widget_id, item->widget_id)) {
- return WIDGET_ERROR_ALREADY_EXIST;
- }
- }
- }
-
- item = calloc(1, sizeof(*item));
- if (!item) {
- ErrPrint("calloc: %d\n", errno);
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
-
- if (widget_id) {
- item->widget_id = strdup(widget_id);
- if (!item->widget_id) {
- ErrPrint("strdup: %d\n", errno);
- free(item);
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
- } else {
- item->widget_id = NULL;
- }
-
- item->cb = cb;
- item->data = data;
-
- s_info.lifecycle_monitor_list = dlist_append(s_info.lifecycle_monitor_list, item);
-
- if (s_info.lifecycle_monitor_handle < 0) {
- static struct method table[] = {
- {
- .cmd = CMD_STR_MONITOR_CREATE,
- .handler = monitor_create_handler,
- },
- {
- .cmd = CMD_STR_MONITOR_DESTROY,
- .handler = monitor_destroy_handler,
- },
- {
- .cmd = CMD_STR_MONITOR_PAUSE,
- .handler = monitor_pause_handler,
- },
- {
- .cmd = CMD_STR_MONITOR_RESUME,
- .handler = monitor_resume_handler,
- },
- {
- .cmd = NULL,
- .handler = NULL,
- },
- };
-
- /**
- * @todo
- * Send service_register command to master
- */
- s_info.lifecycle_monitor_handle = com_core_packet_client_init(SERVICE_SOCKET, 0, table);
- DbgPrint("Monitor handle: %d\n", s_info.lifecycle_monitor_handle);
- }
-
- send_monitor_command(CMD_MONITOR_REGISTER, widget_id);
-
- return WIDGET_ERROR_NONE;
-}
-
-EAPI int widget_service_unset_lifecycle_event_cb(const char *widget_id, void **user_data)
-{
- struct dlist *l;
- struct dlist *n;
- struct lifecycle_monitor_item *item;
- int ret = WIDGET_ERROR_NOT_EXIST;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- dlist_foreach_safe(s_info.lifecycle_monitor_list, l, n, item) {
- if (widget_id == NULL && item->widget_id == NULL) {
- s_info.lifecycle_monitor_list = dlist_remove(s_info.lifecycle_monitor_list, l);
- if (user_data) {
- *user_data = item->data;
- }
- free(item);
-
- /**
- * @todo
- * Send service_unregister command to master
- */
- send_monitor_command(CMD_MONITOR_UNREGISTER, widget_id);
-
- ret = WIDGET_ERROR_NONE;
- break;
- } else if (widget_id && item->widget_id) {
- if (!strcmp(item->widget_id, widget_id)) {
- s_info.lifecycle_monitor_list = dlist_remove(s_info.lifecycle_monitor_list, l);
- if (user_data) {
- *user_data = item->data;
- }
- free(item->widget_id);
- free(item);
-
- /**
- * @todo
- * Send service_unregister command to master
- */
- send_monitor_command(CMD_MONITOR_UNREGISTER, widget_id);
- ret = WIDGET_ERROR_NONE;
- break;
- }
- }
- }
-
- if (s_info.lifecycle_monitor_handle >= 0 && !s_info.lifecycle_monitor_list) {
- com_core_packet_client_fini(s_info.lifecycle_monitor_handle);
- s_info.lifecycle_monitor_handle = -1;
- }
-
- return ret;
-}
-
-EAPI int widget_service_get_content_of_widget_instance(const char *widget_id, const char *widget_instance_id, bundle **b)
-{
- struct packet *packet;
- struct packet *result;
- unsigned int cmd = CMD_SERVICE_GET_CONTENT;
- char *uri;
- const char *_content;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!widget_instance_id || !b) {
- ErrPrint("Invalid argument\n");
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- uri = util_id_to_uri(widget_instance_id);
- if (!uri) {
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
-
- packet = packet_create((const char *)&cmd, "ss", widget_id, uri);
- free(uri);
- if (!packet) {
- ErrPrint("Failed to create a packet for period changing\n");
- return WIDGET_ERROR_FAULT;
- }
-
- result = com_core_packet_oneshot_send(SERVICE_SOCKET, packet, DEFAULT_TIMEOUT);
- packet_unref(packet);
-
- if (result) {
- if (packet_get(result, "is", &ret, &_content) != 2) {
- ErrPrint("Failed to parse a result packet\n");
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- } else if (ret == WIDGET_ERROR_NONE) {
- *b = bundle_decode((bundle_raw *)_content, strlen(_content));
- if (!*b) {
- ErrPrint("bundle_decode: %s\n", _content);
- }
- } else {
- ErrPrint("ret: %d\n", ret);
- }
- packet_unref(result);
- } else {
- ErrPrint("Failed to get result packet\n");
- ret = WIDGET_ERROR_FAULT;
- }
-
- return ret;
-}
-
-EAPI int widget_service_get_widget_instance_list(const char *widget_id, widget_instance_list_cb cb, void *data)
-{
- struct packet *packet;
- struct packet *result;
- unsigned int cmd = CMD_SERVICE_GET_INST_LIST;
- const char *list;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!widget_id || !cb) {
- ErrPrint("Invalid argument\n");
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- packet = packet_create((const char *)&cmd, "s", widget_id);
- if (!packet) {
- ErrPrint("Failed to create a packet for period changing\n");
- return WIDGET_ERROR_FAULT;
- }
-
- result = com_core_packet_oneshot_send(SERVICE_SOCKET, packet, DEFAULT_TIMEOUT);
- packet_unref(packet);
-
- if (result) {
- int cnt;
- if (packet_get(result, "iis", &ret, &cnt, &list) != 3) {
- ErrPrint("Failed to parse a result packet\n");
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- } else if (ret == WIDGET_ERROR_NONE) {
- const char *ptr;
- register int i;
- /**
- * Parse the list
- */
- ptr = list;
- i = 0;
- do {
- switch (list[i]) {
- case '\0':
- if (ptr != list + i) {
- cb(widget_id, ptr, data);
- }
- break;
- case '\n':
- *((char *)list + i) = '\0';
- cb(widget_id, ptr, data);
- ptr = list + i + 1;
- default:
- i++;
- break;
- }
- } while (list[i]);
-
- if (i != cnt) {
- DbgPrint("Total count is not valid: %d <> %d\n", i, cnt);
- }
- }
- packet_unref(result);
- } else {
- ErrPrint("Failed to get result packet\n");
- ret = WIDGET_ERROR_FAULT;
- }
-
- return ret;
-}
-
-/* End of a file */
* limitations under the License.
*/
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h> /* malloc */
-#include <string.h> /* strdup, strerror */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <sqlite3.h>
-#include <ctype.h>
-#include <fcntl.h>
-
-#include <com-core_packet.h>
-#include <packet.h>
-#include <dlog.h>
-#include <db-util.h>
-#include <package-manager.h>
-#include <pkgmgr-info.h>
-#include <vconf.h>
-#include <vconf-keys.h>
-#include <unicode/uloc.h>
-#include <bundle.h>
-#include <system_info.h>
-
#include "widget_errno.h"
-#include "dlist.h"
#include "debug.h"
-#include "util.h"
#include "widget_conf.h"
#include "widget_service.h"
-#include "widget_service_internal.h"
-#include "widget_cmd_list.h"
-#include "widget_buffer.h"
-#include "widget_util.h"
-
-#define WIDGET_ID_PREFIX "org.tizen."
-#define LOCK_PATH_PREFIX "/opt/usr/share/live_magazine/.widget.lck/"
-
-/* "/shared/res/" */
-#define RESOURCE_PATH "/"
-
-/* "/shared/libexec/" */
-#define LIBEXEC_PATH "/"
-
-static struct supported_size_list SIZE_LIST[WIDGET_NR_OF_SIZE_LIST] = {
- { 175, 175 }, /*!< 1x1 */
- { 354, 175 }, /*!< 2x1 */
- { 354, 354 }, /*!< 2x2 */
- { 712, 175 }, /*!< 4x1 */
- { 712, 354 }, /*!< 4x2 */
- { 712, 533 }, /*!< 4x3 */
- { 712, 712 }, /*!< 4x4 */
- { 712, 891 }, /*!< 4x5 */
- { 712, 1070 }, /*!< 4x6 */
- { 224, 215 }, /*!< 21x21 */
- { 680, 215 }, /*!< 23x21 */
- { 680, 653 }, /*!< 23x23 */
- { 720, 1280 }, /*!< 0x0 */
-};
-
-struct widget_list_handle {
- enum pkglist_type {
- PKGLIST_TYPE_WIDGET_LIST = 0x00beef00,
- PKGLIST_TYPE_UNKNOWN = 0x00dead00
- } type;
- sqlite3 *handle;
- sqlite3_stmt *stmt;
-};
-
-static struct service_info s_info = {
- .handle = NULL,
- .dbfile = DB_FILE,
- .conf_file = NULL,
- .init_count = 0,
-
- .iso3lang = NULL,
- .country = { 0, },
- .syslang = NULL,
- .country_len = 0,
-
- .base_w = 720,
- .base_h = 1280,
-
- .base_parse = 0,
-
- .last_status = WIDGET_ERROR_NONE,
-};
-
-struct pkgmgr_cbdata {
- const char *widgetid;
- void (*cb)(const char *widgetid, const char *appid, void *data);
- void *cbdata;
-};
-
-static sqlite3 *open_db(void)
-{
- sqlite3 *handle;
-
- if (!s_info.handle) {
- int ret;
- ret = db_util_open_with_options(s_info.dbfile, &handle, SQLITE_OPEN_READONLY, NULL);
- if (ret != SQLITE_OK) {
- switch (ret) {
- case SQLITE_PERM:
- set_last_result(WIDGET_ERROR_PERMISSION_DENIED);
- break;
- default:
- set_last_result(WIDGET_ERROR_IO_ERROR);
- break;
- }
-
- ErrPrint("Failed to open a DB\n");
- return NULL;
- }
- } else {
- handle = s_info.handle;
- }
-
- return handle;
-}
-
-static inline __attribute__((always_inline)) void close_db(sqlite3 *handle)
-{
- if (!s_info.handle) {
- db_util_close(handle);
- }
-}
-
-static int convert_size_from_type(widget_size_type_e type, int *width, int *height)
-{
- int idx;
-
- switch (type) {
- case WIDGET_SIZE_TYPE_1x1: /*!< 175x175 */
- idx = 0;
- break;
- case WIDGET_SIZE_TYPE_2x1: /*!< 354x175 */
- idx = 1;
- break;
- case WIDGET_SIZE_TYPE_2x2: /*!< 354x354 */
- idx = 2;
- break;
- case WIDGET_SIZE_TYPE_4x1: /*!< 712x175 */
- idx = 3;
- break;
- case WIDGET_SIZE_TYPE_4x2: /*!< 712x354 */
- idx = 4;
- break;
- case WIDGET_SIZE_TYPE_4x3: /*!< 712x533 */
- idx = 5;
- break;
- case WIDGET_SIZE_TYPE_4x4: /*!< 712x712 */
- idx = 6;
- break;
- case WIDGET_SIZE_TYPE_4x5: /*!< 712x891 */
- idx = 7;
- break;
- case WIDGET_SIZE_TYPE_4x6: /*!< 712x1070 */
- idx = 8;
- break;
- case WIDGET_SIZE_TYPE_EASY_1x1: /*< 224x215 */
- idx = 9;
- break;
- case WIDGET_SIZE_TYPE_EASY_3x1: /*!< 680x215 */
- idx = 10;
- break;
- case WIDGET_SIZE_TYPE_EASY_3x3: /*!< 680x653 */
- idx = 11;
- break;
- case WIDGET_SIZE_TYPE_FULL: /*!< 720x1280 */
- idx = 12;
- break;
- default:
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (util_update_resolution(&s_info, SIZE_LIST) < 0) {
- ErrPrint("Failed to update resolution\n");
- }
-
- *width = SIZE_LIST[idx].w;
- *height = SIZE_LIST[idx].h;
- return WIDGET_ERROR_NONE;
-}
-
-static int pkgmgr_cb(const pkgmgrinfo_appinfo_h handle, void *user_data)
+EAPI int widget_service_change_period(const char *pkgname, const char *id, double period)
{
- struct pkgmgr_cbdata *cbdata = (struct pkgmgr_cbdata *)user_data;
- char *appid;
- int ret;
-
- ret = pkgmgrinfo_appinfo_get_appid(handle, &appid);
- if (ret < 0) {
- ErrPrint("Unable to get appid\n");
- } else {
- cbdata->cb(cbdata->widgetid, appid, cbdata->cbdata);
- }
-
- return 0;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-static inline char *pkgmgr_get_mainapp(const char *pkgid)
+EAPI int widget_service_trigger_update(const char *widget_id, const char *id, bundle *b, int force)
{
- pkgmgrinfo_pkginfo_h handle;
- char *ret;
-
- if (pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle) != PMINFO_R_OK) {
- ErrPrint("Unable to get mainapp: %s\n", pkgid);
- set_last_result(WIDGET_ERROR_FAULT);
- return NULL;
- }
-
- ret = NULL;
- if (pkgmgrinfo_pkginfo_get_mainappid(handle, &ret) == PMINFO_R_OK) {
- if (ret) {
- ret = strdup(ret);
- if (!ret) {
- ErrPrint("strdup: %d\n", errno);
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- } else {
- set_last_result(WIDGET_ERROR_NONE);
- }
- }
- } else {
- ErrPrint("Failed to get mainappid\n");
- ret = NULL; /* I cannot believe the pkgmgrinfo_pkginfo_get_mainappid. it maybe able to touch my "ret" even though it fails */
- set_last_result(WIDGET_ERROR_FAULT);
- }
-
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- return ret;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-static inline int pkgmgr_get_applist(const char *pkgid, const char *widgetid, void (*cb)(const char *widgetid, const char *appid, void *data), void *data)
+EAPI int widget_service_get_widget_list(widget_list_cb cb, void *data)
{
- struct pkgmgr_cbdata cbdata;
- pkgmgrinfo_pkginfo_h handle;
- int ret;
-
- ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
- if (ret < 0) {
- ErrPrint("Unable to get pkginfo: %s\n", pkgid);
- return ret;
- }
-
- cbdata.widgetid = widgetid;
- cbdata.cb = cb;
- cbdata.cbdata = data;
-
- ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, pkgmgr_cb, &cbdata);
- if (ret < 0) {
- ErrPrint("Failed to get applist\n");
- }
-
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- return ret;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-static char *cur_locale(void)
+EAPI int widget_service_get_widget_list_by_pkgid(const char *pkgid, widget_list_by_pkgid_cb cb, void *data)
{
- char *language;
- language = vconf_get_str(VCONFKEY_LANGSET);
- if (language) {
- char *ptr;
-
- ptr = language;
- while (*ptr) {
- if (*ptr == '.') {
- *ptr = '\0';
- break;
- }
-
- if (*ptr == '_') {
- *ptr = '-';
- }
-
- ptr++;
- }
- } else {
- language = strdup("en-us");
- if (!language) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- }
- }
-
- return language;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-static char *get_default_name(const char *pkgid)
+EAPI char *widget_service_get_main_app_id(const char *widgetid)
{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- char *name = NULL;
- int ret;
-
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT name FROM client WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
- const char *tmp;
-
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (tmp && strlen(tmp)) {
- name = strdup(tmp);
- if (!name) {
- ErrPrint("Heap: %d\n", errno);
- }
- }
- set_last_result(WIDGET_ERROR_NONE);
- } else {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return name;
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
+ return NULL;
}
-static char *get_default_icon(const char *pkgid)
+EAPI int widget_service_get_supported_size_types(const char *pkgid, int *cnt, int **types)
{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- char *icon = NULL;
- int ret;
-
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT icon FROM client WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
- const char *tmp;
-
- set_last_result(WIDGET_ERROR_NONE);
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (tmp && strlen(tmp)) {
- icon = strdup(tmp);
- if (!icon) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- }
- }
- } else if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return icon;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-static char *get_widget_pkgname_by_appid(const char *appid)
+EAPI char *widget_service_get_app_id_of_setup_app(const char *widgetid)
{
- sqlite3_stmt *stmt;
- char *pkgid;
- char *tmp;
- sqlite3 *handle;
- int ret;
-
- if (!appid) {
- return NULL;
- }
-
- pkgid = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT pkgid FROM pkgmap WHERE (appid = ? AND prime = 1) OR (uiapp = ? AND prime = 1) OR pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- set_last_result(WIDGET_ERROR_FAULT);
- close_db(handle);
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, appid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- set_last_result(WIDGET_ERROR_FAULT);
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, appid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- set_last_result(WIDGET_ERROR_FAULT);
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 3, appid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- set_last_result(WIDGET_ERROR_FAULT);
- goto out;
- }
-
- if (sqlite3_step(stmt) != SQLITE_ROW) {
- ErrPrint("Error: %s (has no record? - %s)\n", sqlite3_errmsg(handle), appid);
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- goto out;
- }
-
- tmp = (char *)sqlite3_column_text(stmt, 0);
- if (tmp && strlen(tmp)) {
- pkgid = strdup(tmp);
- if (!pkgid) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- } else {
- set_last_result(WIDGET_ERROR_NONE);
- }
- } else {
- set_last_result(WIDGET_ERROR_NONE);
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return pkgid;
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
+ return NULL;
}
-static inline int update_lang_info(void)
+EAPI int widget_service_get_nodisplay(const char *pkgid)
{
- char *syslang;
- UErrorCode err;
-
- syslang = vconf_get_str(VCONFKEY_LANGSET);
- if (!syslang) {
- ErrPrint("Failed to get vconf-lang\n");
- set_last_result(WIDGET_ERROR_FAULT);
- return -EFAULT;
- }
-
- if (s_info.syslang && !strcmp(s_info.syslang, syslang)) {
- DbgPrint("Syslang is not changed: %s\n", syslang);
- free(syslang);
- return 0;
- }
-
- free(s_info.syslang);
- s_info.syslang = syslang;
-
- err = U_ZERO_ERROR;
- uloc_setDefault((const char *)s_info.syslang, &err);
- if (!U_SUCCESS(err)) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Failed to set default lang: %s\n", u_errorName(err));
- free(s_info.syslang);
- s_info.syslang = NULL;
- return -EFAULT;
- }
-
- s_info.iso3lang = uloc_getISO3Language(uloc_getDefault());
- if (!s_info.iso3lang || !strlen(s_info.iso3lang)) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Failed to get iso3lang\n");
- free(s_info.syslang);
- s_info.syslang = NULL;
- return -EFAULT;
- }
-
- err = U_ZERO_ERROR;
- s_info.country_len = uloc_getCountry(uloc_getDefault(), s_info.country, ULOC_COUNTRY_CAPACITY, &err);
- if (!U_SUCCESS(err) || s_info.country_len <= 0) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Failed to get locale: %s, %s, %d (%s)\n", u_errorName(err), s_info.iso3lang, s_info.country_len, s_info.country);
- free(s_info.syslang);
- s_info.syslang = NULL;
- return -EFAULT;
- }
-
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
return 0;
}
-EAPI int widget_service_change_period(const char *pkgname, const char *id, double period)
-{
- struct packet *packet;
- struct packet *result;
- unsigned int cmd = CMD_SERVICE_CHANGE_PERIOD;
- char *uri;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!pkgname || !id || period < 0.0f) {
- ErrPrint("Invalid argument\n");
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- uri = util_id_to_uri(id);
- if (!uri) {
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
-
- packet = packet_create((const char *)&cmd, "ssd", pkgname, uri, period);
- free(uri);
- if (!packet) {
- ErrPrint("Failed to create a packet for period changing\n");
- return WIDGET_ERROR_FAULT;
- }
-
- result = com_core_packet_oneshot_send(SERVICE_SOCKET, packet, DEFAULT_TIMEOUT);
- packet_unref(packet);
-
- if (result) {
- if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Failed to parse a result packet\n");
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- }
- packet_unref(result);
- } else {
- ErrPrint("Failed to get result packet\n");
- ret = WIDGET_ERROR_FAULT;
- }
-
- return ret;
-}
-
-EAPI int widget_service_get_instance_count(const char *pkgname, const char *cluster, const char *category)
-{
- struct packet *packet;
- struct packet *result;
- unsigned int cmd = CMD_SERVICE_INST_CNT;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!pkgname) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- packet = packet_create((const char *)&cmd, "sssd", pkgname, cluster, category, util_timestamp());
- if (!packet) {
- ErrPrint("Failed to create a packet for period changing\n");
- return WIDGET_ERROR_FAULT;
- }
-
- result = com_core_packet_oneshot_send(SERVICE_SOCKET, packet, DEFAULT_TIMEOUT);
- packet_unref(packet);
-
- if (result) {
- if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Failed to parse a result packet\n");
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- }
- packet_unref(result);
- } else {
- ErrPrint("Failed to get result packet\n");
- ret = WIDGET_ERROR_FAULT;
- }
-
- return ret;
-}
-
-EAPI int widget_service_trigger_update(const char *widget_id, const char *id, bundle *b, int force)
-{
- struct packet *packet;
- struct packet *result;
- unsigned int cmd = CMD_SERVICE_UPDATE;
- char *uri;
- int ret;
- char *content = NULL;
- int content_len = 0;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!widget_id) {
- ErrPrint("Invalid argument\n");
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (!force && access("/tmp/.live.paused", R_OK) == 0) {
- DbgPrint("Provider is paused\n");
- return WIDGET_ERROR_CANCELED;
- }
-
- if (id) {
- uri = util_id_to_uri(id);
- if (!uri) {
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
- } else {
- uri = NULL;
- }
-
- if (b) {
- ret = bundle_encode(b, (bundle_raw **)&content, &content_len);
- if (ret != BUNDLE_ERROR_NONE) {
- ErrPrint("Unable to encode bundle: %d\n", ret);
- }
- }
-
- packet = packet_create((const char *)&cmd, "sssssi", widget_id, uri, "user,created", "default", content, force);
- free(content);
- /*!
- * \note
- * "free" function accepts NULL
- */
- free(uri);
- if (!packet) {
- ErrPrint("Failed to create a packet for service_update\n");
- return WIDGET_ERROR_FAULT;
- }
-
- result = com_core_packet_oneshot_send(SERVICE_SOCKET, packet, DEFAULT_TIMEOUT);
- packet_unref(packet);
-
- if (result) {
- if (packet_get(result, "i", &ret) != 1) {
- ErrPrint("Failed to parse a result packet\n");
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- packet_unref(result);
- } else {
- ErrPrint("Failed to get result packet\n");
- ret = WIDGET_ERROR_FAULT;
- }
-
- return ret;
-}
-
-EAPI widget_list_h widget_service_create_widget_list(const char *pkgid, widget_list_h handle)
-{
- int ret;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (handle) {
- if (handle->type != PKGLIST_TYPE_WIDGET_LIST) {
- ErrPrint("Invalid handle\n");
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (pkgid) {
- ErrPrint("pkgid should be NULL\n");
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- sqlite3_reset(handle->stmt);
- return handle;
- }
-
- handle = calloc(1, sizeof(*handle));
- if (!handle) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- return NULL;
- }
-
- handle->type = PKGLIST_TYPE_WIDGET_LIST;
-
- handle->handle = open_db();
- if (!handle->handle) {
- free(handle);
- return NULL;
- }
-
- if (!pkgid) {
- ret = sqlite3_prepare_v2(handle->handle, "SELECT appid, pkgid, prime FROM pkgmap", -1, &handle->stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle->handle));
- close_db(handle->handle);
- free(handle);
- return NULL;
- }
- } else {
- ret = sqlite3_prepare_v2(handle->handle, "SELECT appid, pkgid, prime FROM pkgmap WHERE appid = ?", -1, &handle->stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle->handle));
- close_db(handle->handle);
- free(handle);
- return NULL;
- }
-
- ret = sqlite3_bind_text(handle->stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle->handle));
- sqlite3_finalize(handle->stmt);
- close_db(handle->handle);
- free(handle);
- return NULL;
- }
- }
-
- return handle;
-}
-
-EAPI int widget_service_get_item_from_widget_list(widget_list_h handle, char **appid, char **pkgname, int *is_prime)
+EAPI int widget_service_get_need_of_frame(const char *pkgid, widget_size_type_e size_type, bool *need_of_frame)
{
- const char *tmp;
- char *_appid = NULL;
- char *_pkgname = NULL;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!handle || handle->type != PKGLIST_TYPE_WIDGET_LIST) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (sqlite3_step(handle->stmt) != SQLITE_ROW) {
- return WIDGET_ERROR_NOT_EXIST;
- }
-
- if (appid) {
- tmp = (const char *)sqlite3_column_text(handle->stmt, 0);
- if (tmp && strlen(tmp)) {
- _appid = strdup(tmp);
- if (!_appid) {
- ErrPrint("Heap: %d\n", errno);
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
- }
- }
-
- if (pkgname) {
- tmp = (const char *)sqlite3_column_text(handle->stmt, 1);
- if (tmp && strlen(tmp)) {
- _pkgname = strdup(tmp);
- if (!_pkgname) {
- ErrPrint("Heap: %d\n", errno);
- free(_appid);
- return WIDGET_ERROR_OUT_OF_MEMORY;
- }
- }
- }
-
- if (is_prime) {
- *is_prime = sqlite3_column_int(handle->stmt, 2);
- }
-
- if (appid) {
- *appid = _appid;
- }
-
- if (pkgname) {
- *pkgname = _pkgname;
- }
-
- return WIDGET_ERROR_NONE;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-EAPI int widget_service_destroy_widget_list(widget_list_h handle)
+EAPI int widget_service_get_need_of_touch_effect(const char *pkgid, widget_size_type_e size_type, bool *need_of_touch_event)
{
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!handle || handle->type != PKGLIST_TYPE_WIDGET_LIST) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle->type = PKGLIST_TYPE_UNKNOWN;
- sqlite3_reset(handle->stmt);
- sqlite3_finalize(handle->stmt);
- close_db(handle->handle);
- free(handle);
- return WIDGET_ERROR_NONE;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-EAPI int widget_service_get_widget_list(widget_list_cb cb, void *data)
+EAPI int widget_service_get_need_of_mouse_event(const char *pkgid, widget_size_type_e size_type, bool *need_of_mouse_event)
{
- int ret;
- sqlite3_stmt *stmt;
- char *appid;
- char *pkgid;
- int is_prime;
- sqlite3 *handle;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!cb) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT appid, pkgid, prime FROM pkgmap", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = 0;
- while (sqlite3_step(stmt) == SQLITE_ROW) {
- appid = (char *)sqlite3_column_text(stmt, 0);
- if (!appid || !strlen(appid)) {
- ErrPrint("APPID is not valid\n");
- continue;
- }
-
- pkgid = (char *)sqlite3_column_text(stmt, 1);
- if (!pkgid || !strlen(pkgid)) {
- ErrPrint("pkgid is not valid\n");
- continue;
- }
-
- is_prime = sqlite3_column_int(stmt, 2);
-
- ret++;
-
- if (cb(appid, pkgid, is_prime, data) < 0) {
- DbgPrint("Callback stopped package crawling\n");
- break;
- }
- }
-
- if (ret == 0) {
- ret = WIDGET_ERROR_NOT_EXIST;
- }
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-
-out:
- close_db(handle);
- return ret;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-EAPI int widget_service_get_widget_list_by_pkgid(const char *pkgid, widget_list_by_pkgid_cb cb, void *data)
+EAPI char *widget_service_get_preview_image_path(const char *pkgid, widget_size_type_e size_type)
{
- int ret;
- sqlite3_stmt *stmt;
- const char *widgetid;
- int is_prime;
- sqlite3 *handle;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!cb || !pkgid) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT pkgid, prime FROM pkgmap WHERE appid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = 0;
- while (sqlite3_step(stmt) == SQLITE_ROW) {
- widgetid = (const char *)sqlite3_column_text(stmt, 0);
- if (!widgetid || !strlen(widgetid)) {
- ErrPrint("WIDGETID is not valid\n");
- continue;
- }
-
- is_prime = sqlite3_column_int(stmt, 1);
-
- ret++;
-
- if (cb(widgetid, is_prime, data) < 0) {
- DbgPrint("Callback stopped package crawling\n");
- break;
- }
- }
-
- if (ret == 0) {
- ret = WIDGET_ERROR_NOT_EXIST;
- }
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-
-out:
- close_db(handle);
- return ret;
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
+ return NULL;
}
-EAPI int widget_service_get_widget_list_by_category(const char *category, int (*cb)(const char *widgetid, void *data), void *data)
+EAPI char *widget_service_get_icon(const char *pkgid, const char *lang)
{
- int ret;
- sqlite3_stmt *stmt;
- const char *widgetid;
- sqlite3 *handle;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!cb || !category) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT pkgid FROM pkgmap WHERE category = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, category, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = 0;
- while (sqlite3_step(stmt) == SQLITE_ROW) {
- widgetid = (const char *)sqlite3_column_text(stmt, 0);
- if (!widgetid || !strlen(widgetid)) {
- ErrPrint("WIDGETID is not valid\n");
- continue;
- }
-
- ret++;
-
- if (cb(widgetid, data) < 0) {
- DbgPrint("Callback stopped package crawling\n");
- break;
- }
- }
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-
-out:
- close_db(handle);
- return ret;
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
+ return NULL;
}
-EAPI int widget_service_get_applist(const char *widgetid, void (*cb)(const char *widgetid, const char *appid, void *data), void *data)
+EAPI char *widget_service_get_name(const char *pkgid, const char *lang)
{
- sqlite3_stmt *stmt;
- const char *tmp;
- char *pkgid;
- sqlite3 *handle;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!widgetid || !cb) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT appid FROM pkgmap WHERE (pkgid = ?) or (appid = ?)", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, widgetid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, widgetid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- if (sqlite3_step(stmt) != SQLITE_ROW) {
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp)) {
- ErrPrint("Invalid package name (%s)\n", widgetid);
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- pkgid = strdup(tmp);
- if (!pkgid) {
- ErrPrint("Error: %d\n", errno);
- ret = WIDGET_ERROR_OUT_OF_MEMORY;
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-
- ret = pkgmgr_get_applist(pkgid, widgetid, cb, data);
- free(pkgid);
-
- switch (ret) {
- case PMINFO_R_EINVAL:
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- break;
- case PMINFO_R_OK:
- ret = WIDGET_ERROR_NONE;
- break;
- case PMINFO_R_ERROR:
- default:
- ret = WIDGET_ERROR_FAULT;
- break;
- }
-
-out:
- close_db(handle);
- return ret;
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
+ return NULL;
}
-EAPI char *widget_service_get_main_app_id(const char *widgetid)
+EAPI int widget_service_get_supported_sizes(const char *pkgid, int *cnt, int **w, int **h)
{
- sqlite3_stmt *stmt;
- const char *tmp;
- const char *pkgid;
- sqlite3 *handle;
- char *ret = NULL;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!widgetid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- handle = open_db();
- if (!handle) {
- set_last_result(WIDGET_ERROR_IO_ERROR);
- return NULL;
- }
-
- if (sqlite3_prepare_v2(handle, "SELECT appid, uiapp FROM pkgmap WHERE (pkgid = ?) or (appid = ? and prime = 1)", -1, &stmt, NULL) != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- set_last_result(WIDGET_ERROR_FAULT);
- goto out;
- }
-
- if (sqlite3_bind_text(stmt, 1, widgetid, -1, SQLITE_TRANSIENT) != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- set_last_result(WIDGET_ERROR_FAULT);
- goto out;
- }
-
- if (sqlite3_bind_text(stmt, 2, widgetid, -1, SQLITE_TRANSIENT) != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- set_last_result(WIDGET_ERROR_FAULT);
- goto out;
- }
-
- if (sqlite3_step(stmt) != SQLITE_ROW) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp)) {
- ErrPrint("Invalid package name (%s)\n", widgetid);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- set_last_result(WIDGET_ERROR_IO_ERROR);
- goto out;
- }
-
- pkgid = (const char *)sqlite3_column_text(stmt, 1);
- if (!pkgid || !strlen(pkgid)) {
- /*
- * This record has no uiapp.
- * Try to find the main ui-app id.
- */
- ret = pkgmgr_get_mainapp(tmp);
- } else {
- ret = strdup(pkgid);
- if (!ret) {
- ErrPrint("Error: %d\n", errno);
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- }
- }
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-
-out:
- close_db(handle);
- return ret;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-EAPI int widget_service_get_supported_size_types(const char *pkgid, int *cnt, int **types)
+EAPI char *widget_service_get_widget_id(const char *appid)
{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int size;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!types || !cnt || !pkgid) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT size_type FROM box_size WHERE pkgid = ? ORDER BY size_type ASC", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- if (*cnt > WIDGET_NR_OF_SIZE_LIST) {
- *cnt = WIDGET_NR_OF_SIZE_LIST;
- }
-
- *types = malloc(sizeof(int) * *cnt);
-
- if (*types == NULL) {
- ErrPrint("Out of memory");
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- ret = WIDGET_ERROR_OUT_OF_MEMORY;
- goto out;
- }
-
- ret = 0;
- while (sqlite3_step(stmt) == SQLITE_ROW && ret < *cnt) {
- size = sqlite3_column_int(stmt, 0);
- (*types)[ret] = size;
- ret++;
- }
-
- *cnt = ret;
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- ret = WIDGET_ERROR_NONE;
-out:
- close_db(handle);
- return ret;
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
+ return NULL;
}
-EAPI char *widget_service_get_content_string(const char *pkgid)
+EAPI char *widget_service_get_package_id(const char *pkgname)
{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- char *content = NULL;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- handle = open_db();
- if (!handle) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT content FROM client WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
- const char *tmp;
-
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (tmp && strlen(tmp)) {
- content = strdup(tmp);
- if (!content) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- }
- } else {
- set_last_result(WIDGET_ERROR_NONE);
- }
- } else if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return content;
+ set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
+ return NULL;
}
-EAPI char *widget_service_get_app_id_of_setup_app(const char *widgetid)
+EAPI int widget_service_get_size(widget_size_type_e type, int *width, int *height)
{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret;
- char *appid;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!widgetid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT setup FROM client WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- return NULL;
- }
-
- appid = NULL;
- ret = sqlite3_bind_text(stmt, 1, widgetid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
- const char *tmp;
-
- set_last_result(WIDGET_ERROR_NONE);
-
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp)) {
- goto out;
- }
-
- appid = strdup(tmp);
- if (!appid) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Error: %d\n", errno);
- }
- } else {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return appid;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-EAPI int widget_service_get_nodisplay(const char *pkgid)
+EAPI int widget_service_get_size_type(int width, int height, widget_size_type_e *size_type)
{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return 0;
- }
-
- if (!pkgid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return 0;
- }
-
- handle = open_db();
- if (!handle) {
- return 0;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT nodisplay FROM client WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- return 0;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = 0;
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
- set_last_result(WIDGET_ERROR_NONE);
- ret = !!sqlite3_column_int(stmt, 0);
- } else {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- ret = 0;
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return ret;
+ return WIDGET_ERROR_NOT_SUPPORTED;
}
-EAPI int widget_service_get_need_of_frame(const char *pkgid, widget_size_type_e size_type, bool *need_of_frame)
-{
- char *widgetid = NULL;
- sqlite3_stmt *stmt = NULL;
- sqlite3 *handle = NULL;
- int ret = WIDGET_ERROR_NONE;
- int ret_sqlite = 0;
- int result_need_of_frame = 0;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (pkgid == NULL || need_of_frame == NULL) {
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- goto out;
- }
-
- handle = open_db();
- if (!handle) {
- ErrPrint("Unable to open a DB\n");
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret_sqlite = sqlite3_prepare_v2(handle, "SELECT need_frame FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
- if (ret_sqlite != SQLITE_OK) {
- ret = WIDGET_ERROR_FAULT;
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- widgetid = widget_service_get_widget_id(pkgid);
- if (!widgetid) {
- ErrPrint("Invalid appid (%s)\n", pkgid);
- result_need_of_frame = 0;
- goto out;
- }
-
- ret_sqlite = sqlite3_bind_text(stmt, 1, widgetid, -1, SQLITE_TRANSIENT);
- free(widgetid);
- if (ret_sqlite != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_FAULT;
- result_need_of_frame = 0;
- goto out;
- }
-
- ret_sqlite = sqlite3_bind_int(stmt, 2, size_type);
- if (ret_sqlite != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_FAULT;
- result_need_of_frame = 0;
- goto out;
- }
-
- ret_sqlite = sqlite3_step(stmt);
- if (ret_sqlite != SQLITE_ROW) {
- result_need_of_frame = 0;
- ErrPrint("There is no such result\n");
- ret = WIDGET_ERROR_NOT_EXIST;
- goto out;
- }
- result_need_of_frame = !!sqlite3_column_int(stmt, 0);
-
-out:
- if (need_of_frame)
- *need_of_frame = result_need_of_frame;
-
- if (stmt) {
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- }
-
- if (handle)
- close_db(handle);
-
- if (ret != WIDGET_ERROR_NONE)
- ErrPrint("Error: %d\n", ret);
-
- return ret;
-}
-
-EAPI int widget_service_get_need_of_touch_effect(const char *pkgid, widget_size_type_e size_type, bool *need_of_touch_event)
-{
- char *widgetid = NULL;
- sqlite3_stmt *stmt = NULL;
- sqlite3 *handle = NULL;
- int ret = WIDGET_ERROR_NONE;
- int ret_sqlite;
- int result_need_of_touch_event = 0;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (pkgid == NULL || need_of_touch_event == NULL) {
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- goto out;
- }
-
- handle = open_db();
- if (!handle) {
- ErrPrint("Unable to open a DB\n");
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret_sqlite = sqlite3_prepare_v2(handle, "SELECT touch_effect FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
- if (ret_sqlite != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_FAULT;
- goto out;
- }
-
- /**
- * @note
- * This function will validate the "pkgid"
- * call the exported API in the exported API is not recomended
- * but... I used.
- */
- widgetid = widget_service_get_widget_id(pkgid);
- if (!widgetid) {
- ErrPrint("Invalid appid (%s)\n", pkgid);
- ret = get_last_result();
- result_need_of_touch_event = 1;
- goto out;
- }
-
- ret_sqlite = sqlite3_bind_text(stmt, 1, widgetid, -1, SQLITE_TRANSIENT);
- free(widgetid);
- if (ret_sqlite != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_FAULT;
- result_need_of_touch_event = 1;
- goto out;
- }
-
- ret_sqlite = sqlite3_bind_int(stmt, 2, size_type);
- if (ret_sqlite != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_FAULT;
- result_need_of_touch_event = 1;
- goto out;
- }
-
- ret_sqlite = sqlite3_step(stmt);
- if (ret_sqlite != SQLITE_ROW) {
- result_need_of_touch_event = 1; /**< Default true: In this case the DB is corrupted. */
- ErrPrint("There is no result\n");
- ret = WIDGET_ERROR_NOT_EXIST;
- goto out;
- }
-
- result_need_of_touch_event = !!sqlite3_column_int(stmt, 0);
-
-out:
- if (need_of_touch_event)
- *need_of_touch_event = result_need_of_touch_event;
-
- if (stmt) {
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- }
-
- if (handle)
- close_db(handle);
-
- if (ret != WIDGET_ERROR_NONE)
- ErrPrint("Error: %d\n", ret);
-
- return ret;
-}
-
-EAPI int widget_service_get_need_of_mouse_event(const char *pkgid, widget_size_type_e size_type, bool *need_of_mouse_event)
-{
- sqlite3_stmt *stmt = NULL;
- sqlite3 *handle = NULL;
- char *widgetid = NULL;
- int ret_sqlite = 0;
- int ret = WIDGET_ERROR_NONE;
- int result_need_of_mouse_event = 0;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (pkgid == NULL || need_of_mouse_event == NULL) {
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- goto out;
- }
-
- if (!(handle = open_db())) {
- ErrPrint("open_db failed : %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret_sqlite = sqlite3_prepare_v2(handle, "SELECT mouse_event FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
-
- if (ret_sqlite != SQLITE_OK) {
- ErrPrint("sqlite3_prepare_v2 failed : %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_FAULT;
- goto out;
- }
-
- widgetid = widget_service_get_widget_id(pkgid);
- if (!widgetid) {
- ErrPrint("Failed to get widgetid: %s\n", pkgid);
- ret = get_last_result();
- goto out;
- }
-
- ret_sqlite = sqlite3_bind_text(stmt, 1, widgetid, -1, SQLITE_TRANSIENT);
- free(widgetid);
-
- if (ret_sqlite != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_FAULT;
- goto out;
- }
-
- ret_sqlite = sqlite3_bind_int(stmt, 2, (int)size_type);
- if (ret_sqlite != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_FAULT;
- goto out;
- }
-
- ret_sqlite = sqlite3_step(stmt);
-
- if (ret_sqlite == SQLITE_ROW) {
- result_need_of_mouse_event = !!sqlite3_column_int(stmt, 0);
- ret = WIDGET_ERROR_NONE;
- } else {
- ErrPrint("There is no result.\n");
- result_need_of_mouse_event = 0; /**< Default is false, In this case the DB is corrupted */
- ret = WIDGET_ERROR_NOT_EXIST;
- }
-
-out:
- if (need_of_mouse_event)
- *need_of_mouse_event = result_need_of_mouse_event;
-
- if (stmt) {
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- }
-
- if (handle)
- close_db(handle);
-
- if (ret != WIDGET_ERROR_NONE)
- ErrPrint("Error: %d\n", ret);
-
- return ret;
-}
-
-static char *convert_to_abspath(const char *appid, const char *tmp, const char *mid_path, int *tmp_len)
-{
- pkgmgrinfo_pkginfo_h handle;
- const char *path;
- int abspath_len;
- char *abspath = NULL;
- int ret;
-
- if (!tmp || tmp[0] == '/' || !appid) {
- return NULL;
- }
-
- ret = pkgmgrinfo_pkginfo_get_pkginfo(appid, &handle);
- if (ret != PMINFO_R_OK) {
- ErrPrint("Unable to get package info for %s\n", appid);
- return NULL;
- }
-
- ret = pkgmgrinfo_pkginfo_get_root_path(handle, (char **)&path);
- if (ret != PMINFO_R_OK) {
- ErrPrint("Unable to get path for %s\n", appid);
- goto out;
- }
-
- abspath_len = strlen(tmp) + strlen(path) + strlen(mid_path) + 1;
- abspath = malloc(abspath_len);
- if (!abspath) {
- ErrPrint("malloc: %d\n", errno);
- goto out;
- }
-
- if (snprintf(abspath, abspath_len, "%s%s%s", path, mid_path, tmp) < 0) {
- ErrPrint("snprintf: %d\n", errno);
- free(abspath);
- abspath = NULL;
- goto out;
- }
-
- if (tmp_len) {
- *tmp_len = abspath_len;
- }
-
- DbgPrint("Converted path: %s (%d)\n", abspath, abspath_len);
-out:
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- return abspath;
-}
-
-static char *get_appid(sqlite3 *handle, const char *pkgid)
-{
- sqlite3_stmt *stmt;
- int ret;
- char *appid = NULL;
-
- ret = sqlite3_prepare_v2(handle, "SELECT appid FROM pkgmap WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
- const char *tmp;
-
- set_last_result(WIDGET_ERROR_NONE);
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (tmp && strlen(tmp)) {
- appid = strdup(tmp);
- if (!appid) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- }
- }
- } else if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- return appid;
-}
-
-EAPI char *widget_service_get_preview_image_path(const char *pkgid, widget_size_type_e size_type)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret;
- char *preview = NULL;
- const char *tmp;
- char *appid;
- int tmp_len;
- int buf_len;
- register int i;
- int printed;
- char *abspath;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- handle = open_db();
- if (!handle) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT preview FROM box_size WHERE pkgid = ? AND size_type = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s, %s\n", sqlite3_errmsg(handle), pkgid);
- close_db(handle);
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s, %s\n", sqlite3_errmsg(handle), pkgid);
- goto out;
- }
-
- ret = sqlite3_bind_int(stmt, 2, (int)size_type);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s, %s\n", sqlite3_errmsg(handle), pkgid);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
- ErrPrint("Error: %s, %s\n", sqlite3_errmsg(handle), pkgid);
- goto out;
- }
-
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !(tmp_len = strlen(tmp))) {
- ErrPrint("Failed to get data (%s)\n", pkgid);
- goto out;
- }
-
- appid = get_appid(handle, pkgid);
- abspath = convert_to_abspath(appid, tmp, RESOURCE_PATH, &tmp_len);
- free(appid);
- if (!abspath) {
- abspath = strdup(tmp);
- if (!abspath) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("strdup: %d\n", errno);
- goto out;
- }
- }
-
- if (update_lang_info() != 0) {
- preview = abspath;
- if (!preview) {
- ErrPrint("Heap: %d\n", errno);
- }
- goto out;
- }
-
- buf_len = tmp_len + strlen(s_info.iso3lang) + s_info.country_len + 3; /* '/' '-' '/' */
- preview = malloc(buf_len + 1);
- if (!preview) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- free(abspath);
- goto out;
- }
-
- for (i = tmp_len; i >= 0 && abspath[i] != '/'; i--);
- i++; /* Skip '/' */
-
- strncpy(preview, abspath, i);
- printed = snprintf(preview + i, buf_len - i, "%s-%s/%s", s_info.iso3lang, s_info.country, abspath + i);
- if (preview[i + printed] != '\0') {
- ErrPrint("Path is truncated\n");
- preview[i + printed] = '\0';
- }
-
- if (access(preview, R_OK) != 0) {
- DbgPrint("Access failed: %s, %d\n", preview, errno);
- free(preview);
-
- preview = abspath;
- } else {
- free(abspath);
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return preview;
-}
-
-EAPI char *widget_service_get_icon(const char *pkgid, const char *lang)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- char *language;
- char *icon = NULL;
- char *appid;
- int ret;
- char *ret_icon;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!pkgid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (lang) {
- language = strdup(lang);
- if (!language) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- return NULL;
- }
- } else {
- language = cur_locale();
- if (!language) {
- return NULL;
- }
- }
-
- handle = open_db();
- if (!handle) {
- free(language);
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT icon FROM i18n WHERE pkgid = ? AND lang = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- free(language);
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, language, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
- const char *tmp;
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp)) {
- icon = get_default_icon(pkgid);
- } else {
- icon = strdup(tmp);
- if (!icon) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- }
- }
- } else {
- icon = get_default_icon(pkgid);
- }
-
- appid = get_appid(handle, pkgid);
- ret_icon = convert_to_abspath(appid, icon, RESOURCE_PATH, NULL);
- free(appid);
- if (ret_icon) {
- free(icon);
- icon = ret_icon;
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- free(language);
- return icon;
-}
-
-EAPI char *widget_service_get_name(const char *pkgid, const char *lang)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- char *language;
- char *name = NULL;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!pkgid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (lang) {
- language = strdup(lang);
- if (!language) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Error: %d\n", errno);
- return NULL;
- }
- } else {
- language = cur_locale();
- if (!language) {
- return NULL;
- }
- }
-
- handle = open_db();
- if (!handle) {
- free(language);
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT name FROM i18n WHERE pkgid = ? AND lang = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- free(language);
- return NULL;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, language, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
- const char *tmp;
- tmp = (const char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp)) {
- name = get_default_name(pkgid);
- } else {
- name = strdup(tmp);
- if (!name) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- }
- }
- } else {
- name = get_default_name(pkgid);
- }
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- free(language);
- return name;
-}
-
-EAPI int widget_service_get_supported_sizes(const char *pkgid, int *cnt, int **w, int **h)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int size;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!w || !h || !cnt || !pkgid || *cnt <= 0) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT size_type FROM box_size WHERE pkgid = ? ORDER BY size_type ASC", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- if (*cnt > WIDGET_NR_OF_SIZE_LIST) {
- *cnt = WIDGET_NR_OF_SIZE_LIST;
- }
-
- *w = malloc(sizeof(int) * *cnt);
- *h = malloc(sizeof(int) * *cnt);
- if (*w == NULL || *h == NULL) {
- ErrPrint("Out of memory");
- free(*w);
- free(*h);
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- ret = WIDGET_ERROR_OUT_OF_MEMORY;
- goto out;
- }
-
- ret = 0;
- while (sqlite3_step(stmt) == SQLITE_ROW && ret < *cnt) {
- size = sqlite3_column_int(stmt, 0);
- ret += (convert_size_from_type((widget_size_type_e)size, *w + ret, *h + ret) == 0);
- }
-
- *cnt = ret;
- ret = (ret > 0) ? WIDGET_ERROR_NONE : WIDGET_ERROR_NOT_EXIST;
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return ret;
-}
-
-EAPI char *widget_service_get_abi(const char *widgetid)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret;
- char *abi;
- char *tmp;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!widgetid) {
- ErrPrint("Invalid argument\n");
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- abi = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT abi FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, widgetid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
-
- ErrPrint("Error: %s (%d)\n", sqlite3_errmsg(handle), ret);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- tmp = (char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp)) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- ErrPrint("Invalid abi: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- abi = strdup(tmp);
- if (!abi) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("strdup: %d\n", errno);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- DbgPrint("abi: %s\n", abi);
-
- set_last_result(WIDGET_ERROR_NONE);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return abi;
-}
-
-EAPI char *widget_service_get_widget_id_by_libexec(const char *libexec)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret;
- char *pkgid;
- char *tmp;
- char *_libexec;
- int len;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!libexec) {
- ErrPrint("Invalid argument\n");
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- pkgid = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- len = strlen(libexec) + 3;
-
- _libexec = malloc(len);
- if (!_libexec) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- close_db(handle);
- return NULL;
- }
-
- snprintf(_libexec, len - 1, "%%%s", libexec);
-
- ret = sqlite3_prepare_v2(handle, "SELECT pkgid FROM provider WHERE libexec like ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, _libexec, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
- ErrPrint("No records (%s) for (%s)\n", sqlite3_errmsg(handle), libexec);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- set_last_result(WIDGET_ERROR_NONE);
- tmp = (char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp)) {
- ErrPrint("Invalid pkgid: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- pkgid = strdup(tmp);
- if (!pkgid) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- }
-
- DbgPrint("pkgid: %s\n", pkgid);
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- free(_libexec);
- return pkgid;
-}
-
-EAPI char *widget_service_get_libexec(const char *pkgid)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret;
- char *libexec;
- char *appid;
- char *path;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!pkgid) {
- ErrPrint("Invalid argument\n");
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- libexec = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT pkgmap.appid, provider.libexec FROM pkgmap, provider WHERE pkgmap.pkgid = ? AND provider.pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
-
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- set_last_result(WIDGET_ERROR_NONE);
- appid = (char *)sqlite3_column_text(stmt, 0);
- if (!appid || !strlen(appid)) {
- ErrPrint("Invalid appid: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- path = (char *)sqlite3_column_text(stmt, 1);
- if (!path || !strlen(path)) {
- ErrPrint("Invalid libexec: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- libexec = convert_to_abspath(appid, path, LIBEXEC_PATH, NULL);
- if (!libexec) {
- libexec = strdup(path);
- if (!libexec) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- }
- }
-
- DbgPrint("libexec: %s\n", libexec);
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return libexec;
-}
-
-EAPI char *widget_service_get_widget_id(const char *appid)
-{
- char *widget_pkgname;
- pkgmgrinfo_appinfo_h handle;
- int ret;
- char *new_appid;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!appid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- widget_pkgname = get_widget_pkgname_by_appid(appid);
- if (widget_pkgname) {
- return widget_pkgname;
- }
-
- /*!
- * \note
- * Try to get the package id using given appid
- */
- ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
- if (ret != PKGMGR_R_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Failed to get appinfo\n");
- return NULL;
- }
-
- ret = pkgmgrinfo_appinfo_get_pkgid(handle, &new_appid);
- if (ret != PKGMGR_R_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
- ErrPrint("Failed to get pkgname for (%s)\n", appid);
- return NULL;
- }
-
- widget_pkgname = get_widget_pkgname_by_appid(new_appid);
- pkgmgrinfo_appinfo_destroy_appinfo(handle);
-
- if (!widget_pkgname) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- }
-
- return widget_pkgname;
-}
-
-EAPI char *widget_service_get_package_id(const char *pkgname)
-{
- sqlite3_stmt *stmt;
- char *appid;
- char *tmp;
- sqlite3 *handle;
- int is_prime __attribute__((__unused__));
- int ret;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!pkgname) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- appid = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT appid, prime FROM pkgmap WHERE pkgid = ? OR appid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgname, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, pkgname, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- pkgmgrinfo_appinfo_h pkg_handle;
- char *new_appid;
-
- if (ret == SQLITE_DONE) {
- ErrPrint("No records: %s\n", sqlite3_errmsg(handle));
- } else {
- ErrPrint("Failed to get record: %s\n", sqlite3_errmsg(handle));
- }
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-
- ret = pkgmgrinfo_appinfo_get_appinfo(pkgname, &pkg_handle);
- if (ret != PKGMGR_R_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Failed to get appinfo: %s\n", pkgname);
- goto out;
- }
-
- ret = pkgmgrinfo_appinfo_get_pkgid(pkg_handle, &new_appid);
- if (ret != PKGMGR_R_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Failed to get pkgname for (%s)\n", appid);
- pkgmgrinfo_appinfo_destroy_appinfo(pkg_handle);
- goto out;
- }
-
- appid = strdup(new_appid);
- if (!appid) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- }
-
- pkgmgrinfo_appinfo_destroy_appinfo(pkg_handle);
- goto out;
- }
-
- tmp = (char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp)) {
- set_last_result(WIDGET_ERROR_NONE);
- ErrPrint("APPID is NIL\n");
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- appid = strdup(tmp);
- if (!appid) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- set_last_result(WIDGET_ERROR_NONE);
- is_prime = sqlite3_column_int(stmt, 1);
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return appid;
-}
-
-EAPI char *widget_service_get_provider_name(const char *widgetid)
-{
- char *ret;
- int stage = 0;
- int seq = 0;
- int idx = 0;
- char *str = WIDGET_ID_PREFIX;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!widgetid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- while (str[idx] && widgetid[idx] && widgetid[idx] == str[idx]) {
- idx++;
- if (seq < 2 && widgetid[idx] == '.') {
- stage = idx;
- seq++;
- }
- }
-
- if (!str[idx] && widgetid[idx]) {
- ret = strdup(widgetid);
- /* Inhouse */
- if (!ret) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- }
- return ret;
- } else if (seq < 2) {
- while (seq < 2) {
- if (widgetid[idx] == '.') {
- seq++;
- } else if (!widgetid[idx]) {
- ErrPrint("Invalid widgetid: %s\n", widgetid);
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- idx++;
- }
-
- stage = idx;
- } else {
- stage++;
- }
-
- ret = strdup(widgetid + stage);
- if (!ret) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Error: %d\n", errno);
- return NULL;
- }
-
- set_last_result(WIDGET_ERROR_NONE);
- return ret;
-}
-
-EAPI int widget_service_is_enabled(const char *widgetid)
-{
- if (!is_widget_feature_enabled()) {
- return 0;
- }
-
- return 1;
-}
-
-EAPI int widget_service_is_primary(const char *widgetid)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret = 0;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return 0;
- }
-
- if (!widgetid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return 0;
- }
-
- handle = open_db();
- if (!handle) {
- return 0;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT prime FROM pkgmap WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- close_db(handle);
- return 0;
- }
-
- ret = sqlite3_bind_text(stmt, 1, widgetid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_column_int(stmt, 0);
- set_last_result(WIDGET_ERROR_NONE);
-
-out:
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- close_db(handle);
- return ret;
-}
-
-EAPI char *widget_service_get_category(const char *widgetid)
-{
- sqlite3_stmt *stmt;
- char *category = NULL;
- char *tmp;
- sqlite3 *handle;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!widgetid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- category = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT category FROM pkgmap WHERE pkgid = ? OR appid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, widgetid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, widgetid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- ErrPrint("Has no record?: %s\n", sqlite3_errmsg(handle));
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Failed to retrieve record set: %s\n", sqlite3_errmsg(handle));
- }
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- set_last_result(WIDGET_ERROR_NONE);
- tmp = (char *)sqlite3_column_text(stmt, 0);
- if (!tmp || !strlen(tmp)) {
- ErrPrint("APPID is NIL\n");
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- category = strdup(tmp);
- if (!category) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return category;
-}
-
-EAPI int widget_service_get_hw_accelerated(const char *widget_id)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret = WIDGET_ERROR_FAULT;
- const char *acceleration;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!widget_id) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT hw_acceleration FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, widget_id, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- ret = WIDGET_ERROR_NOT_EXIST;
- } else {
- ret = WIDGET_ERROR_IO_ERROR;
- }
- ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- acceleration = (char *)sqlite3_column_text(stmt, 0);
- ret = (acceleration && !strcasecmp(acceleration, "use-gl"));
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-
-out:
- close_db(handle);
- return ret;
-}
-
-EAPI int widget_service_get_auto_align(const char *widget_id)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret = WIDGET_ERROR_FAULT;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!widget_id) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT auto_align FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, widget_id, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- ret = WIDGET_ERROR_NOT_EXIST;
- } else {
- ret = WIDGET_ERROR_IO_ERROR;
- }
- ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_column_int(stmt, 0);
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-
-out:
- close_db(handle);
- return ret;
-}
-
-EAPI int widget_service_get_widget_max_count(const char *widget_id)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret = WIDGET_ERROR_FAULT;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!widget_id) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT count FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
- ret = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, widget_id, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- ret = WIDGET_ERROR_NOT_EXIST;
- } else {
- ret = WIDGET_ERROR_IO_ERROR;
- }
- ErrPrint("Error: %s, widget(%s), ret(%d)\n", sqlite3_errmsg(handle), widget_id, ret);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_column_int(stmt, 0);
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-
-out:
- close_db(handle);
- return ret;
-}
-
-EAPI char *widget_service_get_widget_script_path(const char *pkgid)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret;
- char *path;
- char *appid;
- char *widget_src;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!pkgid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- path = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT pkgmap.appid, provider.box_src FROM provider, pkgmap WHERE pkgmap.pkgid = ? AND provider.pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
- ErrPrint("Error: %s, pkgid(%s), ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- appid = (char *)sqlite3_column_text(stmt, 0);
- if (!appid || !strlen(appid)) {
- set_last_result(WIDGET_ERROR_NONE);
- ErrPrint("Invalid appid : %s, pkgid(%s)\n", sqlite3_errmsg(handle), pkgid);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- widget_src = (char *)sqlite3_column_text(stmt, 1);
- if (!widget_src || !strlen(widget_src)) {
- set_last_result(WIDGET_ERROR_NONE);
- ErrPrint("No records for widget src : %s, pkgid(%s), appid(%s)\n", sqlite3_errmsg(handle), pkgid, appid);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- path = convert_to_abspath(appid, widget_src, RESOURCE_PATH, NULL);
- if (!path) {
- path = strdup(widget_src);
- if (!path) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- }
- }
-
- DbgPrint("WIDGET Src: %s\n", path);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return path;
-}
-
-EAPI char *widget_service_get_widget_script_group(const char *pkgid)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret;
- char *group;
- char *tmp;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!pkgid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- group = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT box_group FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- set_last_result(WIDGET_ERROR_NONE);
- tmp = (char *)sqlite3_column_text(stmt, 0);
- if (tmp && strlen(tmp)) {
- group = strdup(tmp);
- if (!group) {
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- ErrPrint("Heap: %d\n", errno);
- }
- }
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return group;
-}
-
-EAPI char *widget_service_get_gbar_script_path(const char *pkgid)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret;
- char *path;
- char *gbar_src;
- const char *appid;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!pkgid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- path = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT pkgmap.appid, provider.pd_src FROM provider, pkgmap WHERE provider.pkgid = ? AND pkgmap.pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 2, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- if (ret == SQLITE_DONE) {
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- } else {
- set_last_result(WIDGET_ERROR_FAULT);
- }
- ErrPrint("Error: %s pkgid(%s) ret(%d)\n", sqlite3_errmsg(handle), pkgid, ret);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- set_last_result(WIDGET_ERROR_NONE);
-
- appid = (char *)sqlite3_column_text(stmt, 0);
- if (!appid || !strlen(appid)) {
- ErrPrint("Error: %s pkgid(%s)\n", sqlite3_errmsg(handle), pkgid);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- gbar_src = (char *)sqlite3_column_text(stmt, 1);
- if (!gbar_src || !strlen(gbar_src)) {
- ErrPrint("Error: %s pkgid(%s) appid(%s)\n", sqlite3_errmsg(handle), pkgid, appid);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- path = convert_to_abspath(appid, gbar_src, RESOURCE_PATH, NULL);
- if (!path) {
- path = strdup(gbar_src);
- if (!path) {
- ErrPrint("Heap: %d\n", errno);
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- }
- }
-
- DbgPrint("GBAR Src: %s\n", path);
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return path;
-}
-
-EAPI char *widget_service_get_gbar_script_group(const char *pkgid)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- int ret;
- char *group;
- char *tmp;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!pkgid) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- group = NULL;
- handle = open_db();
- if (!handle) {
- return NULL;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT pd_group FROM provider WHERE pkgid = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- goto out;
- }
-
- ret = sqlite3_bind_text(stmt, 1, pkgid, -1, SQLITE_TRANSIENT);
- if (ret != SQLITE_OK) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_finalize(stmt);
- goto out;
- }
-
- ret = sqlite3_step(stmt);
- if (ret != SQLITE_ROW) {
- set_last_result(WIDGET_ERROR_FAULT);
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
- goto out;
- }
-
- set_last_result(WIDGET_ERROR_NONE);
- tmp = (char *)sqlite3_column_text(stmt, 0);
- if (tmp && strlen(tmp)) {
- group = strdup(tmp);
- if (!group) {
- ErrPrint("Heap: %d\n", errno);
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- }
- }
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return group;
-}
-
-EAPI int widget_service_enumerate_cluster_list(int (*cb)(const char *cluster, void *data), void *data)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- const char *cluster;
- int cnt;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!cb) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- cnt = 0;
- ret = sqlite3_prepare_v2(handle, "SELECT DISTINCT cluster FROM groupinfo", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- cnt = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- while (sqlite3_step(stmt) == SQLITE_ROW) {
- cluster = (const char *)sqlite3_column_text(stmt, 0);
- if (!cluster || !strlen(cluster)) {
- continue;
- }
-
- if (cb(cluster, data) < 0) {
- break;
- }
-
- cnt++;
- }
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return cnt;
-}
-
-EAPI int widget_service_enumerate_category_list(const char *cluster, int (*cb)(const char *cluster, const char *category, void *data), void *data)
-{
- sqlite3_stmt *stmt;
- sqlite3 *handle;
- const char *category;
- int cnt;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!cluster || !cb) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- handle = open_db();
- if (!handle) {
- return WIDGET_ERROR_IO_ERROR;
- }
-
- ret = sqlite3_prepare_v2(handle, "SELECT DISTINCT category FROM groupinfo WHERE cluster = ?", -1, &stmt, NULL);
- if (ret != SQLITE_OK) {
- ErrPrint("Error: %s\n", sqlite3_errmsg(handle));
- cnt = WIDGET_ERROR_IO_ERROR;
- goto out;
- }
-
- cnt = 0;
- while (sqlite3_step(stmt) == SQLITE_ROW) {
- category = (const char *)sqlite3_column_text(stmt, 0);
- if (!category || !strlen(category)) {
- continue;
- }
-
- if (cb(cluster, category, data) < 0) {
- break;
- }
-
- cnt++;
- }
-
- sqlite3_reset(stmt);
- sqlite3_finalize(stmt);
-out:
- close_db(handle);
- return cnt;
-}
-
-EAPI int widget_service_init(void)
-{
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (s_info.handle) {
- DbgPrint("Already initialized\n");
- s_info.init_count++;
- return WIDGET_ERROR_NONE;
- }
-
- s_info.handle = open_db();
- if (s_info.handle) {
- s_info.init_count++;
- return WIDGET_ERROR_NONE;
- }
-
- return WIDGET_ERROR_IO_ERROR;
-}
-
-EAPI int widget_service_fini(void)
-{
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!s_info.handle || s_info.init_count <= 0) {
- ErrPrint("Service is not initialized\n");
- return WIDGET_ERROR_IO_ERROR;
- }
-
- s_info.init_count--;
- if (s_info.init_count > 0) {
- DbgPrint("Init count %d\n", s_info.init_count);
- return WIDGET_ERROR_NONE;
- }
-
- db_util_close(s_info.handle);
- s_info.handle = NULL;
- return WIDGET_ERROR_NONE;
-}
-
-EAPI int widget_service_get_size(widget_size_type_e type, int *width, int *height)
-{
- int _width;
- int _height;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!width) {
- width = &_width;
- }
-
- if (!height) {
- height = &_height;
- }
-
- return convert_size_from_type(type, width, height);
-}
-
-EAPI int widget_service_get_size_type(int width, int height, widget_size_type_e *size_type)
-{
- int idx;
- int output_size_type = WIDGET_SIZE_TYPE_UNKNOWN;
- int ret = WIDGET_ERROR_NONE;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (size_type == NULL) {
- ErrPrint("WIDGET_ERROR_INVALID_PARAMETER\n");
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- goto out;
- }
-
- if (util_update_resolution(&s_info, SIZE_LIST) < 0) {
- ErrPrint("Failed to update the size list\n");
- }
-
- for (idx = 0; idx < WIDGET_NR_OF_SIZE_LIST; idx++) {
- if (SIZE_LIST[idx].w == width && SIZE_LIST[idx].h == height) {
- break;
- }
- }
-
- switch (idx) {
- case 0:
- output_size_type = WIDGET_SIZE_TYPE_1x1;
- break;
- case 1:
- output_size_type = WIDGET_SIZE_TYPE_2x1;
- break;
- case 2:
- output_size_type = WIDGET_SIZE_TYPE_2x2;
- break;
- case 3:
- output_size_type = WIDGET_SIZE_TYPE_4x1;
- break;
- case 4:
- output_size_type = WIDGET_SIZE_TYPE_4x2;
- break;
- case 5:
- output_size_type = WIDGET_SIZE_TYPE_4x3;
- break;
- case 6:
- output_size_type = WIDGET_SIZE_TYPE_4x4;
- break;
- case 7:
- output_size_type = WIDGET_SIZE_TYPE_4x5;
- break;
- case 8:
- output_size_type = WIDGET_SIZE_TYPE_4x6;
- break;
- case 9:
- output_size_type = WIDGET_SIZE_TYPE_EASY_1x1;
- break;
- case 10:
- output_size_type = WIDGET_SIZE_TYPE_EASY_3x1;
- break;
- case 11:
- output_size_type = WIDGET_SIZE_TYPE_EASY_3x3;
- break;
- case 12:
- output_size_type = WIDGET_SIZE_TYPE_FULL;
- break;
- default:
- ret = WIDGET_ERROR_INVALID_PARAMETER;
- break;
- }
-
-out:
- if (size_type)
- *size_type = output_size_type;
-
- return ret;
-}
-
-EAPI widget_lock_info_t widget_service_create_lock(const char *uri, widget_target_type_e type, widget_lock_type_e option)
-{
- widget_lock_info_t info;
- int len;
- int flags;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- info = malloc(sizeof(*info));
- if (!info) {
- ErrPrint("malloc: %d\n", errno);
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- return NULL;
- }
-
- len = strlen(uri);
- info->filename = malloc(len + 20);
- if (!info->filename) {
- ErrPrint("malloc: %d\n", errno);
- free(info);
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- return NULL;
- }
-
- len = snprintf(info->filename, len + 20, "%s.%s.lck", widget_util_uri_to_path(uri), type == WIDGET_TYPE_GBAR ? "gbar" : "widget");
- if (len < 0) {
- ErrPrint("snprintf: %d\n", errno);
- free(info->filename);
- free(info);
- set_last_result(WIDGET_ERROR_FAULT);
- return NULL;
- }
-
- if (option == WIDGET_LOCK_WRITE) {
- /**
- * @note
- * Try to open a file for writing.
- * if the file is not exists, this will fails.
- * Then open it again with O_WRONLY | O_CREAT | O_EXCL flags and 0666 mode.
- */
- flags = O_WRONLY;
- info->fd = open(info->filename, flags);
- if (info->fd < 0) {
- if (errno == ENOENT) {
- mode_t old_mask;
- DbgPrint("Create a file named [%s]\n", info->filename);
- /**
- * @note
- * Try to open a file again with 0666 with creation flags
- */
- flags = O_WRONLY | O_CREAT | O_EXCL;
- old_mask = umask(0);
- info->fd = open(info->filename, flags, 0666);
- umask(old_mask);
- }
- }
- } else if (option == WIDGET_LOCK_READ) {
- flags = O_RDONLY;
- info->fd = open(info->filename, flags);
- } else {
- ErrPrint("Invalid paramter\n");
- free(info->filename);
- free(info);
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- info->type = option;
- if (info->fd < 0) {
- ErrPrint("open: %d\n", errno);
- free(info->filename);
- free(info);
- set_last_result(WIDGET_ERROR_IO_ERROR);
- return NULL;
- }
-
- if (fchmod(info->fd, 0666) < 0) {
- ErrPrint("fchmod: %d\n", errno);
- }
-
- info->state = LOCK_CREATED;
- return info;
-}
-
-EAPI int widget_service_destroy_lock(widget_lock_info_t info, int del)
-{
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!info || info->state != LOCK_CREATED || !info->filename || info->fd < 0) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (close(info->fd) < 0) {
- ErrPrint("close: %d\n", errno);
- return WIDGET_ERROR_IO_ERROR;
- }
-
- if ((!!del) == 1 && unlink(info->filename) < 0) {
- ErrPrint("unlink: %d\n", errno);
- }
-
- info->state = LOCK_DESTROYED;
- free(info->filename);
- free(info);
- return WIDGET_ERROR_NONE;
-}
-
-EAPI int widget_service_acquire_lock(widget_lock_info_t info)
-{
- struct flock flock;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!info || info->state != LOCK_CREATED || info->fd < 0) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (info->type == WIDGET_LOCK_WRITE) {
- flock.l_type = F_WRLCK;
- } else if (info->type == WIDGET_LOCK_READ) {
- flock.l_type = F_RDLCK;
- }
- flock.l_whence = SEEK_SET;
- flock.l_start = 0;
- flock.l_len = 0;
- flock.l_pid = getpid();
-
- do {
- ret = fcntl(info->fd, F_SETLKW, &flock);
- if (ret < 0) {
- ret = errno;
- ErrPrint("fcntl: %d\n", errno);
- }
- } while (ret == EINTR);
-
- return WIDGET_ERROR_NONE;
-}
-
-EAPI int widget_service_release_lock(widget_lock_info_t info)
-{
- struct flock flock;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!info || info->state != LOCK_CREATED || info->fd < 0) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- flock.l_type = F_UNLCK;
- flock.l_whence = SEEK_SET;
- flock.l_start = 0;
- flock.l_len = 0;
- flock.l_pid = getpid();
-
- do {
- ret = fcntl(info->fd, F_SETLKW, &flock);
- if (ret < 0) {
- ret = errno;
- ErrPrint("fcntl: %d\n", errno);
- }
- } while (ret == EINTR);
-
- return WIDGET_ERROR_NONE;
-}
-
-EAPI char *widget_service_get_base_file_path(const char *widget_id)
-{
- pkgmgrinfo_pkginfo_h handle;
- char *ret;
- int status;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (!widget_id) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- /**
- * Validate caller
- */
- ret = widget_service_get_abi(widget_id);
- if (!ret) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- ErrPrint("Failed to get ABI: %s\n", widget_id);
- return NULL;
- }
-
- status = !strcasecmp(ret, WIDGET_CONF_DEFAULT_ABI);
- free(ret);
- if (status != 1) {
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- ErrPrint("Inhouse widget only be able to use this\n");
- return NULL;
- }
-
- /**
- * Get the package Id
- */
- ret = widget_service_get_package_id(widget_id);
- if (!ret) {
- ErrPrint("Failed to get the appid using widget_id: %s\n", widget_id);
- set_last_result(WIDGET_ERROR_NOT_EXIST);
- return NULL;
- }
-
- status = pkgmgrinfo_pkginfo_get_pkginfo(ret, &handle);
- free(ret);
- if (status != PMINFO_R_OK) {
- ErrPrint("Unable to get mainapp: %s\n", widget_id);
- set_last_result(WIDGET_ERROR_FAULT);
- return NULL;
- }
-
- ret = NULL;
- if (pkgmgrinfo_pkginfo_get_root_path(handle, &ret) == PMINFO_R_OK) {
- if (ret) {
- ret = strdup(ret);
- if (!ret) {
- ErrPrint("strdup: %d\n", errno);
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- } else {
- set_last_result(WIDGET_ERROR_NONE);
- }
- }
- } else {
- ErrPrint("Failed to get root path for %s\n", widget_id);
- ret = NULL; /* I cannot believe the pkgmgrinfo_pkginfo_get_mainappid. it maybe able to touch my "ret" even though it fails */
- set_last_result(WIDGET_ERROR_FAULT);
- }
-
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- return ret;
-}
-
-EAPI widget_resource_lock_t widget_service_create_resource_lock(unsigned int pixmap, widget_lock_type_e type)
-{
- widget_resource_lock_t handle;
- char fname[64];
- int flags;
-
- if (!is_widget_feature_enabled()) {
- set_last_result(WIDGET_ERROR_NOT_SUPPORTED);
- return NULL;
- }
-
- if (pixmap == 0u) {
- ErrPrint("Invalid resource\n");
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- handle = malloc(sizeof(*handle));
- if (!handle) {
- ErrPrint("malloc: %d\n", errno);
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- return NULL;
- }
-
- snprintf(fname, sizeof(fname) - 1, LOCK_PATH_PREFIX ".%u", pixmap);
-
- if (type == WIDGET_LOCK_WRITE) {
- /**
- * @note
- * Try to open a file for writing.
- * if the file is not exists, this will fails.
- * Then open it again with O_WRONLY | O_CREAT | O_EXCL flags and 0666 mode.
- */
- flags = O_WRONLY;
- handle->fd = open(fname, flags);
- if (handle->fd < 0) {
- if (errno == ENOENT) {
- mode_t old_mask;
- DbgPrint("Create a file named [%s]\n", fname);
- /**
- * @note
- * Try to open a file again with 0666 with creation flags
- */
- flags = O_WRONLY | O_CREAT | O_EXCL;
- old_mask = umask(0);
- handle->fd = open(fname, flags, 0666);
- umask(old_mask);
- }
- }
- } else if (type == WIDGET_LOCK_READ) {
- flags = O_RDONLY;
- handle->fd = open(fname, flags);
- } else {
- ErrPrint("Invalid paramter\n");
- free(handle);
- set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
- return NULL;
- }
-
- if (handle->fd < 0) {
- ErrPrint("Failed to open a file %s: %d\n", fname, errno);
- free(handle);
- set_last_result(WIDGET_ERROR_IO_ERROR);
- return NULL;
- }
-
- handle->fname = strdup(fname);
- if (!handle->fname) {
- ErrPrint("strdup: %d\n", errno);
- if (close(handle->fd) < 0) {
- ErrPrint("close: %d\n", errno);
- }
- free(handle);
- handle = NULL;
- set_last_result(WIDGET_ERROR_OUT_OF_MEMORY);
- } else {
- handle->resource_id = pixmap;
- handle->lock_type = type;
- }
-
- return handle;
-}
-
-EAPI int widget_service_destroy_resource_lock(widget_resource_lock_t handle, int del)
-{
- if (!handle) {
- ErrPrint("Invalid handle\n");
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (close(handle->fd) < 0) {
- ErrPrint("close: %d\n", errno);
- }
-
- if ((!!del) == 1 && unlink(handle->fname) < 0) {
- ErrPrint("unlink: %d\n", errno);
- }
-
- free(handle->fname);
- free(handle);
-
- return WIDGET_ERROR_NONE;
-}
-
-EAPI int widget_service_acquire_resource_lock(widget_resource_lock_t info)
-{
- struct flock flock;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!info) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- if (info->lock_type == WIDGET_LOCK_WRITE) {
- flock.l_type = F_WRLCK;
- } else if (info->lock_type == WIDGET_LOCK_READ) {
- flock.l_type = F_RDLCK;
- }
- flock.l_whence = SEEK_SET;
- flock.l_start = 0;
- flock.l_len = 0;
- flock.l_pid = getpid();
-
- do {
- ret = fcntl(info->fd, F_SETLKW, &flock);
- if (ret < 0) {
- ret = errno;
- ErrPrint("fcntl: %d\n", errno);
- }
- } while (ret == EINTR);
-
- return WIDGET_ERROR_NONE;
-}
-
-EAPI int widget_service_release_resource_lock(widget_resource_lock_t info)
-{
- struct flock flock;
- int ret;
-
- if (!is_widget_feature_enabled()) {
- return WIDGET_ERROR_NOT_SUPPORTED;
- }
-
- if (!info) {
- return WIDGET_ERROR_INVALID_PARAMETER;
- }
-
- flock.l_type = F_UNLCK;
- flock.l_whence = SEEK_SET;
- flock.l_start = 0;
- flock.l_len = 0;
- flock.l_pid = getpid();
-
- do {
- ret = fcntl(info->fd, F_SETLKW, &flock);
- if (ret < 0) {
- ret = errno;
- ErrPrint("fcntl: %d\n", errno);
- }
- } while (ret == EINTR);
-
- return WIDGET_ERROR_NONE;
-}
-
-EAPI unsigned int widget_service_get_resource_lock_resource(widget_resource_lock_t info)
-{
- if (!is_widget_feature_enabled()) {
- return 0u;
- }
-
- if (!info) {
- return 0u;
- }
-
- return info->resource_id;
-}
/* End of a file */