From d26e1ff2de354896781c44143d9dfc7b8a350acd Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Thu, 22 Sep 2016 16:42:55 -0600 Subject: [PATCH] Limit LOCALE_CHANGED broadcast when init'ing. Immediately when a device finishes booting, retrieveSettings() will read out the current configuration details, including locale. At that point mProcessesReady has been set, meaning third-party apps can be launched. But we haven't started persistent apps yet! If you have a persistent app (like com.android.phone) which also has a somewhat related app (like com.android.stk) merged into the same process, the LOCALE_CHANGED broadcast could start the process pointing at an unexpected code/data location. This change avoids this by only sending LOCALE_CHANGED broadcasts to registered receivers (no manifest receivers) when the locale is being read for the first time (initLocale). Test: booted device with locked SIM Bug: 31665819 Change-Id: I977a596501c6ba492005f98a2367e4b9f67e2dba --- .../core/java/com/android/server/am/ActivityManagerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 7ca38609e29b8..b623bc7901398 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -19040,7 +19040,7 @@ public final class ActivityManagerService extends ActivityManagerNative if ((changes&ActivityInfo.CONFIG_LOCALE) != 0) { intent = new Intent(Intent.ACTION_LOCALE_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); - if (!mProcessesReady) { + if (initLocale || !mProcessesReady) { intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY); } broadcastIntentLocked(null, null, intent,