From 03bf28bf5c62deb2e1d420a0a9028a09412af972 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Fri, 17 Apr 2020 15:53:20 -0700 Subject: [PATCH] Update ProcessRecord ApplicationInfo for RROs When overlays update, the changes in ApplicationInfo are propagated to affected processes. The ApplicationInfo in the ProcessRecords of the running processes are not updated in ActivityManagerService. Persistent processes reuse the existing ProcessRecord when they are restarted, so they are restarted with outdated overlay paths. This change updates the ApplicationInfo of ProcessRecords when overlay paths change. Bug: 154242963 Test: open settings > system > gestures switch to another navigation mode kill sysui (adb shell kill `pid com.android.systemui`) Confirm that navigation mode has not been reset Change-Id: I85f89df538079e1fb1d695a9b13b388dc338b47b --- .../com/android/server/am/ProcessList.java | 25 +++++++++++-------- .../com/android/server/am/ProcessRecord.java | 2 +- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java index 595275d201540..caacc2d8667f2 100644 --- a/services/core/java/com/android/server/am/ProcessList.java +++ b/services/core/java/com/android/server/am/ProcessList.java @@ -3569,17 +3569,22 @@ public final class ProcessList { final int packageCount = app.pkgList.size(); for (int j = 0; j < packageCount; j++) { final String packageName = app.pkgList.keyAt(j); - if (updateFrameworkRes || packagesToUpdate.contains(packageName)) { - try { - final ApplicationInfo ai = AppGlobals.getPackageManager() - .getApplicationInfo(packageName, STOCK_PM_FLAGS, app.userId); - if (ai != null) { - app.thread.scheduleApplicationInfoChanged(ai); - } - } catch (RemoteException e) { - Slog.w(TAG, String.format("Failed to update %s ApplicationInfo for %s", - packageName, app)); + if (!updateFrameworkRes && !packagesToUpdate.contains(packageName)) { + continue; + } + try { + final ApplicationInfo ai = AppGlobals.getPackageManager() + .getApplicationInfo(packageName, STOCK_PM_FLAGS, app.userId); + if (ai == null) { + continue; } + app.thread.scheduleApplicationInfoChanged(ai); + if (ai.packageName.equals(app.info.packageName)) { + app.info = ai; + } + } catch (RemoteException e) { + Slog.w(TAG, String.format("Failed to update %s ApplicationInfo for %s", + packageName, app)); } } } diff --git a/services/core/java/com/android/server/am/ProcessRecord.java b/services/core/java/com/android/server/am/ProcessRecord.java index 61ebc361b6afe..60c119aca9d07 100644 --- a/services/core/java/com/android/server/am/ProcessRecord.java +++ b/services/core/java/com/android/server/am/ProcessRecord.java @@ -86,7 +86,7 @@ class ProcessRecord implements WindowProcessListener { private static final String TAG = TAG_WITH_CLASS_NAME ? "ProcessRecord" : TAG_AM; private final ActivityManagerService mService; // where we came from - final ApplicationInfo info; // all about the first app in the process + volatile ApplicationInfo info; // all about the first app in the process final ProcessInfo processInfo; // if non-null, process-specific manifest info final boolean isolated; // true if this is a special isolated process final boolean appZygote; // true if this is forked from the app zygote