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

Skip to content
Commit a3716118 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Let sender permission allow background launch when starting recents

Currently the recents activity is started by a pending intent created
by launcher. And the sender is system server.
(HIERARCHY_OP_TYPE_PENDING_INTENT in WindowOrganizerController)

If the intent creator doesn't have visible windows, e.g. launcher is
occluded by its another embedded of another package, then the background
launch policy will check whether the intent sender is allowed. But
system server also doesn't have visible windows, which causes
BackgroundActivityStartController#
checkBackgroundActivityStartAllowedBySender to return BalVerdict.BLOCK.
Which will set MOVE_TO_FRONT_AVOID_PI_ONLY_CREATOR_ALLOWS to disallow
moving the target task to front.
See I72a6c22a5fb27aeac52a4e5d46c6a16e28ee6757 for the block policy.

Although currently the recents activity can still move to front because
some places miss to check blocking the launch. Then it is like just
using a security hole.

By adding the background launch permission hint to ActivityOptions,
BackgroundActivityStartController#hasBalPermission will check if the
real caller has permission START_ACTIVITIES_FROM_BACKGROUND. Then
it will pass because the intent sender is system server.

Bug: 341618283
Flag: EXEMPT bugfix
Test: atest NexusLauncherTests: \
            com.android.quickstep.TaskAnimationManagerTest
Test: Swipe to minus one screen. Click a news item to Launch chrome.
      Swipe from bottom to return to home. There should not have an
      error log:
      "Without Android 15 BAL hardening this activity would be moved
       to the foreground ... only the creator of the PendingIntent
       allows BAL. realCallingPackage: android.uid.system:1000 ..."
       (from ActivityStarter#logPIOnlyCreatorAllowsBAL)
Change-Id: I19153f6553c09421bca248d4ff9110d168b34f98
parent 80dbe9ae
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment