[WRTjs][VD][PDNCF] Do not make ICU timezone cache on wrt-loader 98/325498/3 tizen_9.0
authorDonghyun, Song <dh81.song@samsung.com>
Wed, 11 Jun 2025 05:12:07 +0000 (14:12 +0900)
committerDongHyun Song <dh81.song@samsung.com>
Wed, 11 Jun 2025 05:19:25 +0000 (05:19 +0000)
Before timezone has set, already created wrt-loader has UTC timezone,
and by ICU's timezone cache, the app process has still UTC timezone,
even though timezone has set by system on wrt-loader state because
TimeZoneMonitor is not working on wrt-loader.

detectHostTimeZone() won't create DEFAULT_ZONE global value, later
TimeZoneMonitor will call createDefault() again when renderer created.

From m130, this will be refactored with detecting timezone change logic
on wrt-loader.

Change-Id: I7fd4125a34a307892314f1b5fe864234f6d04f14
Signed-off-by: Donghyun, Song <dh81.song@samsung.com>
base/i18n/icu_util.cc

index b62e461bb76a9f5e2cdf6818bd2004ca417ab5a9..b4af3bf5cd637f13831f2f22c316888b9797ac16 100644 (file)
 #include "third_party/icu/source/i18n/unicode/timezone.h"
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+#include "base/command_line.h"
+#endif
+
 namespace base::i18n {
 
 #if !BUILDFLAG(IS_NACL)
@@ -349,7 +353,19 @@ void InitializeIcuTimeZone() {
   // To respond to the time zone change properly, the default time zone
   // cache in ICU has to be populated on starting up.
   // See TimeZoneMonitorLinux::NotifyClientsFromImpl().
+#if BUILDFLAG(IS_TIZEN_TV)
+  base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+  base::FilePath program =
+      command_line ? command_line->GetProgram() : base::FilePath("");
+  if (program.value() == "/usr/bin/wrt-loader") {
+    LOG(INFO) << "do not make TimeZone cache on wrt-loader";
+    std::unique_ptr<icu::TimeZone> zone(icu::TimeZone::detectHostTimeZone());
+  } else {
+    std::unique_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
+  }
+#else
   std::unique_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
+#endif
 #endif  // BUILDFLAG(IS_ANDROID)
 }