Use descriptive exception for FGS start timeout
If the app doesn't call startForeground() in time, throw a new exception
ForegroundServiceDidNotStartInTimeException.
Test: Manual test with a test app:
04-01 15:24:39.438 10293 9078 9078 E AndroidRuntime: FATAL EXCEPTION: main
04-01 15:24:39.438 10293 9078 9078 E AndroidRuntime: Process: com.google.omakoto.testapp, PID: 9078
04-01 15:24:39.438 10293 9078 9078 E AndroidRuntime: android.app.ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{92c1599 u0 com.google.omakoto.testapp/.MyFgs}
04-01 15:24:39.438 10293 9078 9078 E AndroidRuntime: at android.app.ActivityThread.throwRemoteServiceException(ActivityThread.java:1894)
Bug: 124137635
Change-Id: I7d97e15ba47a32a242fb461e7312adf3f28ab3a6
10 files changed