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

Commit cb6873c0 authored by Michal Karpinski's avatar Michal Karpinski
Browse files

Allow all packages participating in any foreground task start

activities from background

Bug: 128772406 (mechanism)
Bug: 123970943 (manifestation)
Test: manual (going through SUW)
Change-Id: Idee58db64357359619b48ebda4afd288a9349fa3
parent 75ca391b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -997,6 +997,10 @@ class ActivityStarter {
            if (callerApp.areBackgroundActivityStartsAllowed()) {
                return false;
            }
            // don't abort if the caller has an activity in any foreground task
            if (callerApp.hasActivityInVisibleTask()) {
                return false;
            }
        }
        // don't abort if the callingUid has START_ACTIVITIES_FROM_BACKGROUND permission
        if (mService.checkPermission(START_ACTIVITIES_FROM_BACKGROUND, callingPid, callingUid)
+14 −0
Original line number Diff line number Diff line
@@ -471,6 +471,20 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
        }
    }

    boolean hasActivityInVisibleTask() {
        for (int i = mActivities.size() - 1; i >= 0; --i) {
            TaskRecord task = mActivities.get(i).getTaskRecord();
            if (task == null) {
                continue;
            }
            ActivityRecord topActivity = task.getTopActivity();
            if (topActivity != null && topActivity.visible) {
                return true;
            }
        }
        return false;
    }

    /**
     * Update the top resuming activity in process for pre-Q apps, only the top-most visible
     * activities are allowed to be resumed per process.