From 34fcc7a2afc7f27f49d5db3e9b1f85380fc472b5 Mon Sep 17 00:00:00 2001 From: Yunfan Chen Date: Thu, 11 Oct 2018 16:26:09 -0700 Subject: Update process config when global config changed This change will call process config update when a global config changed. This will ensure the running process can get a up to dated config. Bug: 116429377 Bug: 113253755 Test: repro steps on the bug b/116429377 will not produce the bug anymore. Test: go/wm-smoke Change-Id: If7f1f867f127e33e0c53e8be7179233e5340eea1 --- .../android/server/am/ActivityTaskManagerService.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityTaskManagerService.java b/services/core/java/com/android/server/am/ActivityTaskManagerService.java index 4dd5a998d433..b369b7135b4e 100644 --- a/services/core/java/com/android/server/am/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/am/ActivityTaskManagerService.java @@ -141,7 +141,6 @@ import android.app.WindowConfiguration; import android.app.admin.DevicePolicyCache; import android.app.assist.AssistContent; import android.app.assist.AssistStructure; -import android.app.servertransaction.ConfigurationChangeItem; import android.app.usage.UsageEvents; import android.content.ActivityNotFoundException; import android.content.ComponentName; @@ -4525,19 +4524,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { mAm.mHandler.sendMessage(msg); } - // TODO: Consider using mPidMap to update configurations for processes. - for (int i = mAm.mLruProcesses.size() - 1; i >= 0; i--) { - ProcessRecord app = mAm.mLruProcesses.get(i); - try { - if (app.thread != null) { - if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Sending to proc " - + app.processName + " new config " + configCopy); - getLifecycleManager().scheduleTransaction(app.thread, - ConfigurationChangeItem.obtain(configCopy)); - } - } catch (Exception e) { - Slog.e(TAG_CONFIGURATION, "Failed to schedule configuration change", e); + for (int i = mPidMap.size() - 1; i >= 0; i--) { + WindowProcessController app = mPidMap.get(mPidMap.keyAt(i)); + if (DEBUG_CONFIGURATION) { + Slog.v(TAG_CONFIGURATION, "Update process config of " + + app.mName + " to new config " + configCopy); } + app.onConfigurationChanged(configCopy); } Intent intent = new Intent(Intent.ACTION_CONFIGURATION_CHANGED); -- cgit v1.2.3-59-g8ed1b