Skip to content
Commit 8596dedf authored by Michal Karpinski's avatar Michal Karpinski
Browse files

Add a setting for background activity starts enabled state

and basic rules for enforcement

The setting is on by default. It can be switched off with
a developer option (see accompanying commit) or
"adb shell settings put global background_activity_starts_enabled 0".

The setting is wired into ActivityStarter. When it's switched
off, all unsupported background activity starts are aborted and
it's currently manifested with a toast for quick feedback.

Only basic policy rules are added for now:
0) is it one of the most important UIDs?
1) does the calling app have any foreground activity?
2) is the calling process important enough to always be able
   to start an activity?
3) does the calling uid have any visible window?

The policy rules will be extended to allow for more use cases
in forthcoming CLs.

Most notable use cases not currently covered:
1) Notifications
2) Widgets
3) Shortcuts
4) Some of the most important system apps (e.g. com.android.vending)
5) Accessibility services and similar (IMEs covered thanks to
   visible window exemption)
6) Recents button double tap to open the previous app
See bluedoc for some more.

Bug: 110956953
Test: atest WmTests:ActivityStarterTests
Manual test:
  (on)  observe all activities are started as they used to be
  (off) starts not satisfying one of the above rules are aborted,
        a toast specifying callingPackage is shown instead
Change-Id:  I1a3e14828c96f005d975ef6998f3bda678ccab29
parent e30fc89f
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