summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2015-08-12 10:39:13 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-12 10:39:13 +0000
commit86b6d204a5321bf2874c2cbee3452e674605c21f (patch)
tree14ec31a6fb8e13120480f4a352586037c16aa232 /services/java
parente950a4b22caaf849bfeb68768931e0e793877119 (diff)
parentbf88205bef88f78ade5c6830e6203aa343387820 (diff)
downloadframeworks_base-86b6d204a5321bf2874c2cbee3452e674605c21f.zip
frameworks_base-86b6d204a5321bf2874c2cbee3452e674605c21f.tar.gz
frameworks_base-86b6d204a5321bf2874c2cbee3452e674605c21f.tar.bz2
am bf88205b: Fall back to persist.sys.language/country if locale isn\'t set.
* commit 'bf88205bef88f78ade5c6830e6203aa343387820': Fall back to persist.sys.language/country if locale isn't set.
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/SystemServer.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 760c2dc..7dd16d1 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -95,6 +95,7 @@ import com.android.server.wm.WindowManagerService;
import dalvik.system.VMRuntime;
import java.io.File;
+import java.util.Locale;
import java.util.Timer;
import java.util.TimerTask;
@@ -182,6 +183,23 @@ public final class SystemServer {
SystemClock.setCurrentTimeMillis(EARLIEST_SUPPORTED_TIME);
}
+ // 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
+ // AndroidRuntime using the same set of system properties, but only the system_server
+ // and system apps are allowed to set them.
+ //
+ // NOTE: Most changes made here will need an equivalent change to
+ // core/jni/AndroidRuntime.cpp
+ if (!SystemProperties.get("persist.sys.language").isEmpty()) {
+ final String languageTag = Locale.getDefault().toLanguageTag();
+
+ SystemProperties.set("persist.sys.locale", languageTag);
+ SystemProperties.set("persist.sys.language", "");
+ SystemProperties.set("persist.sys.country", "");
+ SystemProperties.set("persist.sys.localevar", "");
+ }
+
// Here we go!
Slog.i(TAG, "Entered the Android system server!");
EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN, SystemClock.uptimeMillis());