Skip to content

Commit eec4e15

Browse files
committed
Code clean-up && Apply review's comment
Signed-off-by: MuHong Byun <[email protected]>
1 parent 1402c64 commit eec4e15

13 files changed

+208
-193
lines changed

shell/platform/tizen/BUILD.gn

+34-16
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ _public_headers = [
6969
# builder, we have to add them manually.
7070
config("tizen_rootstrap_include_dirs") {
7171
local_prefix = "$custom_sysroot/usr"
72-
include_dirs = []
72+
7373
if (enable_desktop_embeddings) {
74-
local_prefix = "$custom_sysroot/usr/local"
7574
defines = [ "__X64_SHELL__" ]
76-
include_dirs += [ local_prefix + "/include/eldbus-1" ]
75+
local_prefix += "/local"
7776
}
78-
include_dirs += [
77+
78+
include_dirs = [
7979
local_prefix + "/include",
8080
local_prefix + "/include/appfw",
8181
local_prefix + "/include/base",
@@ -95,8 +95,10 @@ config("tizen_rootstrap_include_dirs") {
9595
local_prefix + "/include/feedback",
9696
local_prefix + "/include/system",
9797
local_prefix + "/include/wayland-extension",
98+
]
9899

99-
# For Evas_GL.
100+
# Contain headers that the Evas_GL renderer depends on.
101+
include_dirs += [
100102
local_prefix + "/include/ecore-con-1",
101103
local_prefix + "/include/ecore-file-1",
102104
local_prefix + "/include/edje-1",
@@ -108,6 +110,11 @@ config("tizen_rootstrap_include_dirs") {
108110
local_prefix + "/include/ethumb-client-1",
109111
local_prefix + "/include/evas-1",
110112
]
113+
114+
if (enable_desktop_embeddings) {
115+
include_dirs += [ local_prefix + "/include/eldbus-1" ]
116+
}
117+
111118
lib_dirs = [ local_prefix + "/lib" ]
112119
}
113120

@@ -127,7 +134,9 @@ template("embedder_for_profile") {
127134
public = _public_headers
128135

129136
sources = _flutter_tizen_source
137+
130138
libs = _libs_minimum
139+
131140
if (!enable_desktop_embeddings) {
132141
libs += [
133142
"base-utils-i18n",
@@ -146,17 +155,7 @@ template("embedder_for_profile") {
146155

147156
defines = invoker.defines
148157

149-
if (use_evas_gl_renderer) {
150-
sources += [ "tizen_renderer_evas_gl.cc" ]
151-
152-
libs += [
153-
"ecore_evas",
154-
"elementary",
155-
"evas",
156-
]
157-
158-
defines += [ "TIZEN_RENDERER_EVAS_GL" ]
159-
} else if (enable_desktop_embeddings) {
158+
if (use_evas_gl_renderer || enable_desktop_embeddings) {
160159
sources += [ "tizen_renderer_evas_gl.cc" ]
161160

162161
libs += [
@@ -171,6 +170,7 @@ template("embedder_for_profile") {
171170
"tizen_renderer_ecore_wl2.cc",
172171
"tizen_vsync_waiter.cc",
173172
]
173+
174174
if (!enable_desktop_embeddings) {
175175
libs += [ "ecore_wl2" ]
176176
}
@@ -197,6 +197,7 @@ template("embedder_for_profile") {
197197
"//flutter/shell/platform/common/client_wrapper:client_wrapper",
198198
"//third_party/rapidjson",
199199
]
200+
200201
if (enable_desktop_embeddings) {
201202
deps +=
202203
[ "//flutter/shell/platform/embedder:embedder_as_internal_library" ]
@@ -228,21 +229,27 @@ test_fixtures("flutter_tizen_fixtures") {
228229

229230
executable("flutter_tizen_unittests") {
230231
testonly = true
232+
231233
public = _public_headers
234+
232235
sources = _flutter_tizen_source
236+
233237
sources += [
234238
"flutter_tizen_engine_test.cc",
235239
"testing/mock_engine.cc",
236240
"tizen_renderer_evas_gl.cc",
237241
]
242+
238243
libs = _libs_minimum
244+
239245
libs += [
240246
"ecore_evas",
241247
"elementary",
242248
"evas",
243249
]
244250

245251
defines = [ "TIZEN_RENDERER_EVAS_GL" ]
252+
246253
cflags_cc = [
247254
"-Wno-newline-eof",
248255
"-Wno-macro-redefined",
@@ -254,7 +261,9 @@ executable("flutter_tizen_unittests") {
254261
":tizen_rootstrap_include_dirs",
255262
"//flutter/shell/platform/common:desktop_library_implementation",
256263
]
264+
257265
public_deps = [ "//third_party/googletest:gtest" ]
266+
258267
deps = [
259268
":flutter_tizen_fixtures",
260269
"//flutter/runtime:libdart",
@@ -271,28 +280,37 @@ executable("flutter_tizen_unittests") {
271280

272281
executable("flutter_tizen_shell") {
273282
public = _public_headers
283+
274284
sources = _flutter_tizen_source
285+
275286
sources += [ "tizen_renderer_evas_gl.cc" ]
287+
276288
sources += [ "flutter_tizen_shell.cc" ]
289+
277290
libs = _libs_minimum
291+
278292
libs += [
279293
"ecore_evas",
280294
"elementary",
281295
"evas",
282296
]
283297

284298
defines = [ "TIZEN_RENDERER_EVAS_GL" ]
299+
285300
cflags_cc = [
286301
"-Wno-newline-eof",
287302
"-Wno-macro-redefined",
288303
]
289304

290305
public_configs = [ "//flutter:config" ]
306+
291307
configs += [
292308
":tizen_rootstrap_include_dirs",
293309
"//flutter/shell/platform/common:desktop_library_implementation",
294310
]
311+
295312
public_deps = [ ":flutter_engine" ]
313+
296314
deps = [
297315
"//flutter/runtime:libdart",
298316
"//flutter/shell/platform/common:common_cpp",

shell/platform/tizen/channels/localization_channel.cc

+51-33
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,57 @@
44

55
#include "localization_channel.h"
66
#ifndef __X64_SHELL__
7-
87
#include <utils_i18n.h>
8+
#else
9+
typedef enum {
10+
I18N_ERROR_NONE, /**< No error, no warning */
11+
I18N_ERROR_NOT_SUPPORTED,
12+
} i18n_error_code_e;
13+
14+
int i18n_ulocale_set_default(const char* locale_id) {
15+
return I18N_ERROR_NONE;
16+
}
17+
18+
int i18n_ulocale_get_default(const char** locale) {
19+
*locale = "en_US.UTF-8";
20+
return I18N_ERROR_NONE;
21+
}
22+
23+
int i18n_ulocale_get_language(const char* locale_id,
24+
char* language,
25+
int32_t language_capacity,
26+
int32_t* buf_size_language) {
27+
return I18N_ERROR_NOT_SUPPORTED;
28+
}
29+
30+
const char* i18n_ulocale_get_available(int32_t n) {
31+
return "en_US.UTF-8";
32+
}
33+
34+
int32_t i18n_ulocale_get_country(const char* locale_id,
35+
char* country,
36+
int32_t country_capacity,
37+
int* error) {
38+
return 0;
39+
}
40+
41+
int32_t i18n_ulocale_count_available(void) {
42+
return 0;
43+
}
44+
45+
int32_t i18n_ulocale_get_script(const char* locale_id,
46+
char* script,
47+
int32_t script_capacity) {
48+
return 0;
49+
}
50+
51+
int32_t i18n_ulocale_get_variant(const char* locale_id,
52+
char* variant,
53+
int32_t variant_capacity) {
54+
return 0;
55+
}
56+
57+
#endif
958
#include <vector>
1059

1160
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h"
@@ -148,7 +197,7 @@ FlutterLocale* LocalizationChannel::GetFlutterLocale(const char* locale) {
148197
country[bufSize] = '\0';
149198
}
150199

151-
// set script code, script code is an optional field
200+
// set script code, script code ./unis an optional field
152201
bufSize = i18n_ulocale_get_script(locale, buffer, capacity);
153202
if (bufSize > 0) {
154203
script = new char[bufSize + 1];
@@ -201,34 +250,3 @@ void LocalizationChannel::DestroyFlutterLocale(FlutterLocale* flutter_locale) {
201250
}
202251
}
203252
} // namespace flutter
204-
#else
205-
#include <vector>
206-
207-
#include "flutter/shell/platform/tizen/flutter_tizen_engine.h"
208-
#include "flutter/shell/platform/tizen/tizen_log.h"
209-
#include "rapidjson/document.h"
210-
#include "rapidjson/writer.h"
211-
212-
namespace flutter {
213-
LocalizationChannel::LocalizationChannel(FlutterTizenEngine* engine)
214-
: engine_(engine) {
215-
if (!engine_) {
216-
engine_ = nullptr;
217-
}
218-
}
219-
220-
LocalizationChannel::~LocalizationChannel() {}
221-
222-
void LocalizationChannel::SendLocales() {}
223-
224-
void LocalizationChannel::SendPlatformResolvedLocale() {}
225-
226-
FlutterLocale* LocalizationChannel::GetFlutterLocale(const char* locale) {
227-
FlutterLocale* flutter_locale = new FlutterLocale;
228-
flutter_locale->struct_size = sizeof(FlutterLocale);
229-
return flutter_locale;
230-
}
231-
232-
void LocalizationChannel::DestroyFlutterLocale(FlutterLocale* flutter_locale) {}
233-
} // namespace flutter
234-
#endif

shell/platform/tizen/channels/platform_channel.cc

+57-41
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,66 @@
33
// found in the LICENSE file.
44

55
#include "platform_channel.h"
6-
#ifndef __X64_SHELL__
76

7+
#ifndef __X64_SHELL__
88
#include <app.h>
99
#include <feedback.h>
10+
#else
11+
12+
namespace {
13+
14+
typedef enum {
15+
FEEDBACK_PATTERN_NONE = -1,
16+
FEEDBACK_PATTERN_TAP = 0, /**< Feedback pattern when general touch */
17+
FEEDBACK_PATTERN_SIP, /**< Feedback pattern when touch text key */
18+
FEEDBACK_PATTERN_GENERAL =
19+
33, /**< Feedback pattern when alert general event */
20+
FEEDBACK_PATTERN_VIBRATION_ON =
21+
55, /**< Feedback pattern when turn on vibration mode */
22+
FEEDBACK_PATTERN_SILENT_OFF, /**< Feedback pattern when turn off silent mode
23+
*/
24+
} feedback_pattern_e;
25+
26+
typedef enum {
27+
FEEDBACK_TYPE_NONE, /**< Feedback type none */
28+
FEEDBACK_TYPE_SOUND, /**< Feedback type for sound */
29+
30+
FEEDBACK_TYPE_VIBRATION, /**< Feedback type for vibration */
31+
FEEDBACK_TYPE_END,
32+
} feedback_type_e;
33+
34+
typedef enum {
35+
FEEDBACK_ERROR_NONE, /**< Successful */
36+
FEEDBACK_ERROR_OPERATION_FAILED, /**< Operation failed */
37+
38+
FEEDBACK_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
39+
FEEDBACK_ERROR_NOT_SUPPORTED, /**< Not supported in this device */
40+
FEEDBACK_ERROR_PERMISSION_DENIED, /**< Permission denied */
41+
FEEDBACK_ERROR_NOT_INITIALIZED, /**< Not initialized */
42+
} feedback_error_e;
43+
44+
int feedback_initialize(void) {
45+
return 0;
46+
}
47+
48+
int feedback_play_type(feedback_type_e type, feedback_pattern_e pattern) {
49+
return 0;
50+
}
51+
52+
int feedback_deinitialize(void) {
53+
return 0;
54+
}
55+
56+
void ui_app_exit(void) {
57+
exit(0);
58+
}
59+
60+
char* get_error_message(int err_code) {
61+
return (char*)"NOT SUPPORTED";
62+
}
63+
64+
}; // namespace
65+
#endif
1066

1167
#include <map>
1268

@@ -337,43 +393,3 @@ void SetData(const MethodCall<rapidjson::Document>& call,
337393
} // namespace clipboard
338394

339395
} // namespace flutter
340-
341-
#else
342-
#include <map>
343-
344-
#include "flutter/shell/platform/common/json_method_codec.h"
345-
#include "flutter/shell/platform/tizen/tizen_log.h"
346-
347-
namespace flutter {
348-
349-
namespace {
350-
constexpr char kChannelName[] = "flutter/platform";
351-
}
352-
353-
PlatformChannel::PlatformChannel(BinaryMessenger* messenger,
354-
TizenRenderer* renderer)
355-
: channel_(std::make_unique<MethodChannel<rapidjson::Document>>(
356-
messenger,
357-
kChannelName,
358-
&JsonMethodCodec::GetInstance())),
359-
renderer_(renderer) {
360-
channel_->SetMethodCallHandler(
361-
[this](const MethodCall<rapidjson::Document>& call,
362-
std::unique_ptr<MethodResult<rapidjson::Document>> result) {
363-
HandleMethodCall(call, std::move(result));
364-
});
365-
}
366-
367-
PlatformChannel::~PlatformChannel() {
368-
if (renderer_) {
369-
renderer_ = nullptr;
370-
}
371-
}
372-
373-
void PlatformChannel::HandleMethodCall(
374-
const MethodCall<rapidjson::Document>& call,
375-
std::unique_ptr<MethodResult<rapidjson::Document>> result) {
376-
result->NotImplemented();
377-
}
378-
} // namespace flutter
379-
#endif

0 commit comments

Comments
 (0)