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

Commit 8607c1b2 authored by padarshr's avatar padarshr Committed by Steve Kondik
Browse files

Ensure to add Persistent Apps to LruProcess List on app restart

This change will ensure to add Persistent Apps to mLruProcesses
if not already present while restarting.Previously, on some
occasions, the process was not getting added to the list
resulting in SecurityException as this process was not found
in the mLruProcesses.

Change-Id: I26813a794e01aae316dffd3cf2bb38ab66ac69a9
parent 2293e60c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -2417,11 +2417,15 @@ public final class ActivityManagerService extends ActivityManagerNative
            ProcessRecord client) {
        final boolean hasActivity = app.activities.size() > 0 || app.hasClientActivities;
        final boolean hasService = false; // not impl yet. app.services.size() > 0;
        if (!activityChange && hasActivity) {
        if (!activityChange && hasActivity && !(app.persistent && !mLruProcesses.contains(app))) {
            // The process has activties, so we are only going to allow activity-based
            // adjustments move it.  It should be kept in the front of the list with other
            // processes that have activities, and we don't want those to change their
            // order except due to activity operations.
            // Also, do not return if the app is persistent and not found in mLruProcesses.
            // For persistent apps, service records are not cleaned up and if we return
            // here it will not be added to mLruProcesses and on its restart it might lead to
            // securityException if app is not present in mLruProcesses.
            return;
        }