From c1659bd289c2e7c63e4a686f749385e64614796e Mon Sep 17 00:00:00 2001 From: xiaowei guan Date: Fri, 27 Nov 2020 18:15:15 +0800 Subject: [PATCH 1/2] Exit application method can be replaced by 'ui_app_exit' The function 'exit(EXIT_SUCCESS)' terminaters the calling process immediately. The better way to exit process is on the main thread, app can save current status before exit app. if call 'ui_app_exit' will call terminate callback on main thread, app can save current status on terminate callback before exit app. --- shell/platform/tizen/BUILD.gn | 2 ++ shell/platform/tizen/channels/platform_channel.cc | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/shell/platform/tizen/BUILD.gn b/shell/platform/tizen/BUILD.gn index b285f11b2260e..62e4603bfc525 100644 --- a/shell/platform/tizen/BUILD.gn +++ b/shell/platform/tizen/BUILD.gn @@ -63,6 +63,7 @@ source_set("flutter_tizen") { include_dirs = [ "//third_party/tizen_tools/sysroot/$target_cpu/usr/include", + "//third_party/tizen_tools/sysroot/$target_cpu/usr/include/appfw", "//third_party/tizen_tools/sysroot/$target_cpu/usr/include/base", "//third_party/tizen_tools/sysroot/$target_cpu/usr/include/dlog", "//third_party/tizen_tools/sysroot/$target_cpu/usr/include/ecore-1", @@ -89,6 +90,7 @@ source_set("flutter_tizen") { libs = [ "base-utils-i18n", + "capi-appfw-application", "capi-system-info", "capi-system-system-settings", "dlog", diff --git a/shell/platform/tizen/channels/platform_channel.cc b/shell/platform/tizen/channels/platform_channel.cc index 65de673403c0e..254d35967092a 100644 --- a/shell/platform/tizen/channels/platform_channel.cc +++ b/shell/platform/tizen/channels/platform_channel.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include #include "platform_channel.h" #include "flutter/shell/platform/common/cpp/json_method_codec.h" @@ -28,7 +29,7 @@ void PlatformChannel::HandleMethodCall( const auto method = call.method_name(); if (method == "SystemNavigator.pop") { - exit(EXIT_SUCCESS); + ui_app_exit(); result->Success(); } else if (method == "SystemSound.play") { result->NotImplemented(); From 995c11034975dd39881d94945059d48ace251ffa Mon Sep 17 00:00:00 2001 From: xiaowei guan Date: Sat, 28 Nov 2020 02:04:16 +0800 Subject: [PATCH 2/2] Code format for platform_channel.cc --- shell/platform/tizen/channels/platform_channel.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/platform/tizen/channels/platform_channel.cc b/shell/platform/tizen/channels/platform_channel.cc index 254d35967092a..0ec2e0c13017a 100644 --- a/shell/platform/tizen/channels/platform_channel.cc +++ b/shell/platform/tizen/channels/platform_channel.cc @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include #include "platform_channel.h" +#include + #include "flutter/shell/platform/common/cpp/json_method_codec.h" #include "flutter/shell/platform/tizen/logger.h"