Apply restriction at startForegroundService() call.
Apply FGS background startForeground() restriction at
Context.startForegroundService() call (the startServiceLocked()
method with fgRequired flag), this is earlier than later
apply restriction at Service.startForeground() call so the service will
not start at all if Context.startForegroundService() and mAllowStartForeground
is false.
Bug: 157473819
Test: atest atest cts/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
Change-Id: Id5c69d697e845376f49b5071e09fdb971d0a4255
1 file changed