OSDN Git Service

Default 'persist.sys.timezone' property to GMT if not set on init.
authorPrzemyslaw Szczepaniak <pszczepaniak@google.com>
Wed, 22 Mar 2017 15:13:17 +0000 (15:13 +0000)
committerPrzemyslaw Szczepaniak <pszczepaniak@google.com>
Wed, 22 Mar 2017 18:02:30 +0000 (18:02 +0000)
Test: make, flashall -w and tested persist.sys.timezone value
Bug: 36488101
Change-Id: I6d0dab1e247dd7c303153bbe0e997581e36a973d

services/java/com/android/server/SystemServer.java

index de4a55b..c907cf3 100644 (file)
@@ -235,6 +235,15 @@ public final class SystemServer {
                 SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME);
             }
 
+            //
+            // Default the timezone property to GMT if not set.
+            //
+            String timezoneProperty =  SystemProperties.get("persist.sys.timezone");
+            if (timezoneProperty == null || timezoneProperty.isEmpty()) {
+                Slog.w(TAG, "Timezone not set; setting to GMT.");
+                SystemProperties.set("persist.sys.timezone", "GMT");
+            }
+
             // If the system has "persist.sys.language" and friends set, replace them with
             // "persist.sys.locale". Note that the default locale at this point is calculated
             // using the "-Duser.locale" command line flag. That flag is usually populated by