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

Skip to content
Commit 659beaad authored by Hui Yu's avatar Hui Yu
Browse files

Initial implementation of foreground service delegate feature.

A service module such as MediaSessionService, VOIP, Camera, Microphone, Location can ask
ActivityManagerService to start a foreground service delegate on behalf of the actual app,
by which the client app's process state can be promoted to FOREGROUND_SERVICE process state which
is higher than the app's actual process state if the app is in the background. This can help to
keep the app in the memory and extra run-time.
The app does not need to define an actual service component nor add it into manifest file.

Add shell command to start/stop delegate:
adb shell am set-foreground-service-delegate packageName start|stop
to start/stop foreground service delegate on a app's process.

Note: only when the app can pass BG-FGS-start check, its FGS delegate is
allowed to start.

Bug: 256873819
Test: atest cts/tests/app/src/android/app/cts/ActivityManagerFgsDelegateTest.java
Change-Id: I54de7ad851f57a66d2e75e6fbc02aeafa619cc1b
parent 1abfc04d
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