summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2015-08-11 15:40:34 +0100
committerNarayan Kamath <narayan@google.com>2015-08-12 11:03:46 +0100
commitbf88205bef88f78ade5c6830e6203aa343387820 (patch)
tree77928a8c4c09d75061796e6025368f0943c4b26c /services/java
parente19b76cbb50db816c535d6d4a5bf125f52c04eba (diff)
downloadframeworks_base-bf88205bef88f78ade5c6830e6203aa343387820.zip
frameworks_base-bf88205bef88f78ade5c6830e6203aa343387820.tar.gz
frameworks_base-bf88205bef88f78ade5c6830e6203aa343387820.tar.bz2
Fall back to persist.sys.language/country if locale isn't set.
This will prevent users from losing their language setting when they take an OTA to M. bug: 23021286 Change-Id: Ifb66f6bf6a940ab745edac709321f3009ec6eab4
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 eb02199..bd72860 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());