OSDN Git Service

Fix cross-user background activity starts.
authorAlan Stokes <alanstokes@google.com>
Wed, 8 May 2019 15:56:45 +0000 (16:56 +0100)
committerAlan Stokes <alanstokes@google.com>
Thu, 9 May 2019 12:43:58 +0000 (12:43 +0000)
commit2f4a4ed6b5b04a6946ca106ec6234894a35e6d5e
tree1da66ce34c7af6803c1e415dc511e4846ed37b77
parent39789e86f766a16b6e0398dec963e96d280dac21
Fix cross-user background activity starts.

This fixes some issues with checking background activity starts when
there are multiple users:

1. System server can run in other users, and we need to take this into
account when checking for Process.SYTEM_UID.

2. Starting an activity via cross-profile intent uses
startActivityAsCaller. This will generally fail our checks (because the
app we are pretending to be is not foreground) but it should be
allowed - when we use this call the system server definitely wants the
activity to be shown, and there are sufficient permission checks in
place to prevent abuse.

Bug: 130622120
Test: CTS Verifier tests no longer get blocked activity starts.
Test: atest BackgroundActivityLaunchTest
Test: atest RootWindowContainerTests
Test: atest WmTests:ActivityStarterTests
Test: atest CtsWindowManagerDeviceTestCases:ActivityStarterTests
Test: atest CtsAppTestCases:.ServiceTest
Change-Id: Id05a2cb089ac99b15cff8a3cd311ee043f13c8e1
services/core/java/com/android/server/wm/ActivityStarter.java
services/core/java/com/android/server/wm/ActivityTaskManagerService.java