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

Commit 91846de2 authored by Michal Karpinski's avatar Michal Karpinski Committed by Android (Google) Code Review
Browse files

Merge "Allow all packages participating in any foreground task start activities from background"

parents e456bdf2 cb6873c0
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.