Skip to content

Commit 3940df3

Browse files
committed
Call system_setting_get_* before calling system_setting_set_change_cb
Based on BT, two issues can be expected. First, a problem could occur in vconf when calling the setting getter while the system is not fully initialized. Alternatively, a deadlock could occur on the same conf when calling the setting getter after registering the changed callback. Since this issue did not occur after a reboot or subsequent routines, it is likely a timing issue due to the callback rather than an initialization issue. Therefore, the problem can be prevented by calling the setting getter before registering the changed callback. ``` crash dump (gdb) bt #0 0x0000ffff94a13524 in __GI___poll (fds=0xfffff49d3830, nfds=1, timeout=<optimized out>) at ../sysdeps/unix/sysv/linux/poll.c:41 #1 0x0000ffff938f44e8 in ?? () from /lib64/libbuxton2.so.1 flutter-tizen#2 0x0000ffff938f6ac0 in buxton_get_value_sync () from /lib64/libbuxton2.so.1 flutter-tizen#3 0x0000ffff93703af8 in ?? () from /lib64/libvconf.so.0 flutter-tizen#4 0x0000ffff937052c4 in vconf_get_int () from /lib64/libvconf.so.0 flutter-tizen#5 0x0000ffff8c1b9604 in ?? () from /lib64/libcapi-system-system-settings.so.0 flutter-tizen#6 0x0000ffff8c1b390c in system_settings_get_value_int () from /lib64/libcapi-system-system-settings.so.0 flutter-tizen#7 0x0000ffff8c2ec3d0 in ?? () from /usr/apps/org.tizen.homescreen/bin/../lib/libflutter_tizen_common.so flutter-tizen#8 0x0000ffff8c2ec330 in ?? () from /usr/apps/org.tizen.homescreen/bin/../lib/libflutter_tizen_common.so flutter-tizen#9 0x0000ffff8c2f538c in ?? () from /usr/apps/org.tizen.homescreen/bin/../lib/libflutter_tizen_common.so flutter-tizen#10 0x0000ffff8c2f3d70 in FlutterDesktopViewCreateFromNewWindow () from /usr/apps/org.tizen.homescreen/bin/../lib/libflutter_tizen_common.so flutter-tizen#11 0x0000ffff94fd8ff4 in ?? () from /usr/apps/org.tizen.homescreen/bin/runner flutter-tizen#12 0x0000ffff94fd8df0 in ?? () from /usr/apps/org.tizen.homescreen/bin/runner flutter-tizen#13 0x0000ffff918b3df8 in ?? () from /usr/lib64/libcapi-appfw-application.so.0 flutter-tizen#14 0x0000ffff919efc6c in tizen_cpp::AppCoreBase::Init(int, char**) () from /lib64/libapp-core-cpp.so.1 flutter-tizen#15 0x0000ffff919efd24 in tizen_cpp::AppCoreBase::Run(int, char**) () from /lib64/libapp-core-cpp.so.1 flutter-tizen#16 0x0000ffff91a34bdc in tizen_cpp::AppCoreUiBase::DoRun(int, char**) () from /lib64/libapp-core-ui-cpp.so.1 flutter-tizen#17 0x0000ffff91a34f4c in tizen_cpp::AppCoreUiBase::Impl::Run(int, char**) () from /lib64/libapp-core-ui-cpp.so.1 flutter-tizen#18 0x0000ffff918b3fa8 in ui_app_main () from /usr/lib64/libcapi-appfw-application.so.0 flutter-tizen#19 0x0000ffff94fd93a0 in ?? () from /usr/apps/org.tizen.homescreen/bin/runner flutter-tizen#20 0x0000ffff94fd8a8c in main () from /usr/apps/org.tizen.homescreen/bin/runner flutter-tizen#21 0x0000aaaae7065bac in launchpad::loader::LaunchpadLoader::OnTerminate(int, char**) () flutter-tizen#22 0x0000ffff94e2a030 in launchpad_loader_main () from /lib64/liblaunchpad.so.0 flutter-tizen#23 0x0000aaaae7063b58 in launchpad::loader::LaunchpadLoader::Run() () flutter-tizen#24 0x0000aaaae7063500 in main () ```
1 parent 8d36c27 commit 3940df3

2 files changed

Lines changed: 28 additions & 15 deletions

File tree

