Add API Service.getForegroundServiceType()
To return current foregroundServiceType if the service has become a
foreground service.
If service become foreground service by calling Service.startForeground(int,
Notification, int type), the returned type is the type specified.
If the no-type version Service.startForeground(int, Notification) is called.
the returned type is foregroundServiceType specified in manifest.
If no foregroundServiceType specified in manifest, the returned type is
zero.
If the service is not a foreground service, the returned type is zero.
Bug: 124517685
Test: atest cts/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java#testFgsLocation
Change-Id: Ibcc4431429a90aab92a5533e296fb104b4add9e6
5 files changed