Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 34fcc7a2 authored by Yunfan Chen's avatar Yunfan Chen
Browse files

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
parent a7998431
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -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);