flutter/shell/platform/tizen/channels/settings_channel.cc

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,26 @@ SettingsChannel::SettingsChannel(BinaryMessenger* messenger)
2525
messenger,
2626
kChannelName,
2727
&JsonMessageCodec::GetInstance())) {
28+
SetUpLocaleTimeFormat();
29+
SetUpTextScaleFactor();
30+
SendSettingsEvent();
31+
2832
system_settings_set_changed_cb(
2933
SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR,
3034
[](system_settings_key_e key, void* user_data) -> void {
3135
auto* self = static_cast<SettingsChannel*>(user_data);
36+
self->SetUpLocaleTimeFormat();
3237
self->SendSettingsEvent();
3338
},
3439
this);
3540
system_settings_set_changed_cb(
3641
SYSTEM_SETTINGS_KEY_FONT_SIZE,
3742
[](system_settings_key_e key, void* user_data) -> void {
3843
auto* self = static_cast<SettingsChannel*>(user_data);
44+
self->SetUpTextScaleFactor();
3945
self->SendSettingsEvent();
4046
},
4147
this);
42-
SendSettingsEvent();
4348
}
4449

4550
SettingsChannel::~SettingsChannel() {
@@ -51,23 +56,24 @@ SettingsChannel::~SettingsChannel() {
5156
void SettingsChannel::SendSettingsEvent() {
5257
rapidjson::Document event(rapidjson::kObjectType);
5358
rapidjson::MemoryPoolAllocator<>& allocator = event.GetAllocator();
54-
event.AddMember(kTextScaleFactorKey, GetTextScaleFactor(), allocator);
55-
event.AddMember(kAlwaysUse24HourFormatKey, Prefer24HourTime(), allocator);
59+
60+
event.AddMember(kTextScaleFactorKey, text_scale_factor_, allocator);
61+
event.AddMember(kAlwaysUse24HourFormatKey, locale_time_format_, allocator);
5662
event.AddMember(kPlatformBrightnessKey, "light", allocator);
5763
channel_->Send(event);
5864
}
5965

60-
bool SettingsChannel::Prefer24HourTime() {
66+
bool SettingsChannel::SetUpLocaleTimeFormat() {
6167
bool value = false;
6268
if (system_settings_get_value_bool(
6369
SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &value) ==
6470
SYSTEM_SETTINGS_ERROR_NONE) {
65-
return value;
71+
locale_time_format_ = value;
6672
}
67-
return false;
73+
return locale_time_format_;
6874
}
6975

70-
float SettingsChannel::GetTextScaleFactor() {
76+
float SettingsChannel::SetUpTextScaleFactor() {
7177
const float small = 0.8;
7278
const float normal = 1.0;
7379
const float large = 1.5;
@@ -79,18 +85,23 @@ float SettingsChannel::GetTextScaleFactor() {
7985
SYSTEM_SETTINGS_ERROR_NONE) {
8086
switch (value) {
8187
case SYSTEM_SETTINGS_FONT_SIZE_SMALL:
82-
return small;
88+
text_scale_factor_ = small;
89+
break;
8390
case SYSTEM_SETTINGS_FONT_SIZE_LARGE:
84-
return large;
91+
text_scale_factor_ = large;
92+
break;
8593
case SYSTEM_SETTINGS_FONT_SIZE_HUGE:
86-
return huge;
94+
text_scale_factor_ = huge;
95+
break;
8796
case SYSTEM_SETTINGS_FONT_SIZE_GIANT:
88-
return giant;
97+
text_scale_factor_ = giant;
98+
break;
8999
default:
90-
return normal;
100+
text_scale_factor_ = normal;
101+
break;
91102
}
92103
}
93-
return normal;
104+
return text_scale_factor_;
94105
}
95106

96107
} // namespace flutter

flutter/shell/platform/tizen/channels/settings_channel.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ class SettingsChannel {
2020

2121
private:
2222
void SendSettingsEvent();
23-
bool Prefer24HourTime();
24-
float GetTextScaleFactor();
23+
bool SetUpLocaleTimeFormat();
24+
float SetUpTextScaleFactor();
2525

2626
std::unique_ptr<BasicMessageChannel<rapidjson::Document>> channel_;
27+
bool locale_time_format_ = false;
28+
float text_scale_factor_ = 1.0;
2729
};
2830

2931
} // namespace flutter

0 commit comments

Comments
 (0)