%define sys_assert on
+%define crash_popup off
+
+%if "%{?profile}" == "mobile"
+%define crash_popup on
+%endif
+
+%if "%{?profile}" == "wearable"
+%define crash_popup on
+%endif
+
Name: crash-worker
Summary: Crash-manager
Requires(post): gzip
Requires: libebl
Requires: libunwind
+%if %{?crash_popup} == on
+Requires: /usr/bin/dbus-send
+%endif
%description
crash-manager
-DCRASH_TEMP=%{crash_temp} \
-DCRASH_PIPE_PATH=%{_libexecdir}/crash-pipe \
-DCRASH_STACK_PATH=%{_libexecdir}/crash-stack \
+ -DCRASH_POPUP=%{crash_popup} \
-DSYS_ASSERT=%{sys_assert}
make %{?jobs:-j%jobs}
@CRASH_PIPE_PATH@ --report "$@" > "$info_path"
@CRASH_STACK_PATH@ --pid "$pid" >> "$info_path"
fi
+
+if [ "@CRASH_POPUP@" = "on" ]
+then
+#Find the full path of executable. The path is used to find appid in the crash-popup
+ exepath=" "
+ found=0
+ while read line
+ do
+ if [ $found -eq 1 ]
+ then
+ exepath=$(echo $line | sed "s/0: //")
+ break
+ fi
+
+ if [ "$line" = "Cmdline:" ]
+ then
+ found=1
+ fi
+
+ done < $info_path
+
+#Call dbus method to launch the crash-popup
+ /usr/bin/dbus-send --system --type=method_call --print-reply --reply-timeout=120000 --dest=org.tizen.system.popup /Org/Tizen/System/Popup/Crash org.tizen.system.popup.Crash.PopupLaunch dict:string:string:"_SYSPOPUP_CONTENT_","crash","_PROCESS_NAME_","${cmd}","_EXEPATH_","${exepath}"
+
+fi
+
dump_systemstate -d -k -f "$log_path" || true
tar czf "${temp_dir}/report.tar.gz" -C "$temp_dir" "$name"